-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use absolute paths to de-dupe model sources
We previously used Paths to de-dupe model sources in the ModelAssembler, but weren't using absolute paths to normalize paths before de-duping. This caused issues when smithy-build.json files defined imports or sources and sources were provided to the Smithy CLI as positional arguments. We now normalize files provided to the model assembler using toAbsolutePath to ensure that relative and absolute paths are de-duped. Further, this commit adds the same treatment to SmithyBuild sources. This isn't needed to de-dupe for the assembler, but rather to de-dupe files when generating the sources plugin. Without this, the sources plugin would fail due to conflicting files that look different because one might be absolute and another might be relative, but are the same. Integration test cases were added to the Smithy CLI to test this because it does not appear reliable to change the current working directory.
- Loading branch information
Showing
5 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
14 changes: 13 additions & 1 deletion
14
.../it/resources/software/amazon/smithy/cli/projects/simple-config-sources/model/main.smithy
This file contains 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 |
---|---|---|
@@ -1,4 +1,16 @@ | ||
$version: "2.0" | ||
// Use a 1.0 model to use an enum trait without a warning. | ||
$version: "1.0" | ||
namespace smithy.example | ||
|
||
// This is used for assertions around de-duping files because duplicate enum values would fail validation. | ||
@enum([ | ||
{ | ||
value: "FOO", | ||
name: "FOO" | ||
}, | ||
{ | ||
value: "BAR", | ||
name: "BAR" | ||
} | ||
]) | ||
string MyString |
This file contains 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