From a1895167364f98ce64995366c7d1c58e9ccec3c0 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Wed, 20 Aug 2025 12:49:25 +0700 Subject: [PATCH] [tools][styles] Output diffs in generate_drules.sh Signed-off-by: Konstantin Pastbin --- .gitignore | 18 ++++++++++-------- tools/unix/generate_drules.sh | 29 ++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 4dc9ffa93..c895ffa8a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,12 +14,10 @@ stxxl.errlog stxxl.log screenlog.0 -data/symbols/*/design/ # symbols png/sdf are now generated at build data/symbols/**/symbols.png data/symbols/**/symbols.sdf -data/colors_design.txt -data/patterns_design.txt + data/bookmarks data/edits.xml data/World.mwm @@ -27,11 +25,15 @@ data/WorldCoasts.mwm data/world_mwm/* data/*_hash data/drules_proto* -data/classificator.txt -data/types.txt -data/visibility.txt -data/colors.txt -data/patterns.txt +data/classificator.txt* +data/types.txt* +data/visibility.txt* +data/colors.txt* +data/patterns.txt* +# TODO: designer is not used at the moment +# data/symbols/*/design/ +# data/colors_design.txt +# data/patterns_design.txt # Compiled Python *.pyc diff --git a/tools/unix/generate_drules.sh b/tools/unix/generate_drules.sh index 44ffded4b..7ef893fc4 100755 --- a/tools/unix/generate_drules.sh +++ b/tools/unix/generate_drules.sh @@ -12,20 +12,24 @@ function BuildDrawingRules() { styleName=$2 suffix=${3-} echo "Building drawing rules for style $styleType/$styleName" - # Cleanup - rm "$DATA_PATH"/drules_proto$suffix.{bin,txt} || true + # Cleanup old compiled drules and diff + rm "$DATA_PATH"/drules_proto$suffix.{bin,txt.diff} || true + # Store old txt version for diff + mv -f "$DATA_PATH"/drules_proto$suffix.txt{,.prev} || true # Run script to build style python3 "$OMIM_PATH/tools/kothic/src/libkomwm.py" --txt \ -s "$DATA_PATH/styles/$styleType/$styleName/style.mapcss" \ -o "$DATA_PATH/drules_proto$suffix" \ -p "$DATA_PATH/styles/$styleType/include/" + # Output diff and store to a file + diff -u "$DATA_PATH"/drules_proto$suffix.txt{.prev,} | tee "$DATA_PATH"/drules_proto$suffix.txt.diff } -# Cleanup -cleanup=(classificator.txt types.txt visibility.txt colors.txt patterns.txt) -for item in ${cleanup[*]} +outputs=(classificator.txt types.txt visibility.txt colors.txt patterns.txt drules_proto.txt) +# Store old versions for diffs +for item in ${outputs[*]} do - rm $DATA_PATH/$item || true + mv $DATA_PATH/$item{,.prev} || true done # Building drawing rules @@ -37,13 +41,16 @@ BuildDrawingRules outdoors dark _outdoors_dark BuildDrawingRules vehicle light _vehicle_light BuildDrawingRules vehicle dark _vehicle_dark +# TODO: the designer is not used at the moment. # In designer mode we use drules_proto_design file instead of standard ones -cp $OMIM_PATH/data/drules_proto_default_light.bin $OMIM_PATH/data/drules_proto_default_design.bin +# cp $OMIM_PATH/data/drules_proto_default_light.bin $OMIM_PATH/data/drules_proto_default_design.bin echo "Exporting transit colors..." python3 "$OMIM_PATH/tools/python/transit/transit_colors_export.py" \ "$DATA_PATH/colors.txt" > /dev/null +# Merged drules_proto.bin is used by the map generator. +# It contains max visibilities (min visible zoom) for features across all styles. echo "Merging styles..." python3 "$OMIM_PATH/tools/python/stylesheet/drules_merge.py" \ "$DATA_PATH/drules_proto_default_light.bin" \ @@ -52,3 +59,11 @@ python3 "$OMIM_PATH/tools/python/stylesheet/drules_merge.py" \ "$DATA_PATH/drules_proto.bin" \ "$DATA_PATH/drules_proto.txt" \ > /dev/null + +# Output diffs and store to files +for item in ${outputs[*]} +do + diff -u "$DATA_PATH"/$item{.prev,} | tee "$DATA_PATH"/$item.diff +done + +echo "Diffs for all changes are stored in $DATA_PATH/*.txt.diff" \ No newline at end of file