From 34d5d5d9a398dd812af3ff2dc8aea2fae1c317ad Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Fri, 21 Aug 2020 23:43:03 -0700 Subject: [PATCH] Move from Kotlin to Groovy for Gradle Unfortunately, Kotlin isn't well-supported in VS Code, and we're looking at adding VS plugins to Smithy in the future. We've also found that the majority of Gradle plugins only provide Groovy examples, making it harder to write out build scripts due to a lack of Kotlin examples. With IDE plugins and a quicker compile/test feedback loop, the loss in type safety realized by Kotlin isn't as bad as I thought it would be. --- .gitignore | 3 + build.gradle | 248 +++++++++++++++ build.gradle.kts | 285 ------------------ settings.gradle | 24 ++ settings.gradle.kts | 24 -- .../{build.gradle.kts => build.gradle} | 11 +- .../{build.gradle.kts => build.gradle} | 9 +- .../{build.gradle.kts => build.gradle} | 9 +- .../{build.gradle.kts => build.gradle} | 17 +- .../{build.gradle.kts => build.gradle} | 9 +- .../{build.gradle.kts => build.gradle} | 11 +- smithy-cli/{build.gradle.kts => build.gradle} | 25 +- .../{build.gradle.kts => build.gradle} | 13 +- .../{build.gradle.kts => build.gradle} | 11 +- .../{build.gradle.kts => build.gradle} | 11 +- .../{build.gradle.kts => build.gradle} | 11 +- .../{build.gradle.kts => build.gradle} | 15 +- .../smithy/model/loader/AstModelLoader.java | 1 + .../{build.gradle.kts => build.gradle} | 11 +- .../{build.gradle.kts => build.gradle} | 15 +- .../{build.gradle.kts => build.gradle} | 9 +- .../{build.gradle.kts => build.gradle} | 7 +- 22 files changed, 397 insertions(+), 382 deletions(-) create mode 100644 build.gradle delete mode 100644 build.gradle.kts create mode 100644 settings.gradle delete mode 100644 settings.gradle.kts rename smithy-aws-apigateway-openapi/{build.gradle.kts => build.gradle} (76%) rename smithy-aws-apigateway-traits/{build.gradle.kts => build.gradle} (80%) rename smithy-aws-iam-traits/{build.gradle.kts => build.gradle} (81%) rename smithy-aws-protocol-tests/{build.gradle.kts => build.gradle} (68%) rename smithy-aws-traits/{build.gradle.kts => build.gradle} (83%) rename smithy-build/{build.gradle.kts => build.gradle} (82%) rename smithy-cli/{build.gradle.kts => build.gradle} (69%) rename smithy-codegen-core/{build.gradle.kts => build.gradle} (77%) rename smithy-diff/{build.gradle.kts => build.gradle} (82%) rename smithy-jsonschema/{build.gradle.kts => build.gradle} (78%) rename smithy-linters/{build.gradle.kts => build.gradle} (81%) rename smithy-model/{build.gradle.kts => build.gradle} (75%) rename smithy-mqtt-traits/{build.gradle.kts => build.gradle} (79%) rename smithy-openapi/{build.gradle.kts => build.gradle} (72%) rename smithy-protocol-test-traits/{build.gradle.kts => build.gradle} (80%) rename smithy-utils/{build.gradle.kts => build.gradle} (87%) diff --git a/.gitignore b/.gitignore index 0c328f61cea..cb63395e03b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,9 @@ docs/src *.iml *.iws +# VSCode +bin/ + # Mac .DS_Store diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000000..a29e92a14a1 --- /dev/null +++ b/build.gradle @@ -0,0 +1,248 @@ +/* + * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import java.util.stream.Collectors + +plugins { + id "java-library" + id "maven-publish" + id "signing" + id "checkstyle" + id "jacoco" + id "com.github.spotbugs" version "1.6.10" + id "io.codearte.nexus-staging" version "0.21.0" + id "me.champeau.gradle.jmh" version "0.4.6" +} + +ext { + // Load the Smithy version from VERSION. + libraryVersion = project.file("VERSION").getText('UTF-8').replace("\n", "") +} + +println "Smithy version: '${libraryVersion}'" + +allprojects { + group = "software.amazon.smithy" + version = libraryVersion +} + +subprojects { + apply plugin: "java-library" + + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + repositories { + mavenLocal() + mavenCentral() + } + + dependencies { + testCompile "org.junit.jupiter:junit-jupiter-api:5.4.0" + testRuntime "org.junit.jupiter:junit-jupiter-engine:5.4.0" + testCompile "org.junit.jupiter:junit-jupiter-params:5.4.0" + testCompile "org.hamcrest:hamcrest:2.1" + } + + // Reusable license copySpec for building JARs + def licenseSpec = copySpec { + from "${project.rootDir}/LICENSE" + from "${project.rootDir}/NOTICE" + } + + // Set up tasks that build source and javadoc jars. + task sourcesJar(type: Jar) { + metaInf.with(licenseSpec) + from { + sourceSets.main.get().allJava + } + archiveClassifier = "sources" + } + + // Build a javadoc JAR too. + task javadocJar(type: Jar) { + metaInf.with(licenseSpec) + from { + tasks.javadoc + } + archiveClassifier = "javadoc" + } + + // Include an Automatic-Module-Name in all JARs. + afterEvaluate { Project project -> + tasks.jar { + metaInf.with(licenseSpec) + inputs.property("moduleName", project.ext["moduleName"]) + manifest { + attributes "Automatic-Module-Name": project.ext["moduleName"] + } + } + } + + // Always run javadoc after build. + tasks["build"].dependsOn(tasks["javadoc"]) + + // ==== Tests ==== + // https://docs.gradle.org/current/samples/sample_java_multi_project_with_junit5_tests.html + test { + useJUnitPlatform() + } + // Log on passed, skipped, and failed test events if the `-Plog-tests` property is set. + // https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/logging/TestLoggingContainer.html + if (project.hasProperty("log-tests")) { + test { + testLogging { + events = ["passed", "skipped", "failed"] + } + } + } + + // ==== Maven ==== + apply plugin: "maven-publish" + apply plugin: "signing" + + publishing { + repositories { + mavenCentral { + url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/") + if (project.hasProperty("sonatypeUser")) { + credentials { + username = project.property("sonatypeUser") + password = project.property("sonatypePassword") + } + } + } + } + + publications { + mavenJava(MavenPublication) { + from(components["java"]) + + // Ship the source and javadoc jars. + artifact(tasks["sourcesJar"]) + artifact(tasks["javadocJar"]) + + // Include extra information in the POMs. + project.afterEvaluate { + pom { + name.set(project.ext["displayName"].toString()) + description.set(project.description) + url.set("https://github.com/awslabs/smithy") + licenses { + license { + name.set("Apache License 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + developers { + developer { + id.set("smithy") + name.set("Smithy") + organization.set("Amazon Web Services") + organizationUrl.set("https://aws.amazon.com") + roles.add("developer") + } + } + scm { + url.set("https://github.com/awslabs/smithy.git") + } + } + } + } + } + + // Don't sign the artifacts if we didn't get a key and password to use. + if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) { + signing { + useInMemoryPgpKeys( + (String) project.property("signingKey"), + (String) project.property("signingPassword")) + sign(publishing.publications["mavenJava"]) + } + } + } + + // ==== CheckStyle ==== + // https://docs.gradle.org/current/userguide/checkstyle_plugin.html + apply plugin: "checkstyle" + tasks["checkstyleTest"].enabled = false + + // ==== Code coverage ==== + // https://docs.gradle.org/current/userguide/jacoco_plugin.html + apply plugin: "jacoco" + // report is always generated after tests run + test { + finalizedBy jacocoTestReport + } + // tests are required to run before generating the report + jacocoTestReport { + dependsOn test + } + jacocoTestReport { + reports { + xml.enabled false + csv.enabled false + html.destination file("$buildDir/reports/jacoco") + } + } + + // ==== Spotbugs ==== + // https://plugins.gradle.org/plugin/com.github.spotbugs + apply plugin: "com.github.spotbugs" + // We don't need to lint tests. + tasks["spotbugsTest"].enabled = false + // Configure the bug filter for spotbugs. + spotbugs { + effort = "max" + excludeFilterConfig = project.resources.text.fromFile("${project.rootDir}/config/spotbugs/filter.xml") + } +} + +// The root project doesn't produce a JAR. +tasks["jar"].enabled = false + +// ==== Javadoc ==== +project.afterEvaluate { + tasks.javadoc { + title = "Smithy API ${version}" + setDestinationDir(file("${project.buildDir}/docs/javadoc/latest")) + // Build a consolidated javadoc of all subprojects. + source(project.subprojects.stream().map({ + project(it.path).sourceSets.main.allJava + }).collect(Collectors.toList())) + } +} + +/* + * Sonatype Staging Finalization + * ==================================================== + * + * When publishing to Maven Central, we need to close the staging + * repository and release the artifacts after they have been + * validated. This configuration is for the root project because + * it operates at the "group" level. + */ +if (project.hasProperty("sonatypeUser") && project.hasProperty("sonatypePassword")) { + apply plugin: "io.codearte.nexus-staging" + nexusStaging { + packageGroup = "software.amazon" + stagingProfileId = "e789115b6c941" + username = project.property("sonatypeUser") + password = project.property("sonatypePassword") + } +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 72746087f72..00000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -plugins { - `java-library` - `maven-publish` - signing - checkstyle - jacoco - id("com.github.spotbugs") version "1.6.10" - id("io.codearte.nexus-staging") version "0.21.0" - id("me.champeau.gradle.jmh") version "0.4.6" -} - -// Load the Smithy version from VERSION. -val libraryVersion = project.file("VERSION") - .inputStream() - .bufferedReader() - .use{ it.readText() } - .replace("\n", "") -println("Smithy version: '$libraryVersion'") - -// Set a global group ID and version on each project. This version might -// need to be overridden is a project ever needs to be version bumped out -// of band with the rest of the projects. -allprojects { - group = "software.amazon.smithy" - version = libraryVersion -} - -// The root project doesn't produce a JAR. -tasks["jar"].enabled = false - -// Load the Sonatype user/password for use in publishing tasks. -val sonatypeUser: String? by project -val sonatypePassword: String? by project - -/* - * Sonatype Staging Finalization - * ==================================================== - * - * When publishing to Maven Central, we need to close the staging - * repository and release the artifacts after they have been - * validated. This configuration is for the root project because - * it operates at the "group" level. - */ -if (sonatypeUser != null && sonatypePassword != null){ - apply(plugin = "io.codearte.nexus-staging") - - nexusStaging { - packageGroup = "software.amazon" - stagingProfileId = "e789115b6c941" - - username = sonatypeUser - password = sonatypePassword - } -} - -subprojects { - val subproject = this - - /* - * Java - * ==================================================== - * - * By default, build each subproject as a java library. - * We can add if-statements around this plugin to change - * how specific subprojects are built (for example, if - * we build Sphinx subprojects with Gradle). - */ - apply(plugin = "java-library") - - java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - repositories { - mavenLocal() - mavenCentral() - } - - // Use Junit5's test runner. - tasks.withType { - useJUnitPlatform() - } - - // Apply junit 5 and hamcrest test dependencies to all java projects. - dependencies { - testCompile("org.junit.jupiter:junit-jupiter-api:5.4.0") - testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.0") - testCompile("org.junit.jupiter:junit-jupiter-params:5.4.0") - testCompile("org.hamcrest:hamcrest:2.1") - } - - // Reusable license copySpec - val licenseSpec = copySpec { - from("${project.rootDir}/LICENSE") - from("${project.rootDir}/NOTICE") - } - - // Set up tasks that build source and javadoc jars. - tasks.register("sourcesJar") { - metaInf.with(licenseSpec) - from(sourceSets.main.get().allJava) - archiveClassifier.set("sources") - } - - tasks.register("javadocJar") { - metaInf.with(licenseSpec) - from(tasks.javadoc) - archiveClassifier.set("javadoc") - } - - tasks.jar { - metaInf.with(licenseSpec) - inputs.property("moduleName", subproject.extra["moduleName"]) - manifest { - attributes["Automatic-Module-Name"] = subproject.extra["moduleName"] - } - } - - // Always run javadoc after build. - tasks["build"].dependsOn(tasks["javadoc"]) - - /* - * Maven - * ==================================================== - * - * Publish to Maven central. - */ - apply(plugin = "maven-publish") - apply(plugin = "signing") - - publishing { - repositories { - mavenCentral { - url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = sonatypeUser - password = sonatypePassword - } - } - } - - publications { - create("mavenJava") { - from(components["java"]) - - // Ship the source and javadoc jars. - artifact(tasks["sourcesJar"]) - artifact(tasks["javadocJar"]) - - // Include extra information in the POMs. - afterEvaluate { - pom { - name.set(subproject.extra["displayName"].toString()) - description.set(subproject.description) - url.set("https://github.com/awslabs/smithy") - licenses { - license { - name.set("Apache License 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - developers { - developer { - id.set("smithy") - name.set("Smithy") - organization.set("Amazon Web Services") - organizationUrl.set("https://aws.amazon.com") - roles.add("developer") - } - } - scm { - url.set("https://github.com/awslabs/smithy.git") - } - } - } - } - } - - // Don't sign the artifacts if we didn't get a key and password to use. - val signingKey: String? by project - val signingPassword: String? by project - if (signingKey != null && signingPassword != null) { - signing { - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publishing.publications["mavenJava"]) - } - } - } - - /* - * CheckStyle - * ==================================================== - * - * Apply CheckStyle to source files but not tests. - */ - apply(plugin = "checkstyle") - - tasks["checkstyleTest"].enabled = false - - /* - * Code coverage - * ==================================================== - * - * Create code coverage reports after running tests. - */ - apply(plugin = "jacoco") - - // Always run the jacoco test report after testing. - tasks["build"].dependsOn(tasks["jacocoTestReport"]) - - // Configure jacoco to generate an HTML report. - tasks.jacocoTestReport { - reports { - xml.isEnabled = false - csv.isEnabled = false - html.destination = file("$buildDir/reports/jacoco") - } - } - - /* - * Tests - * ==================================================== - * - * Configure the running of tests. - */ - // Log on passed, skipped, and failed test events if the `-Plog-tests` property is set. - if (project.hasProperty("log-tests")) { - tasks.test { - testLogging.events("passed", "skipped", "failed") - } - } - - /* - * Spotbugs - * ==================================================== - * - * Run spotbugs against source files and configure suppressions. - */ - apply(plugin = "com.github.spotbugs") - - // We don't need to lint tests. - tasks["spotbugsTest"].enabled = false - - // Configure the bug filter for spotbugs. - tasks.withType { - effort = "max" - excludeFilterConfig = project.resources.text.fromFile("${project.rootDir}/config/spotbugs/filter.xml") - } -} - -/* - * Javadoc - * ==================================================== - * - * Configure javadoc to collect sources and construct - * its classpath from the main sourceset of each - * subproject. - */ -tasks.javadoc { - title = "Smithy API $version" - setDestinationDir(file("$buildDir/docs/javadoc/latest")) - source(project.subprojects.map { - project(it.name).sourceSets.main.get().allJava - }) - classpath = files(project.subprojects.map { - project(it.name).sourceSets.main.get().compileClasspath - }) -} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000000..aa50eee3e48 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + } +} + +rootProject.name = "smithy" +include ":smithy-aws-iam-traits" +include ":smithy-aws-traits" +include ":smithy-aws-apigateway-traits" +include ":smithy-aws-apigateway-openapi" +include ":smithy-aws-protocol-tests" +include ":smithy-cli" +include ":smithy-codegen-core" +include ":smithy-build" +include ":smithy-model" +include ":smithy-diff" +include ":smithy-linters" +include ":smithy-mqtt-traits" +include ":smithy-jsonschema" +include ":smithy-openapi" +include ":smithy-utils" +include ":smithy-protocol-test-traits" diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index 6d0bed82fb3..00000000000 --- a/settings.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -rootProject.name = "smithy" -include(":smithy-aws-iam-traits") -include(":smithy-aws-traits") -include(":smithy-aws-apigateway-traits") -include(":smithy-aws-apigateway-openapi") -include(":smithy-aws-protocol-tests") -include(":smithy-cli") -include(":smithy-codegen-core") -include(":smithy-build") -include(":smithy-model") -include(":smithy-diff") -include(":smithy-linters") -include(":smithy-mqtt-traits") -include(":smithy-jsonschema") -include(":smithy-openapi") -include(":smithy-utils") -include(":smithy-protocol-test-traits") - -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - } -} diff --git a/smithy-aws-apigateway-openapi/build.gradle.kts b/smithy-aws-apigateway-openapi/build.gradle similarity index 76% rename from smithy-aws-apigateway-openapi/build.gradle.kts rename to smithy-aws-apigateway-openapi/build.gradle index 817a4f03832..4406baa4421 100644 --- a/smithy-aws-apigateway-openapi/build.gradle.kts +++ b/smithy-aws-apigateway-openapi/build.gradle @@ -15,10 +15,13 @@ description = "This module provides support for converting the Amazon API Gateway " + "Smithy traits when converting a Smithy model to OpenAPI3." -extra["displayName"] = "Smithy :: Amazon API Gateway OpenAPI Support" -extra["moduleName"] = "software.amazon.smithy.aws.apigateway.openapi" + +ext { + displayName = "Smithy :: Amazon API Gateway OpenAPI Support" + moduleName = "software.amazon.smithy.aws.apigateway.openapi" +} dependencies { - api(project(":smithy-openapi")) - api(project(":smithy-aws-apigateway-traits")) + api project(":smithy-openapi") + api project(":smithy-aws-apigateway-traits") } diff --git a/smithy-aws-apigateway-traits/build.gradle.kts b/smithy-aws-apigateway-traits/build.gradle similarity index 80% rename from smithy-aws-apigateway-traits/build.gradle.kts rename to smithy-aws-apigateway-traits/build.gradle index ec0e4b78a4b..5f43439a2f0 100644 --- a/smithy-aws-apigateway-traits/build.gradle.kts +++ b/smithy-aws-apigateway-traits/build.gradle @@ -14,9 +14,12 @@ */ description = "This module provides Smithy traits and validators for API Gateway." -extra["displayName"] = "Smithy :: AWS :: API Gateway Traits" -extra["moduleName"] = "software.amazon.smithy.aws.apigateway.traits" + +ext { + displayName = "Smithy :: AWS :: API Gateway Traits" + moduleName = "software.amazon.smithy.aws.apigateway.traits" +} dependencies { - api(project(":smithy-aws-traits")) + api project(":smithy-aws-traits") } diff --git a/smithy-aws-iam-traits/build.gradle.kts b/smithy-aws-iam-traits/build.gradle similarity index 81% rename from smithy-aws-iam-traits/build.gradle.kts rename to smithy-aws-iam-traits/build.gradle index a829bbc1eb6..2f9cb8250e4 100644 --- a/smithy-aws-iam-traits/build.gradle.kts +++ b/smithy-aws-iam-traits/build.gradle @@ -14,9 +14,12 @@ */ description = "This module provides Smithy traits and validators for IAM." -extra["displayName"] = "Smithy :: AWS :: IAM Traits" -extra["moduleName"] = "software.amazon.smithy.aws.iam.traits" + +ext { + displayName = "Smithy :: AWS :: IAM Traits" + moduleName = "software.amazon.smithy.aws.iam.traits" +} dependencies { - api(project(":smithy-aws-traits")) + api project(":smithy-aws-traits") } diff --git a/smithy-aws-protocol-tests/build.gradle.kts b/smithy-aws-protocol-tests/build.gradle similarity index 68% rename from smithy-aws-protocol-tests/build.gradle.kts rename to smithy-aws-protocol-tests/build.gradle index 06fcc21695e..197756d7b9f 100644 --- a/smithy-aws-protocol-tests/build.gradle.kts +++ b/smithy-aws-protocol-tests/build.gradle @@ -13,16 +13,19 @@ * permissions and limitations under the License. */ +plugins { + id "software.amazon.smithy" version "0.5.0" +} + description = "Defines protocol tests for AWS HTTP protocols." -extra["displayName"] = "Smithy :: AWS :: Protocol Tests" -extra["moduleName"] = "software.amazon.smithy.aws.protocoltests" -plugins { - id("software.amazon.smithy").version("0.5.0") +ext { + displayName = "Smithy :: AWS :: Protocol Tests" + moduleName = "software.amazon.smithy.aws.protocoltests" } dependencies { - compile(project(":smithy-cli")) - implementation(project(":smithy-protocol-test-traits")) - implementation(project(":smithy-aws-traits")) + compile project(":smithy-cli") + implementation project(":smithy-protocol-test-traits") + implementation project(":smithy-aws-traits") } diff --git a/smithy-aws-traits/build.gradle.kts b/smithy-aws-traits/build.gradle similarity index 83% rename from smithy-aws-traits/build.gradle.kts rename to smithy-aws-traits/build.gradle index 8e5a5304bfe..151dd98dbcc 100644 --- a/smithy-aws-traits/build.gradle.kts +++ b/smithy-aws-traits/build.gradle @@ -14,9 +14,12 @@ */ description = "This module provides Smithy traits and validators that are used by most AWS services." -extra["displayName"] = "Smithy :: AWS Core Traits" -extra["moduleName"] = "software.amazon.smithy.aws.traits" + +ext { + displayName = "Smithy :: AWS Core Traits" + moduleName = "software.amazon.smithy.aws.traits" +} dependencies { - api(project(":smithy-model")) + api project(":smithy-model") } diff --git a/smithy-build/build.gradle.kts b/smithy-build/build.gradle similarity index 82% rename from smithy-build/build.gradle.kts rename to smithy-build/build.gradle index a1b5a781010..7b47e4dcc9f 100644 --- a/smithy-build/build.gradle.kts +++ b/smithy-build/build.gradle @@ -15,10 +15,13 @@ description = "This module is a library used to validate Smithy models, create filtered " + "projections of a model, and generate build artifacts." -extra["displayName"] = "Smithy :: Build" -extra["moduleName"] = "software.amazon.smithy.build" + +ext { + displayName = "Smithy :: Build" + moduleName = "software.amazon.smithy.build" +} dependencies { - api(project(":smithy-utils")) - api(project(":smithy-model")) + api project(":smithy-utils") + api project(":smithy-model") } diff --git a/smithy-cli/build.gradle.kts b/smithy-cli/build.gradle similarity index 69% rename from smithy-cli/build.gradle.kts rename to smithy-cli/build.gradle index 7fb30bee4fe..bb0b737d87b 100644 --- a/smithy-cli/build.gradle.kts +++ b/smithy-cli/build.gradle @@ -13,26 +13,29 @@ * permissions and limitations under the License. */ +plugins { + id "application" + id "org.beryx.runtime" version "1.8.4" +} + description = "This module implements the Smithy command line interface." -extra["displayName"] = "Smithy :: CLI" -extra["moduleName"] = "software.amazon.smithy.cli" -plugins { - application - id("org.beryx.runtime") version "1.8.4" +ext { + displayName = "Smithy :: CLI" + moduleName = "software.amazon.smithy.cli" } dependencies { - implementation(project(":smithy-model")) - implementation(project(":smithy-build")) - implementation(project(":smithy-linters")) - implementation(project(":smithy-diff")) + implementation project(":smithy-model") + implementation project(":smithy-build") + implementation project(":smithy-linters") + implementation project(":smithy-diff") } application { mainClassName = "software.amazon.smithy.cli.SmithyCli" applicationName = "smithy" - applicationDefaultJvmArgs = listOf("-XX:TieredStopAtLevel=2", "-Xshare:auto") + applicationDefaultJvmArgs = ["-XX:TieredStopAtLevel=2", "-Xshare:auto"] } runtime { @@ -40,7 +43,7 @@ runtime { addModules("java.logging") } -tasks.register("optimizeCli") { +tasks.register("optimizeCli", Exec) { commandLine("${project.buildDir}/image/bin/java", "-Xshare:dump") } diff --git a/smithy-codegen-core/build.gradle.kts b/smithy-codegen-core/build.gradle similarity index 77% rename from smithy-codegen-core/build.gradle.kts rename to smithy-codegen-core/build.gradle index 478b07f3d50..6db84184cbe 100644 --- a/smithy-codegen-core/build.gradle.kts +++ b/smithy-codegen-core/build.gradle @@ -15,11 +15,14 @@ description = "This module provides a code generation framework for generating clients, " + "servers, documentation, and other artifacts for various languages from Smithy models." -extra["displayName"] = "Smithy :: Code Generation Framework" -extra["moduleName"] = "software.amazon.smithy.codegen.core" + +ext { + displayName = "Smithy :: Code Generation Framework" + moduleName = "software.amazon.smithy.codegen.core" +} dependencies { - api(project(":smithy-utils")) - api(project(":smithy-model")) - api(project(":smithy-build")) + api project(":smithy-utils") + api project(":smithy-model") + api project(":smithy-build") } diff --git a/smithy-diff/build.gradle.kts b/smithy-diff/build.gradle similarity index 82% rename from smithy-diff/build.gradle.kts rename to smithy-diff/build.gradle index 02a27517afb..c50e855357a 100644 --- a/smithy-diff/build.gradle.kts +++ b/smithy-diff/build.gradle @@ -15,10 +15,13 @@ description = "This module detects differences between two Smithy models, identifying " + "changes that are safe and changes that are backward incompatible." -extra["displayName"] = "Smithy :: Diff" -extra["moduleName"] = "software.amazon.smithy.diff" + +ext { + displayName = "Smithy :: Diff" + moduleName = "software.amazon.smithy.diff" +} dependencies { - api(project(":smithy-utils")) - api(project(":smithy-model")) + api project(":smithy-utils") + api project(":smithy-model") } diff --git a/smithy-jsonschema/build.gradle.kts b/smithy-jsonschema/build.gradle similarity index 78% rename from smithy-jsonschema/build.gradle.kts rename to smithy-jsonschema/build.gradle index c09d425b9e1..f9a37d2db58 100644 --- a/smithy-jsonschema/build.gradle.kts +++ b/smithy-jsonschema/build.gradle @@ -14,10 +14,13 @@ */ description = "This module contains support for converting a Smithy model to JSON Schema." -extra["displayName"] = "Smithy :: JSON Schema Conversion" -extra["moduleName"] = "software.amazon.smithy.jsonschema" + +ext { + displayName = "Smithy :: JSON Schema Conversion" + moduleName = "software.amazon.smithy.jsonschema" +} dependencies { - api(project(":smithy-utils")) - api(project(":smithy-model")) + api project(":smithy-utils") + api project(":smithy-model") } diff --git a/smithy-linters/build.gradle.kts b/smithy-linters/build.gradle similarity index 81% rename from smithy-linters/build.gradle.kts rename to smithy-linters/build.gradle index dd4db5166e3..1c0a8c90ec9 100644 --- a/smithy-linters/build.gradle.kts +++ b/smithy-linters/build.gradle @@ -15,10 +15,13 @@ description = "This module provides support for customizable linters declared in the " + "metadata section of a Smithy model." -extra["displayName"] = "Smithy :: Linters" -extra["moduleName"] = "software.amazon.smithy.linters" + +ext { + displayName = "Smithy :: Linters" + moduleName = "software.amazon.smithy.linters" +} dependencies { - api(project(":smithy-model")) - api(project(":smithy-utils")) + api project(":smithy-model") + api project(":smithy-utils") } diff --git a/smithy-model/build.gradle.kts b/smithy-model/build.gradle similarity index 75% rename from smithy-model/build.gradle.kts rename to smithy-model/build.gradle index e664ff5eade..01f684df114 100644 --- a/smithy-model/build.gradle.kts +++ b/smithy-model/build.gradle @@ -15,16 +15,19 @@ description = "This module provides the core implementation of loading, validating, " + "traversing, mutating, and serializing a Smithy model." -extra["displayName"] = "Smithy :: Model" -extra["moduleName"] = "software.amazon.smithy.model" -apply(plugin = "me.champeau.gradle.jmh") +ext { + displayName = "Smithy :: Model" + moduleName = "software.amazon.smithy.model" +} + +apply plugin: "me.champeau.gradle.jmh" dependencies { - api(project(":smithy-utils")) - "jmh"(project(":smithy-utils")) + api project(":smithy-utils") + jmh project(":smithy-utils") } -configure { +jmh { timeUnit = "us" } diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/loader/AstModelLoader.java b/smithy-model/src/main/java/software/amazon/smithy/model/loader/AstModelLoader.java index 6249289e98b..aa16f5d8b46 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/loader/AstModelLoader.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/loader/AstModelLoader.java @@ -21,6 +21,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; + import software.amazon.smithy.model.SourceException; import software.amazon.smithy.model.node.Node; import software.amazon.smithy.model.node.ObjectNode; diff --git a/smithy-mqtt-traits/build.gradle.kts b/smithy-mqtt-traits/build.gradle similarity index 79% rename from smithy-mqtt-traits/build.gradle.kts rename to smithy-mqtt-traits/build.gradle index 5cf2d397be0..e1709a00048 100644 --- a/smithy-mqtt-traits/build.gradle.kts +++ b/smithy-mqtt-traits/build.gradle @@ -14,10 +14,13 @@ */ description = "This module provides the implementation of MQTT binding traits for Smithy." -extra["displayName"] = "Smithy :: MQTT Traits" -extra["moduleName"] = "software.amazon.smithy.mqtt.traits" + +ext { + displayName = "Smithy :: MQTT Traits" + moduleName = "software.amazon.smithy.mqtt.traits" +} dependencies { - api(project(":smithy-utils")) - api(project(":smithy-model")) + api project(":smithy-utils") + api project(":smithy-model") } diff --git a/smithy-openapi/build.gradle.kts b/smithy-openapi/build.gradle similarity index 72% rename from smithy-openapi/build.gradle.kts rename to smithy-openapi/build.gradle index f61739cc965..4f5d6be28da 100644 --- a/smithy-openapi/build.gradle.kts +++ b/smithy-openapi/build.gradle @@ -14,12 +14,15 @@ */ description = "This module contains support for converting a Smithy model to OpenAPI." -extra["displayName"] = "Smithy :: OpenAPI Conversion" -extra["moduleName"] = "software.amazon.smithy.openapi" + +ext { + displayName = "Smithy :: OpenAPI Conversion" + moduleName = "software.amazon.smithy.openapi" +} dependencies { - api(project(":smithy-model")) - api(project(":smithy-build")) - api(project(":smithy-jsonschema")) - api(project(":smithy-aws-traits")) + api project(":smithy-model") + api project(":smithy-build") + api project(":smithy-jsonschema") + api project(":smithy-aws-traits") } diff --git a/smithy-protocol-test-traits/build.gradle.kts b/smithy-protocol-test-traits/build.gradle similarity index 80% rename from smithy-protocol-test-traits/build.gradle.kts rename to smithy-protocol-test-traits/build.gradle index a8c46c52dd7..d2ac79edb79 100644 --- a/smithy-protocol-test-traits/build.gradle.kts +++ b/smithy-protocol-test-traits/build.gradle @@ -14,9 +14,12 @@ */ description = "Defines protocol test traits." -extra["displayName"] = "Smithy :: Protocol Test Traits" -extra["moduleName"] = "software.amazon.smithy.protocoltest.traits" + +ext { + displayName = "Smithy :: Protocol Test Traits" + moduleName = "software.amazon.smithy.protocoltest.traits" +} dependencies { - api(project(":smithy-model")) + api project(":smithy-model") } diff --git a/smithy-utils/build.gradle.kts b/smithy-utils/build.gradle similarity index 87% rename from smithy-utils/build.gradle.kts rename to smithy-utils/build.gradle index 865d4f7754e..0fbcbc7fc03 100644 --- a/smithy-utils/build.gradle.kts +++ b/smithy-utils/build.gradle @@ -14,5 +14,8 @@ */ description = "This module contains utility classes and interfaces for Smithy." -extra["displayName"] = "Smithy :: Utilities" -extra["moduleName"] = "software.amazon.smithy.utils" + +ext { + displayName = "Smithy :: Utilities" + moduleName = "software.amazon.smithy.utils" +}