-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: gradle init support #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix: gradle init support #1040
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1cc4fe0
fix: gradle init support
sriram-mv e2b02d8
fix: click option short hand for dependency manager
sriram-mv c7e4fe6
fix: central runtime template mapping
sriram-mv 9a9dead
fix: py2
sriram-mv 5c16091
remove: remove builder config information from runtime templates
sriram-mv a05aa78
fix: init template structure
sriram-mv 182154d
Merge branch 'develop' into gradle_init
jfuss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| """ | ||
| All-in-one metadata about runtimes | ||
| """ | ||
|
|
||
| import itertools | ||
| import os | ||
|
|
||
| try: | ||
| import pathlib | ||
| except ImportError: | ||
| import pathlib2 as pathlib | ||
|
|
||
| _init_path = str(pathlib.Path(os.path.dirname(__file__)).parent) | ||
| _templates = os.path.join(_init_path, 'init', 'templates') | ||
|
|
||
| RUNTIME_DEP_TEMPLATE_MAPPING = { | ||
| "python": [ | ||
| { | ||
| "runtimes": ["python2.7", "python3.6", "python3.7"], | ||
| "dependency_manager": "pip", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"), | ||
| "build": True | ||
| } | ||
| ], | ||
| "ruby": [ | ||
| { | ||
| "runtimes": ["ruby2.5"], | ||
| "dependency_manager": "bundler", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-ruby"), | ||
| "build": True | ||
| } | ||
| ], | ||
| "nodejs": [ | ||
| { | ||
| "runtimes": ["nodejs8.10"], | ||
| "dependency_manager": "npm", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"), | ||
| "build": True | ||
| }, | ||
| { | ||
| "runtimes": ["nodejs6.10"], | ||
| "dependency_manager": "npm", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs6"), | ||
| "build": True | ||
| }, | ||
| ], | ||
| "dotnet": [ | ||
| { | ||
| "runtimes": ["dotnetcore", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1"], | ||
| "dependency_manager": "cli-package", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"), | ||
| "build": False | ||
| }, | ||
| ], | ||
| "go": [ | ||
| { | ||
| "runtimes": ["go1.x"], | ||
| "dependency_manager": None, | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-go"), | ||
| "build": False | ||
| } | ||
| ], | ||
| "java": [ | ||
| { | ||
| "runtimes": ["java8"], | ||
| "dependency_manager": "maven", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-maven"), | ||
| "build": False | ||
| }, | ||
| { | ||
| "runtimes": ["java8"], | ||
| "dependency_manager": "gradle", | ||
| "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-gradle"), | ||
| "build": True | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| SUPPORTED_DEP_MANAGERS = set([c['dependency_manager'] for c in list( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand what this line is doing, but boy there are so many brackets!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Having a single config, makes extraction a bit more dense. |
||
| itertools.chain(*(RUNTIME_DEP_TEMPLATE_MAPPING.values()))) if c['dependency_manager']]) | ||
| RUNTIMES = set(itertools.chain(*[c['runtimes'] for c in list( | ||
| itertools.chain(*(RUNTIME_DEP_TEMPLATE_MAPPING.values())))])) | ||
| INIT_RUNTIMES = RUNTIMES.union(RUNTIME_DEP_TEMPLATE_MAPPING.keys()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
...r-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/HelloWorldFunction/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| plugins { | ||
| id 'java' | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation 'software.amazon.awssdk:annotations:2.1.0' | ||
| compile ( | ||
| 'com.amazonaws:aws-lambda-java-core:1.1.0' | ||
| ) | ||
| testCompile 'junit:junit:4.12' | ||
| } | ||
|
|
||
| sourceSets { | ||
| main { | ||
| java { | ||
| srcDir 'src/main' | ||
| } | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
...{{cookiecutter.project_name}}/HelloWorldFunction/gradle/wrapper/gradle-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not make sense. Why would you depend on the build workflow configs within init. They should be treated as isolated modules. Otherwise you will end up with a tangled mess of dependencies one year from now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfuss filled me in on the intention of this mapping. The config here makes sense (as a true configuration data), but I am not excited about importing workflow_config which is an implementation detail. Can we just remove the workflow configs because they are not really used? That would make me more happy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove that. 👍