-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add script and documentation for generating a json diff for releases, and add the 0.E to 0.F diff * Apply suggestions from code review Co-authored-by: actual-nh <[email protected]>
- Loading branch information
1 parent
67105a9
commit de00cc4
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
A section we have added to the changelog is the json entity diff. | ||
This enumerates the json entity types that have been added to the game since the last release. | ||
|
||
To generate this diff: | ||
|
||
Check out the previous release: | ||
git checkout 0.E | ||
Generate lists of json entities with jq: | ||
jq -s -f tools/json_tools/jq/enumerate_json_entities.jq $(find data/json -name "*.json" | grep -v obsolete) > json_types_0.E | ||
jq -s -f tools/json_tools/jq/enumerate_json_entities.jq $(find data/mods -name "*.json" | grep -v obsolete) > json_mod_types_0.E | ||
|
||
Check out current master: | ||
git checkout master | ||
Generate lists of json entities with jq: | ||
jq -s -f tools/json_tools/jq/enumerate_json_entities.jq $(find data/json -name "*.json" | grep -v obsolete) > json_types_0.F | ||
jq -s -f tools/json_tools/jq/enumerate_json_entities.jq $(find data/mods -name "*.json" | grep -v obsolete) > json_mod_types_0.F | ||
|
||
Generate diffs between the corresponding enumerations capturing the type headers and just the added entity ids. | ||
diff -U 10000 json_types_0.E json_types_0.F | grep "\(^. \"type\"\)\|\(^+ \+\".*\",\)" > json_types_diff_0.E_to_0.F | ||
diff -U 10000 json_mod_types_0.E json_mod_types_0.F | grep "\(^. \"type\"\)\|\(^+ \+\".*\",\)" > json_mod_types_diff_0.E_to_0.F | ||
|
||
Run this goofy script to just list the type headers and append the count of added entities after each line. | ||
paste <(cut json_types_diff_0.E_to_0.F -d : -f 3) <(cut -d : -f 1 json_types_diff_0.E_to_0.F | awk 'NR == 1{old = $1; next} {print $1 - old - 1; old = $1}') > json_types_diff_0.E_to_0.F_with_counts | ||
paste <(cut json_mod_types_diff_0.E_to_0.F -d : -f 3) <(cut -d : -f 1 json_mod_types_diff_0.E_to_0.F | awk 'NR == 1{old = $1; next} {print $1 - old - 1; old = $1}') > json_mod_types_diff_0.E_to_0.F_with_counts | ||
|
||
Then reformat into a human-readable summary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Output list of all json entities in target files, grouped by entity type and sorted. | ||
|
||
# Need -s to unify all the different files into one stream of objects. | ||
# jq -s -f tools/json_tools/jq/enumerate_json_entities.jq $(find data/json -name "*.json" | grep -v obsolete) | ||
|
||
flatten | | ||
map( select( .type? != "migration" and has( "id" ) ) ) | | ||
group_by( .type ) | | ||
.[] | | ||
{ type:.[0].type,id:[ (.[].id? | tostring), (.[].ident? | tostring) ] } |