Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas McDonald committed Oct 13, 2023
1 parent 7117525 commit a337b13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion TestModels/Refinement/src/Index.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
include "SimpleRefinementImpl.dfy"

module {:extern "simple_refinement_internaldafny"} SimpleRefinement refines AbstractSimpleRefinementService {
module {:extern "simple.refinement.internaldafny"} SimpleRefinement refines AbstractSimpleRefinementService {
import Operations = SimpleRefinementImpl

function method DefaultSimpleRefinementConfig(): SimpleRefinementConfig {
Expand Down
2 changes: 1 addition & 1 deletion TestModels/Refinement/src/WrappedSimpleRefinementImpl.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
include "../Model/SimpleRefinementTypesWrapped.dfy"

module {:extern "simple_refinement_internaldafny_wrapped"} WrappedSimpleRefinementService refines WrappedAbstractSimpleRefinementService {
module {:extern "simple.refinement.internaldafny.wrapped"} WrappedSimpleRefinementService refines WrappedAbstractSimpleRefinementService {
import WrappedService = SimpleRefinement
function method WrappedDefaultSimpleRefinementConfig(): SimpleRefinementConfig {
SimpleRefinementConfig
Expand Down
30 changes: 16 additions & 14 deletions TestModels/SharedMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ CODEGEN_CLI_ROOT := $(PROJECT_ROOT)/../codegen/smithy-dafny-codegen-cli
GRADLEW := $(PROJECT_ROOT)/../codegen/gradlew

# Returns the name of the Python module as stored in the project's build configuration file (pyproject.toml).
PYTHON_MODULE_NAME := $(shell grep -m 1 polymorph_package_name $(LIBRARY_ROOT)/runtimes/python/pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
define GetPythonModuleName
$(shell grep -m 1 polymorph_package_name runtimes/python/pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
endef

########################## Dafny targets

Expand Down Expand Up @@ -260,10 +262,10 @@ polymorph_python: OUTPUT_PYTHON_WRAPPED=--output-python $(LIBRARY_ROOT)/runtimes
polymorph_python: OUTPUT_LOCAL_SERVICE=--local-service-test
polymorph_python: _polymorph_wrapped
polymorph_python:
rm -rf $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated
mkdir $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated
mv $(LIBRARY_ROOT)/runtimes/python/smithygenerated/$(PYTHON_MODULE_NAME)/* runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated
rm -rf $(LIBRARY_ROOT)/runtimes/python/smithygenerated
rm -rf runtimes/python/src/$(call GetPythonModuleName)/smithygenerated
mkdir runtimes/python/src/$(call GetPythonModuleName)/smithygenerated
mv runtimes/python/smithygenerated/$(call GetPythonModuleName)/* runtimes/python/src/$(call GetPythonModuleName)/smithygenerated
rm -rf runtimes/python/smithygenerated
polymorph_python: POLYMORPH_LANGUAGE_TARGET=python
polymorph_python: _polymorph_dependencies

Expand Down Expand Up @@ -404,15 +406,15 @@ _python_revert_underscore_dependency_extern_names:
# Move Dafny-generated code into its expected location in the Python module
_mv_internaldafny_python:
# Remove any previously generated Dafny code in src/, then copy in newly-generated code
rm -rf $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/
mkdir $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/
mv dafny_src-py/*.py $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated
rm -rf $(LIBRARY_ROOT)/runtimes/python/dafny_src-py
rm -rf runtimes/python/src/$(call GetPythonModuleName)/internaldafny/generated/
mkdir runtimes/python/src/$(call GetPythonModuleName)/internaldafny/generated/
mv runtimes/python/dafny_src-py/*.py runtimes/python/src/$(call GetPythonModuleName)/internaldafny/generated
rm -rf runtimes/python/dafny_src-py
# Remove any previously generated Dafny code in test/, then copy in newly-generated code
rm -rf $(LIBRARY_ROOT)/runtimes/python/test/internaldafny/generated
mkdir $(LIBRARY_ROOT)/runtimes/python/test/internaldafny/generated
mv $(LIBRARY_ROOT)/runtimes/python/__main__-py/*.py $(LIBRARY_ROOT)/runtimes/python/test/internaldafny/generated
rm -rf $(LIBRARY_ROOT)/runtimes/python/__main__-py
rm -rf runtimes/python/test/internaldafny/generated
mkdir runtimes/python/test/internaldafny/generated
mv runtimes/python/__main__-py/*.py runtimes/python/test/internaldafny/generated
rm -rf runtimes/python/__main__-py

# Versions of Dafny as of ~9/28 seem to ALWAYS write output to __main__.py,
# regardless of the OUT parameter...?
Expand All @@ -437,7 +439,7 @@ _remove_src_module_python:
# The test/ file contains code to execute tests. The src/ file is largely empty.
# If the src/ file is installed most recently, tests will fail to run.
# By removing the src/ file, we ensure the test/ file is always the installed file.
rm $(LIBRARY_ROOT)/runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/module_.py
rm runtimes/python/src/$(call GetPythonModuleName)/internaldafny/generated/module_.py

transpile_dependencies_python: LANG=python
transpile_dependencies_python: transpile_dependencies
Expand Down

0 comments on commit a337b13

Please sign in to comment.