-
Notifications
You must be signed in to change notification settings - Fork 146
refactor: assign each workflow a default build directory #428
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
Changes from all commits
5084944
b425e38
aa22e89
879d7d6
6f73545
a5902a0
7132cb6
80266dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
ProvidedMakeWorkflow | ||
""" | ||
from aws_lambda_builders.workflows.custom_make.validator import CustomMakeRuntimeValidator | ||
from aws_lambda_builders.workflow import BaseWorkflow, Capability, BuildInSourceSupport | ||
from aws_lambda_builders.workflow import BaseWorkflow, Capability, BuildInSourceSupport, BuildDirectory | ||
from aws_lambda_builders.actions import CopySourceAction | ||
from aws_lambda_builders.path_resolver import PathResolver | ||
from .actions import CustomMakeAction | ||
|
@@ -23,7 +23,7 @@ class CustomMakeWorkflow(BaseWorkflow): | |
|
||
EXCLUDED_FILES = (".aws-sam", ".git") | ||
|
||
BUILD_IN_SOURCE_BY_DEFAULT = False | ||
DEFAULT_BUILD_DIR = BuildDirectory.SCRATCH | ||
BUILD_IN_SOURCE_SUPPORT = BuildInSourceSupport.OPTIONALLY_SUPPORTED | ||
|
||
def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtime=None, osutils=None, **kwargs): | ||
|
@@ -35,7 +35,6 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim | |
self.os_utils = OSUtils() | ||
|
||
options = kwargs.get("options") or {} | ||
build_in_source = kwargs.get("build_in_source") | ||
|
||
build_logical_id = options.get("build_logical_id", None) | ||
if not build_logical_id: | ||
|
@@ -47,10 +46,8 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim | |
|
||
subprocess_make = SubProcessMake(make_exe=self.binaries["make"].binary_path, osutils=self.os_utils) | ||
|
||
# an explicitly definied working directory should take precedence | ||
working_directory = options.get("working_directory") or self._select_working_directory( | ||
source_dir, scratch_dir, build_in_source | ||
) | ||
# an explicitly defined working directory should take precedence | ||
working_directory = options.get("working_directory") or self.build_dir | ||
|
||
make_action = CustomMakeAction( | ||
artifacts_dir, | ||
|
@@ -63,18 +60,12 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim | |
|
||
self.actions = [] | ||
|
||
if not self.build_in_source: | ||
# if we're building on scratch_dir, we have to first copy the source there | ||
self.actions.append(CopySourceAction(source_dir, scratch_dir, excludes=self.EXCLUDED_FILES)) | ||
if self.build_dir != source_dir: | ||
# if we're not building in the source directory, we have to first copy the source | ||
self.actions.append(CopySourceAction(source_dir, self.build_dir, excludes=self.EXCLUDED_FILES)) | ||
|
||
self.actions.append(make_action) | ||
|
||
def _select_working_directory(self, source_dir: str, scratch_dir: str, build_in_source: bool): | ||
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. Due to the changes in this PR, we can remove the logic of choosing a working/build directory based on the |
||
""" | ||
Returns the directory where the make action should be executed | ||
""" | ||
return source_dir if build_in_source else scratch_dir | ||
|
||
def get_resolvers(self): | ||
return [PathResolver(runtime="provided", binary="make", executable_search_paths=self.executable_search_paths)] | ||
|
||
|
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.
just moved these up, didn't add these