-
Notifications
You must be signed in to change notification settings - Fork 241
Add generic depdency graph implementation to smithy-utils and use it for handling topological sorting #2774
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bd10704
Add a generic dependency graph to smithy-utils
JordonPhillips dd7703d
Use DependencyGraph in integration sorting
JordonPhillips 9d73b06
Add ordering to SmithyBuildPlugin
JordonPhillips bee5d3c
Throw CycleException when cycles are detected
JordonPhillips 8c1f88c
Use DependencyGraph in LoaderShapeMap
JordonPhillips 72d939a
Update ReplaceShapes to use DependencyGraph
JordonPhillips ee03b7d
Deprecate TopologicalShapeSort
JordonPhillips 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.changes/next-release/feature-5918b18d6bad7f0ad2c8061f9910f70dccadce2c.json
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,7 @@ | ||
| { | ||
| "type": "feature", | ||
| "description": "Updated `LoaderShapeMap` to use `DependencyGraph` to sort shapes\ninstead of `TopologicalShapeSort`. This results in some error messages\nchanging:\n\n* There is no longer a special message for missing transitive mixins.\n* The message for genrically missing mixins is now applied by\n ApplyMixin, which has a slightly different wording and which will\n trigger for each mising mixin.\n* The error message for detected cycles will now include the entire\n cycle that a shape is part of, rather than just the edges that it\n is directly connected to.", | ||
| "pull_requests": [ | ||
| "[#2774](https://github.com/smithy-lang/smithy/pull/2774)" | ||
| ] | ||
| } |
7 changes: 7 additions & 0 deletions
7
.changes/next-release/feature-9d99ada83fb4eaabb1f0d929c0da87d73134dd3e.json
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,7 @@ | ||
| { | ||
| "type": "feature", | ||
| "description": "Add the ability for smithy build plugins to declare that they must be run before or after other plugins. These dependencies are soft, so missing dependencies will be logged and ignored.", | ||
| "pull_requests": [ | ||
| "[#2774](https://github.com/smithy-lang/smithy/pull/2774)" | ||
| ] | ||
| } |
7 changes: 7 additions & 0 deletions
7
.changes/next-release/feature-ca86aa5a954b100820845d1b67a3491c40b8058c.json
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,7 @@ | ||
| { | ||
| "type": "feature", | ||
| "description": "Updated `ReplaceShapes` to use `DependencyGraph` to sort shapes.", | ||
| "pull_requests": [ | ||
| "[#2774](https://github.com/smithy-lang/smithy/pull/2774)" | ||
| ] | ||
| } |
7 changes: 7 additions & 0 deletions
7
.changes/next-release/feature-d368237cdeb1655c7c10969e36c6aa3ca3b3034a.json
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,7 @@ | ||
| { | ||
| "type": "feature", | ||
| "description": "Add a generic dependency graph to smithy-utils to be used for sorting various dependent objects, such as integrations and plugins.", | ||
| "pull_requests": [ | ||
| "[#2774](https://github.com/smithy-lang/smithy/pull/2774)" | ||
| ] | ||
| } |
7 changes: 7 additions & 0 deletions
7
.changes/next-release/feature-e0f8e99e0b8a04946095a8711bd3e921405d9a53.json
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,7 @@ | ||
| { | ||
| "type": "feature", | ||
| "description": "Deprecated `TopologicalShapeSort` in favor of `DependencyGraph`.", | ||
| "pull_requests": [ | ||
| "[#2774](https://github.com/smithy-lang/smithy/pull/2774)" | ||
| ] | ||
| } |
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
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
23 changes: 23 additions & 0 deletions
23
smithy-build/src/test/java/software/amazon/smithy/build/CyclicPlugin1.java
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 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package software.amazon.smithy.build; | ||
|
|
||
| import java.util.List; | ||
| import software.amazon.smithy.utils.ListUtils; | ||
|
|
||
| public class CyclicPlugin1 implements SmithyBuildPlugin { | ||
| @Override | ||
| public String getName() { | ||
| return "cyclicplugin1"; | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(PluginContext context) {} | ||
|
|
||
| @Override | ||
| public List<String> runBefore() { | ||
| return ListUtils.of("cyclicplugin2"); | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
smithy-build/src/test/java/software/amazon/smithy/build/CyclicPlugin2.java
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 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package software.amazon.smithy.build; | ||
|
|
||
| import java.util.List; | ||
| import software.amazon.smithy.utils.ListUtils; | ||
|
|
||
| public class CyclicPlugin2 implements SmithyBuildPlugin { | ||
| @Override | ||
| public String getName() { | ||
| return "cyclicplugin2"; | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(PluginContext context) {} | ||
|
|
||
| @Override | ||
| public List<String> runBefore() { | ||
| return ListUtils.of("cyclicplugin1"); | ||
| } | ||
| } |
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
30 changes: 30 additions & 0 deletions
30
smithy-build/src/test/java/software/amazon/smithy/build/TimestampPlugin1.java
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,30 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package software.amazon.smithy.build; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| public class TimestampPlugin1 implements SmithyBuildPlugin { | ||
| @Override | ||
| public String getName() { | ||
| return "timestampPlugin1"; | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(PluginContext context) { | ||
| context.getFileManifest().writeFile("timestamp", String.valueOf(Instant.now().toEpochMilli())); | ||
| try { | ||
| Thread.sleep(1); | ||
| } catch (InterruptedException ignored) {} | ||
| } | ||
|
|
||
| // This is made serial to protect against test failures if we decide later to | ||
| // have plugins run in parallel. These plugins MUST run serially with respect | ||
| // to each other to function. | ||
| @Override | ||
| public boolean isSerial() { | ||
| return true; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.