Support for gradle builder for Java#1007
Conversation
| pathlib2~=2.3.2; python_version<"3.4" | ||
| requests==2.20.1 | ||
| aws_lambda_builders==0.0.5 | ||
| aws_lambda_builders==0.1.0 |
|
Don't forget the java8 init templates will need updating from maven to gradle |
It doesn't make sense. We will let the init templates use maven and eventually provide a maven builder. Yes, meanwhile sam init && sam build won't work, but that's a short term problem |
|
@sanathkr we need to change https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/lib/build/app_builder.py#L206 to include |
- Also support choosing a gradle workflow by the presence of build.gradle file
samcli/commands/build/command.py
Outdated
| 1. Python 2.7, 3.6, 3.7\n | ||
| 4. Nodejs 8.10, 6.10 | ||
| 4. Ruby 2.5 | ||
| 5. Java 8 |
There was a problem hiding this comment.
Do we need to call out which Dependency Managers we support?
There was a problem hiding this comment.
Hmm, yeah good idea. Will do
samcli/lib/build/app_builder.py
Outdated
| def _build_function(self, function_name, codeuri, runtime): | ||
| config = get_workflow_config(runtime) | ||
|
|
||
| # Create the arguments to pass to the builder |
There was a problem hiding this comment.
This comment is floating. This seems like docstring worthy
|
|
||
| class BasicWorkflowSelector(object): | ||
| """ | ||
| Basic workflow selector that returns the first available configuration in the given list of configurations |
There was a problem hiding this comment.
Is this going to be extended in the future? what is the value of this class, if its just returns the first one?
There was a problem hiding this comment.
For inheritance.. I didn't create an abstract base class because it didn't seem helpful. But in future we will create a new subclass that will look up Samrc to find the workflow config to use given a runtime. This can be useful for provided runtimes or if customer wants to override a default configuration
| runtime, | ||
| optimizations, | ||
| options): | ||
| options, |
There was a problem hiding this comment.
Just making sure, the protocol version is passed in by importing the builders library right?
| process = subprocess.Popen(cmdlist, cwd=self.working_dir) | ||
| process.wait() | ||
|
|
||
| self._verify_built_artifact(self.default_build_dir, self.FUNCTION_LOGICAL_ID, |
There was a problem hiding this comment.
Can we look at built artifacts verify if we used gradle or gradlew?
There was a problem hiding this comment.
Ah good point. I don't know. I will check with Dongie
| try: | ||
| return workflow_config_by_runtime[runtime] | ||
| except KeyError: | ||
| if runtime not in selectors_by_runtime: |
There was a problem hiding this comment.
It's much cleaner if you do
try:
selector = selectors_by_runtime[runtime]
config = selector.get_config(code_dir, project_dir)
except KeyError:
#blah
except ValueError:
#another blah
Also more pythonic :)
There was a problem hiding this comment.
Not really. try/catch blocks should be scoped very tightly to the code you expect to throw. So when you know two statemtents will throw for two different reasons, I would rather have them in separte try blocks or let them throw very specific exceptions - not KeyError & ValueError. That's why I made this way.
|
|
||
| @staticmethod | ||
| def _has_manifest(config, directory): | ||
| return os.path.exists(os.path.join(directory, config.manifest_name)) |
There was a problem hiding this comment.
One day you will use pathlib.. one day..
There was a problem hiding this comment.
when we move to py3. Pathlib in py2 is really confusing
| If none of the supported manifests files are found | ||
| """ | ||
|
|
||
| # Search for manifest first in code directory and then in the project directory. |
There was a problem hiding this comment.
How this works and is resolved needs to be clearly documented (somewhere)
There was a problem hiding this comment.
I will add to the help text for now
|
I dont have any other concerns, will be nice if can determine which executable was used to build in the built artifacts. But I'm not blocking on that. will approve once build passes. |
Issue #, if available:
#880
Description of changes:
This won't build until we release aws-lambda-builders library. But sending the WIP PR to get early feedback.
Checklist:
make prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.