Skip to content

Commit e78b263

Browse files
authored
chore: update to use new smithy gradle plugins (#1203)
Update to use new smithy gradle plugins
1 parent 38f9a61 commit e78b263

File tree

8 files changed

+45
-80
lines changed

8 files changed

+45
-80
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Then, add the `smithy-typescript-codegen` dependency in `build.gradle.kts`:
127127
```kotlin
128128
plugins {
129129
id("java-library")
130-
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
130+
id("software.amazon.smithy.gradle.smithy-jar").version("0.10.1")
131131
}
132132

133133
repositories {

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
smithyVersion=1.45.0
2-
smithyGradleVersion=0.6.0
2+
smithyGradleVersion=0.10.1

settings.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ file(
3838
}
3939

4040
pluginManagement {
41+
val smithyGradleVersion: String by settings
42+
plugins {
43+
id("software.amazon.smithy.gradle.smithy-jar").version(smithyGradleVersion)
44+
id("software.amazon.smithy.gradle.smithy-base").version(smithyGradleVersion)
45+
}
46+
4147
repositories {
4248
mavenLocal()
4349
mavenCentral()

smithy-typescript-codegen-test/build.gradle.kts

+9-18
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@
1616
extra["displayName"] = "Smithy :: Typescript :: Codegen :: Test"
1717
extra["moduleName"] = "software.amazon.smithy.typescript.codegen.test"
1818

19-
val smithyVersion: String by project
20-
21-
buildscript {
22-
val smithyVersion: String by project
23-
24-
repositories {
25-
mavenCentral()
26-
}
27-
dependencies {
28-
"classpath"("software.amazon.smithy:smithy-cli:$smithyVersion")
29-
}
30-
}
3119

3220
plugins {
33-
val smithyGradleVersion: String by project
34-
35-
id("software.amazon.smithy").version(smithyGradleVersion)
21+
`java-library`
22+
id("software.amazon.smithy.gradle.smithy-jar")
3623
}
3724

3825
repositories {
@@ -41,9 +28,13 @@ repositories {
4128
}
4229

4330
dependencies {
44-
implementation(project(":smithy-typescript-codegen"))
45-
implementation(project(":smithy-typescript-codegen-test:example-weather-customizations"))
46-
implementation(project(":smithy-typescript-ssdk-codegen-test-utils"))
31+
val smithyVersion: String by project
32+
33+
// Put plugins and integrations on the smithy build classpath
34+
smithyBuild(project(":smithy-typescript-codegen"))
35+
smithyBuild(project(":smithy-typescript-codegen-test:example-weather-customizations"))
36+
smithyBuild(project(":smithy-typescript-ssdk-codegen-test-utils"))
37+
4738
implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion")
4839
implementation("software.amazon.smithy:smithy-waiters:$smithyVersion")
4940
implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion")

smithy-typescript-codegen-test/example-weather-customizations/build.gradle.kts

-14
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
val smithyVersion: String by project
7-
8-
buildscript {
9-
val smithyVersion: String by project
10-
11-
repositories {
12-
mavenLocal()
13-
mavenCentral()
14-
}
15-
dependencies {
16-
"classpath"("software.amazon.smithy:smithy-cli:$smithyVersion")
17-
}
18-
}
19-
206
plugins {
217
`java-library`
228
}

smithy-typescript-codegen-test/released-version-test/build.gradle.kts

+15-20
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,28 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
tasks["jar"].enabled = false
7-
8-
val smithyVersion: String by project
9-
val version: String by project
10-
11-
buildscript {
12-
val smithyVersion: String by project
13-
14-
repositories {
15-
mavenCentral()
16-
}
17-
dependencies {
18-
"classpath"("software.amazon.smithy:smithy-cli:$smithyVersion")
19-
}
20-
}
21-
226
plugins {
23-
id("software.amazon.smithy")
7+
java
8+
id("software.amazon.smithy.gradle.smithy-base")
249
}
2510

2611
repositories {
2712
mavenCentral()
2813
}
2914

3015
dependencies {
31-
implementation("software.amazon.smithy.typescript:smithy-typescript-codegen:$version!!")
32-
implementation("software.amazon.smithy.typescript:smithy-aws-typescript-codegen:$version!!")
16+
val smithyVersion: String by project
17+
val version: String by project
18+
19+
smithyBuild("software.amazon.smithy.typescript:smithy-typescript-codegen:$version!!")
20+
smithyBuild("software.amazon.smithy.typescript:smithy-aws-typescript-codegen:$version!!")
21+
smithyBuild(project(":smithy-typescript-codegen-test:example-weather-customizations"))
22+
23+
// Explicitly configure for CLI version
24+
smithyBuild("software.amazon.smithy:smithy-model:$smithyVersion")
25+
26+
// Includes example model so must be runtime dependency
3327
implementation(project(":smithy-typescript-codegen-test"))
34-
implementation(project(":smithy-typescript-codegen-test:example-weather-customizations"))
3528
}
29+
30+
tasks["jar"].enabled = false

smithy-typescript-codegen/build.gradle.kts

+12-8
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ buildscript {
2727
repositories {
2828
mavenCentral()
2929
}
30+
3031
dependencies {
31-
"classpath"("software.amazon.smithy:smithy-cli:$smithyVersion")
32+
classpath("software.amazon.smithy:smithy-model:$smithyVersion")
3233
}
3334
}
3435

3536
dependencies {
37+
val smithyVersion: String by project
38+
3639
api("software.amazon.smithy:smithy-codegen-core:$smithyVersion")
3740
api("software.amazon.smithy:smithy-model:$smithyVersion")
3841
api("software.amazon.smithy:smithy-rules-engine:$smithyVersion")
3942
api("software.amazon.smithy:smithy-waiters:$smithyVersion")
43+
4044
implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion")
4145
}
4246

@@ -51,16 +55,16 @@ sourceSets {
5155
tasks.register("set-dependency-versions") {
5256
doLast {
5357
mkdir("$buildDir/generated/resources/software/amazon/smithy/typescript/codegen")
54-
var versionsFile =
58+
val versionsFile =
5559
file("$buildDir/generated/resources/software/amazon/smithy/typescript/codegen/dependencyVersions.properties")
56-
var roots = project.file("../packages").listFiles().toMutableList() + project.file("../smithy-typescript-ssdk-libs").listFiles().toList()
60+
val roots = project.file("../packages").listFiles().toMutableList() + project.file("../smithy-typescript-ssdk-libs").listFiles().toList()
5761
roots.forEach { packageDir ->
58-
var packageJsonFile = File(packageDir, "package.json")
62+
val packageJsonFile = File(packageDir, "package.json")
5963
if (packageJsonFile.isFile()) {
60-
var packageJson = Node.parse(packageJsonFile.readText()).expectObjectNode()
61-
var packageName = packageJson.expectStringMember("name").getValue()
62-
var packageVersion = packageJson.expectStringMember("version").getValue()
63-
var isPrivate = packageJson.getBooleanMemberOrDefault("private", false)
64+
val packageJson = Node.parse(packageJsonFile.readText()).expectObjectNode()
65+
val packageName = packageJson.expectStringMember("name").getValue()
66+
val packageVersion = packageJson.expectStringMember("version").getValue()
67+
val isPrivate = packageJson.getBooleanMemberOrDefault("private", false)
6468
if (!isPrivate) {
6569
versionsFile.appendText("$packageName=$packageVersion\n")
6670
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
extra["displayName"] = "Smithy :: Typescript :: SSDK :: Codegen :: Test :: Utils"
22
extra["moduleName"] = "software.amazon.smithy.typescript.ssdk.codegen.test.utils"
33

4-
val smithyVersion: String by project
5-
6-
buildscript {
7-
val smithyVersion: String by project
8-
9-
repositories {
10-
mavenLocal()
11-
mavenCentral()
12-
}
13-
dependencies {
14-
"classpath"("software.amazon.smithy:smithy-cli:$smithyVersion")
15-
}
16-
}
17-
184
plugins {
19-
val smithyGradleVersion: String by project
20-
21-
id("software.amazon.smithy").version(smithyGradleVersion)
5+
`java-library`
226
}
237

248
repositories {
@@ -28,5 +12,4 @@ repositories {
2812

2913
dependencies {
3014
implementation(project(":smithy-typescript-codegen"))
31-
implementation("software.amazon.smithy:smithy-model:$smithyVersion")
3215
}

0 commit comments

Comments
 (0)