Skip to content

fix(build): Disallow --build-dir to resolve to cwd#1403

Merged
sanathkr merged 4 commits intoaws:developfrom
jfuss:fix/1157
Sep 13, 2019
Merged

fix(build): Disallow --build-dir to resolve to cwd#1403
sanathkr merged 4 commits intoaws:developfrom
jfuss:fix/1157

Conversation

@jfuss
Copy link
Contributor

@jfuss jfuss commented Sep 12, 2019

Issue #, if available:
#1157

Description of changes:

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

default=DEFAULT_BUILD_DIR,
type=click.Path(file_okay=False, dir_okay=True, writable=True), # Must be a directory
help="Path to a folder where the built artifacts will be stored")
help="Path to a folder where the built artifacts will be stored. If a clean build, this directory will be first removed.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always do a clean build. So the 'if' shouldn't be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording was future looking. I can remove. Do we even mention clean build is all we support anywhere today?

build_path = pathlib.Path(build_dir)

if os.path.abspath(str(build_path)) == os.path.abspath(str(pathlib.Path.cwd())):
exception_message = "'build-dir' should not be the current workding directoy as the directory " \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we instead skip the "clean" if build-dir == cwd? It could give to a more intuitive experience

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I completely understand. My current understanding of the question is:

"Instead of always doing a "clean" build, we would not do a clean build if build-dir == cwd"?

If that is a fair rewording, then I don't think we should go down this route. Having a conditional do clean or not base upon a parameter that does not relate to a 'clean build' is not intuitive at all. This will make supporting clean builds more difficult in the future.

@sanathkr sanathkr merged commit 37d0e39 into aws:develop Sep 13, 2019
@jfuss jfuss deleted the fix/1157 branch September 13, 2019 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants