Skip to content
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

chore: Update to Gradle 8 #1829

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ tasks.register<JavaExec>("ktlint") {
description = "Check Kotlin code style."
group = "Verification"
classpath = configurations.getByName("ktlint")
main = "com.pinterest.ktlint.Main"
mainClass = "com.pinterest.ktlint.Main"
args = lintPaths
}

tasks.register<JavaExec>("ktlintFormat") {
description = "Auto fix Kotlin code style violations"
group = "formatting"
classpath = configurations.getByName("ktlint")
main = "com.pinterest.ktlint.Main"
mainClass = "com.pinterest.ktlint.Main"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle 8 changes the name of this property

args = listOf("-F") + lintPaths
}
44 changes: 24 additions & 20 deletions codegen/protocol-test-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@
* SPDX-License-Identifier: Apache-2.0.
*/
import software.amazon.smithy.gradle.tasks.ProtocolTestTask
import software.amazon.smithy.gradle.tasks.SmithyBuild

plugins {
id("software.amazon.smithy") version "0.5.3"
`java`
id("software.amazon.smithy.gradle.smithy-jar") version "1.2.0"
}

description = "Smithy protocol test suite"

val smithyVersion: String by project
buildscript {
val smithyVersion: String by project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}
//buildscript {
// val smithyVersion: String by project
// dependencies {
// classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
// }
//}

dependencies {
implementation("software.amazon.smithy:smithy-aws-protocol-tests:$smithyVersion")
implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
implementation(project(":smithy-aws-swift-codegen"))
implementation("software.amazon.smithy:smithy-protocol-tests:$smithyVersion")
smithyBuild("software.amazon.smithy:smithy-cli:$smithyVersion")
}

val enabledProtocols = listOf(
Expand All @@ -45,11 +46,11 @@ val enabledProtocols = listOf(
)

// This project doesn't produce a JAR.
tasks["jar"].enabled = false
// tasks["jar"].enabled = false

// Run the SmithyBuild task manually since this project needs the built JAR
// from smithy-aws-swift-codegen.
tasks["smithyBuildJar"].enabled = false
tasks["smithyBuild"].enabled = false

task("generateSmithyBuild") {
group = "codegen"
Expand All @@ -65,17 +66,17 @@ tasks["clean"].doFirst {
delete("smithy-build.json")
}

tasks.create<SmithyBuild>("buildSdk") {
addRuntimeClasspath = true
dependsOn(tasks["generateSmithyBuild"])
inputs.file(projectDir.resolve("smithy-build.json"))
}
//tasks.create("buildSdk") {
// // addRuntimeClasspath = true
// dependsOn("generateSmithyBuild")
// inputs.file(projectDir.resolve("smithy-build.json"))
//}

// Run the `buildSdk` automatically.
tasks["build"].finalizedBy(tasks["buildSdk"])
// tasks["build"].finalizedBy(tasks["buildSdk"])

// force rebuild every time while developing
tasks["buildSdk"].outputs.upToDateWhen { false }
// tasks["buildSdk"].outputs.upToDateWhen { false }

enabledProtocols.forEach {
tasks.register<ProtocolTestTask>("testProtocol-${it.projectionName}") {
Expand All @@ -87,12 +88,15 @@ enabledProtocols.forEach {
}


data class ProtocolTest(val projectionName: String,
val serviceShapeId: String,
val moduleName: String) {
data class ProtocolTest(
val projectionName: String,
val serviceShapeId: String,
val moduleName: String
) {
val packageName: String
get() = projectionName.toLowerCase().filter { it.isLetterOrDigit() }
}

fun generateSmithyBuild(tests: List<ProtocolTest>): String {
val projections = tests.joinToString(",") { test ->
"""
Expand Down
9 changes: 5 additions & 4 deletions codegen/smithy-aws-swift-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ tasks.test {

// Configure jacoco (code coverage) to generate an HTML report
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.isEnabled = false
csv.isEnabled = false
html.destination = file("$buildDir/reports/jacoco")
xml.required.set(false)
csv.required.set(false)
html.outputLocation.set(file("$buildDir/reports/jacoco"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test report config updated & taken from smithy project

}
}

// Always run the jacoco test report after testing.
tasks["test"].finalizedBy(tasks["jacocoTestReport"])
tasks["test"].finalizedBy(tasks.jacocoTestReport)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx4096M

# codegen
smithyVersion=1.53.0
smithyGradleVersion=0.6.0
smithyGradleVersion=1.2.0

smithySwiftVersion = 0.1.0

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autogenerated change

zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading