Add additional included files in smithy-templates for smithy init #1832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
This PR allows the inclusion of additional files and directories along with the template directory. The primary purpose of this is to allow templates to share common definitions of build files (i.e.
gradlew
,gradle/
,gradle.properties
, etc) without having to copy these files within each template directory.For example, consider a
gradle
example for thesmithy-quickstart-guide
. The template directory for this template must contain:my-template-repo/ ├── smithy-templates.json ├── gradle | └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── other/files └─ getting-started-gradle ├── README.md ├── build.gradle.kts ├── gradle │ └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── models │ └── weather.smithy └── smithy-build.json
In a repository with multiple examples, every single gradle example would need to copy the same
gradle/
directory,gradlew
gradel wrapper, etc.Instead, we can include these files from outside the template directory from another location in the template-containing repository. For example, with this change, we could re-define the template in the smithy-template.json file as:
This would include the gradle wrapper files from the root of the template repo in the cloned template. Each new gradle template could just repeat this "include" definition without needing to copy the gradle wrapper definitions. So now the template directory would look like:
As of right now all the files and directories are included at the root of the copied template directory
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.