-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users access to smithyCli configuration so they can explicitly …
…set cli version
- Loading branch information
Showing
11 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
examples/base-plugin/uses-explicitly-set-cli-version/README.md
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Example Project - Build Script Dependency | ||
|
||
This is an example Gradle Smithy project. In addition to serving as documentation, | ||
this project is run as an integration test for the plugin. | ||
|
||
This example demonstrates using the version of Smithy found in the build script | ||
dependencies to build the project. | ||
|
||
## Using the example as a starting point | ||
|
||
Since this sample is run as an integration test, by default it is only configured | ||
to use a locally published version of the plugin. To use this as a starting point | ||
for your own project, uncomment the lines in `settings.gradle.kts` that configure | ||
Gradle to use public sources. |
16 changes: 16 additions & 0 deletions
16
examples/base-plugin/uses-explicitly-set-cli-version/build.gradle.kts
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This example is an integration test to ensure that the smithy-cli version can be | ||
// found by scanning buildScript dependencies. | ||
|
||
plugins { | ||
id("java-library") | ||
id("software.amazon.smithy.gradle.smithy-base").version("0.10.1") | ||
} | ||
|
||
dependencies { | ||
smithyCli("software.amazon.smithy:smithy-cli:1.45.0") | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} |
5 changes: 5 additions & 0 deletions
5
examples/base-plugin/uses-explicitly-set-cli-version/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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
bar: String | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/base-plugin/uses-explicitly-set-cli-version/settings.gradle.kts
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
rootProject.name = "scans-for-cli-version" | ||
|
||
pluginManagement { | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
// Uncomment these to use the published version of the plugin from your preferred source. | ||
// gradlePluginPortal() | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/base-plugin/uses-explicitly-set-cli-version/smithy-build.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"version": "1.0" | ||
} |
23 changes: 23 additions & 0 deletions
23
smithy-base/src/it/java/software/amazon/smithy/gradle/UsesExplicitlySetCLIVersionTest.java
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package software.amazon.smithy.gradle; | ||
|
||
import org.gradle.testkit.runner.BuildResult; | ||
import org.gradle.testkit.runner.GradleRunner; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class UsesExplicitlySetCLIVersionTest { | ||
@Test | ||
public void usesExplicitCliVersion() { | ||
Utils.withCopy("base-plugin/uses-explicitly-set-cli-version", buildDir -> { | ||
BuildResult result = GradleRunner.create() | ||
.forwardOutput() | ||
.withProjectDir(buildDir) | ||
.withArguments("clean", "build", "-i", "--stacktrace") | ||
.build(); | ||
|
||
Utils.assertSmithyBuildTaskRan(result); | ||
Utils.assertValidationRan(result); | ||
Assertions.assertTrue(result.getOutput().contains("(using explicitly configured Smithy CLI)")); | ||
}); | ||
} | ||
} |
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
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