Skip to content

Commit

Permalink
Merge pull request #267 from casework/remove_redundant_example_rebuilds
Browse files Browse the repository at this point in the history
Remove redundant example rebuilds
  • Loading branch information
ajnelson-nist authored Dec 22, 2023
2 parents 4bdfe48 + 41d2211 commit 454cb47
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion examples/asgard/src/asgard_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
an alternative mechanism.
"""

__version__ = "0.1.0"
__version__ = "0.1.1"

import json
import sys
Expand All @@ -36,6 +36,7 @@ def main() -> None:
obj["uco-core:object"].append(item)

json.dump(obj, sys.stdout, indent=4)
sys.stdout.write("\n")


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion examples/crossover_heist/src/crossover_heist_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
This script was copied from the Owl Trafficking scenario.
"""

__version__ = "0.1.0"
__version__ = "0.1.1"

import logging
import json
Expand All @@ -42,6 +42,7 @@ def main() -> None:
obj["@graph"].append(item)

json.dump(obj, sys.stdout, indent=4)
sys.stdout.write("\n")


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion examples/crossover_wmd/src/crossover_wmd_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
an alternative mechanism.
"""

__version__ = "0.1.0"
__version__ = "0.1.1"

import logging
import json
Expand Down Expand Up @@ -48,6 +48,7 @@ def main() -> None:
obj["@graph"].append(item)

json.dump(obj, sys.stdout, indent=4)
sys.stdout.write("\n")


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion examples/hardware_duplicator/src/hardware_duplicator_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
This script was copied from the Owl Trafficking scenario.
"""

__version__ = "0.1.0"
__version__ = "0.1.1"

import logging
import json
Expand All @@ -42,6 +42,7 @@ def main() -> None:
obj["@graph"].append(item)

json.dump(obj, sys.stdout, indent=4)
sys.stdout.write("\n")


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion examples/owl_trafficking/src/owl_trafficking_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
an alternative mechanism.
"""

__version__ = "0.1.0"
__version__ = "0.1.1"

import logging
import json
Expand All @@ -44,6 +44,7 @@ def main() -> None:
obj["@graph"].append(item)

json.dump(obj, sys.stdout, indent=4)
sys.stdout.write("\n")


if __name__ == "__main__":
Expand Down
14 changes: 12 additions & 2 deletions examples/src/example-basedir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,18 @@ all:
> $$TMPDIR/$(example_name).json \
&& echo "INFO:examples/$(example_name):Edits found in $(example_name).json, and about to be overwritten. Stashing state in temporary file in case they were not meant to be overwritten. Restore by running: 'mv $$TMPDIR/$(example_name).json $(example_name).json'." >&2 \
)
cp src/generated-index.html index.html
cp src/generated-$(example_name).json $(example_name).json
diff \
index.html \
src/generated-index.html \
|| cp \
src/generated-index.html \
index.html
diff \
$(example_name).json \
src/generated-$(example_name).json \
|| cp \
src/generated-$(example_name).json \
$(example_name).json

# Generic tests:
# * Confirm the Git-committed version of the combined example JSON matches the file generated from the JSON pieces.
Expand Down
7 changes: 1 addition & 6 deletions examples/src/example-src.mk
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ generated-$(example_name).json: \
python3 $(example_name)_json.py \
$(example_name)_base.json \
$(example_snippets_json) \
> __$@
@#Use same normalization procedure when constructing generated file.
python3 -m json.tool \
__$@ \
_$@
rm __$@
> _$@
mv _$@ $@

generated-$(example_name).ttl: \
Expand Down

0 comments on commit 454cb47

Please sign in to comment.