Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas McDonald committed Oct 13, 2023
1 parent f9f5b5a commit cb619a8
Show file tree
Hide file tree
Showing 40 changed files with 49 additions and 88 deletions.
2 changes: 2 additions & 0 deletions TestModels/Aggregate/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.aggregate
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_aggregate

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Aggregate/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-aggregate-test-internaldafny = { path = "test/internaldafny", develop = f
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_aggregate"
2 changes: 2 additions & 0 deletions TestModels/Constraints/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.constraints
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_constraints

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Constraints/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-constraints-test-internaldafny = { path = "test/internaldafny", develop =
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_constraints"
2 changes: 2 additions & 0 deletions TestModels/Constructor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.constructor
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_constructor

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Constructor/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-constructor-test-internaldafny = { path = "test/internaldafny", develop =
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_constructor"
2 changes: 2 additions & 0 deletions TestModels/Dependencies/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.dependencies
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_dependencies

# This project takes dependencies on:
# - SimpleResource
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Dependencies/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ simple-dependencies-test-internaldafny = { path = "test/internaldafny", develop
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_dependencies"
2 changes: 2 additions & 0 deletions TestModels/Errors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.errors
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_errors

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Errors/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-errors-test-internaldafny = { path = "test/internaldafny", develop = fals
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_errors"
2 changes: 2 additions & 0 deletions TestModels/Extendable/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.extendable.resources
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_extendable_resources

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Extendable/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-extendable-resources-test-internaldafny = { path = "test/internaldafny",
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_extendable_resources"
2 changes: 2 additions & 0 deletions TestModels/Extern/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.dafnyExtern
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_dafnyextern

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Extern/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-extern-test-internaldafny = { path = "test/internaldafny", develop = fals
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_dafnyextern"
2 changes: 2 additions & 0 deletions TestModels/LocalService/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.localService
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_localservice

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/LocalService/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-localservice-test-internaldafny = { path = "test/internaldafny", develop
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_localservice"
2 changes: 2 additions & 0 deletions TestModels/Refinement/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.refinement
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_refinement

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Refinement/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-refinement-test-internaldafny = { path = "test/internaldafny", develop =
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_refinement"
2 changes: 2 additions & 0 deletions TestModels/Resource/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.resources
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_resources

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Resource/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-resources-test-internaldafny = { path = "test/internaldafny", develop = f
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_resources"
23 changes: 10 additions & 13 deletions TestModels/SharedMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +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).
define GetPythonModuleName
$(shell grep -m 1 polymorph_package_name runtimes/python/pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
endef
#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 @@ -189,7 +189,6 @@ _polymorph:
--dependent-model $(PROJECT_ROOT)/dafny-dependencies/Model \
$(patsubst %, --dependent-model $(PROJECT_ROOT)/%/Model, $(LIBRARIES)) \
--namespace $(NAMESPACE) \
$(SMITHY_BUILD) \
$(AWS_SDK_CMD)";

# If the target language of _polymorph_wrapped includes Python,
Expand All @@ -208,7 +207,6 @@ _polymorph_wrapped:
$(patsubst %, --dependent-model $(PROJECT_ROOT)/%/Model, $(LIBRARIES)) \
--namespace $(NAMESPACE) \
$(OUTPUT_LOCAL_SERVICE) \
$(SMITHY_BUILD) \
$(AWS_SDK_CMD)";

_polymorph_dependencies:
Expand Down Expand Up @@ -257,14 +255,13 @@ polymorph_java: _polymorph_dependencies
# For python, _polymorph_wrapped includes _polymorph (i.e. local service generation AND wrapped test)
# To generate only the local service, use the `_polymorph` target
# There is not a good way to generate only the wrapped test without the local service...
polymorph_python: SMITHY_BUILD=--smithy-build $(LIBRARY_ROOT)/smithy-build.json
polymorph_python: OUTPUT_PYTHON_WRAPPED=--output-python $(LIBRARY_ROOT)/runtimes/python/smithygenerated
polymorph_python: OUTPUT_LOCAL_SERVICE=--local-service-test
polymorph_python: _polymorph_wrapped
polymorph_python:
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/src/$(PYTHON_MODULE_NAME)/smithygenerated
mkdir runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated
mv runtimes/python/smithygenerated/$(PYTHON_MODULE_NAME)/* runtimes/python/src/$(PYTHON_MODULE_NAME)/smithygenerated
rm -rf runtimes/python/smithygenerated
polymorph_python: POLYMORPH_LANGUAGE_TARGET=python
polymorph_python: _polymorph_dependencies
Expand Down Expand Up @@ -406,9 +403,9 @@ _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 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/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/
mkdir runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/
mv runtimes/python/dafny_src-py/*.py runtimes/python/src/$(PYTHON_MODULE_NAME)/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 runtimes/python/test/internaldafny/generated
Expand Down Expand Up @@ -439,7 +436,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 runtimes/python/src/$(call GetPythonModuleName)/internaldafny/generated/module_.py
rm runtimes/python/src/$(PYTHON_MODULE_NAME)/internaldafny/generated/module_.py

transpile_dependencies_python: LANG=python
transpile_dependencies_python: transpile_dependencies
Expand Down
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleBlob/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.blob
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_blob

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-blob-test-internaldafny = { path = "test/internaldafny", develop = false}
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_blob"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleBoolean/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.boolean
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_boolean

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-boolean-test-internaldafny = { path = "test/internaldafny", develop = fal
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_boolean"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleDouble/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.smithyDouble
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_types_smithydouble

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ simple-double-test-internaldafny = { path = "test/internaldafny", develop = fals
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_smithydouble"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleEnum/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.smithyEnum
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_types_smithyenum

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-enum-test-internaldafny = { path = "test/internaldafny", develop = false}
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_smithyenum"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleInteger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.integer
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_types_integer

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-integer-test-internaldafny = { path = "test/internaldafny", develop = fal
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_integer"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleLong/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.smithyLong
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_types_smithylong

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-long-test-internaldafny = { path = "test/internaldafny", develop = false}
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_smithylong"
2 changes: 2 additions & 0 deletions TestModels/SimpleTypes/SimpleString/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../../SharedMakefile.mk

NAMESPACE=simple.types.smithyString
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_types_smithystring

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-string-test-internaldafny = { path = "test/internaldafny", develop = fals
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_types_smithystring"
2 changes: 2 additions & 0 deletions TestModels/Union/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CORES=2
include ../SharedMakefile.mk

NAMESPACE=simple.union
# TODO: Move to smithy-build.json once language-specific config is supported
PYTHON_MODULE_NAME=simple_union

# This project has no dependencies
# DEPENDENT-MODELS:=
Expand Down
4 changes: 0 additions & 4 deletions TestModels/Union/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ simple-union-test-internaldafny = { path = "test/internaldafny", develop = false
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[aws.polymorph.config]
# The string below defines where Polymorph will move code.
polymorph_package_name = "simple_union"
1 change: 1 addition & 0 deletions TestModels/dafny-dependencies/StandardLibrary/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CORES=2
include ../../SharedMakefile.mk

MAX_RESOURCE_COUNT=500000000
PYTHON_MODULE_NAME=standard_library
LIBRARIES :=

# define standard colors
Expand Down
Loading

0 comments on commit cb619a8

Please sign in to comment.