-
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.
Add exception on implicit empty config (#123)
Add exception on implicit empty config and require that an empty list be provided in order for an implicit smithy-build.json to be used.
- Loading branch information
Showing
9 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
examples/base-plugin/failure-cases/forbid-implicit-no-build-config/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,13 @@ | ||
plugins { | ||
`java-library` | ||
id("software.amazon.smithy.gradle.smithy-base").version("0.10.0") | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("software.amazon.smithy:smithy-aws-traits:[1.0, 2.0[") | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/base-plugin/failure-cases/forbid-implicit-no-build-config/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,9 @@ | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
foo: String | ||
} | ||
|
||
@aws.auth#unsignedPayload | ||
operation Bar { | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/base-plugin/failure-cases/forbid-implicit-no-build-config/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,8 @@ | ||
rootProject.name = "forbid-dependency-resolution" | ||
|
||
pluginManagement { | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"version": "1.0" | ||
} |
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" | ||
} |
24 changes: 24 additions & 0 deletions
24
smithy-base/src/it/java/software/amazon/smithy/gradle/ForbidImplicitNoBuildConfigTest.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,24 @@ | ||
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 ForbidImplicitNoBuildConfigTest { | ||
@Test | ||
public void testExceptionThrows() { | ||
Utils.withCopy("base-plugin/failure-cases/forbid-implicit-no-build-config", buildDir -> { | ||
BuildResult result = GradleRunner.create() | ||
.forwardOutput() | ||
.withProjectDir(buildDir) | ||
.withArguments("clean", "build", "--stacktrace") | ||
.buildAndFail(); | ||
|
||
Assertions.assertTrue(result.getOutput() | ||
.contains("No smithy-build configs found. If this was intentional, set the `smithyBuildConfigs` property to an empty list.")); | ||
Utils.assertArtifactsNotCreated(buildDir, | ||
"build/smithyprojections/forbid-implicit-no-build-config/source/build-info/smithy-build-info.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
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