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

Update examples to use new gradle plugin #54

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
17 changes: 4 additions & 13 deletions custom-trait-examples/custom-annotation-trait/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
description = "A package used to define an annotation trait"

plugins {
val smithyGradleVersion: String by project

`java-library`
id("com.github.spotbugs").version("4.7.1")
id("software.amazon.smithy").version(smithyGradleVersion)
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}

java {
Expand Down Expand Up @@ -53,17 +51,10 @@ repositories {
mavenCentral()
}

buildscript {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}

dependencies {
val smithyVersion: String by project

smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

implementation("software.amazon.smithy:smithy-model:$smithyVersion")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $version: "2.0"
namespace smithy.example

@trait(selector: "structure")
structure special {}
structure special {}
15 changes: 3 additions & 12 deletions custom-trait-examples/custom-string-trait/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
description = "Package for a custom Smithy string trait"

plugins {
val smithyGradleVersion: String by project

`java-library`
id("com.github.spotbugs").version("4.7.3")
id("software.amazon.smithy").version(smithyGradleVersion)
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}

java {
Expand Down Expand Up @@ -54,18 +52,11 @@ repositories {
mavenCentral()
}

buildscript {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}

dependencies {
val smithyVersion: String by project

smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

implementation("software.amazon.smithy:smithy-model:$smithyVersion")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ $version: "2.0"
namespace io.smithy.example

@trait(selector: "member")
string jsonName
string jsonName
15 changes: 4 additions & 11 deletions custom-trait-examples/custom-structure-trait/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@
description = "Custom Smithy structure trait with multiple inputs"

plugins {
val smithyGradleVersion: String by project
`java-library`
id("com.github.spotbugs").version("4.7.3")
id("software.amazon.smithy").version(smithyGradleVersion)
}

buildscript {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}

java {
Expand Down Expand Up @@ -59,6 +49,9 @@ repositories {
dependencies {
val smithyVersion: String by project


smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

implementation("software.amazon.smithy:smithy-model:$smithyVersion")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ $version: "2.0"
namespace io.smithy.example

@trait(
selector: "resource",
breakingChanges: [{change: "presence"}]
selector: "resource"
breakingChanges: [
{change: "presence"}
]
)
structure resourceMetadata {
/// Provides a custom name for your resource.
@required
description: String,
description: String

/// A type for the resource
@required
Expand All @@ -20,13 +22,13 @@ structure resourceMetadata {
}

enum ResourceType {
NORMAL,
SPECIAL,
NORMAL
SPECIAL
NONE
}

@private
list StructureIdList {
@idRef(failWhenMissing: true, selector: "structure")
member: String
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
plugins {
val smithyGradleVersion: String by project

id("software.amazon.smithy").version(smithyGradleVersion)
id("java-library")
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}


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

repositories {
mavenLocal()
mavenCentral()
}

buildscript {
dependencies {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}
smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

dependencies {
implementation(project(":custom-trait-examples:custom-annotation-trait"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ use smithy.example#special
structure MyStructure {
myMember: String
}

Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@

plugins {
val smithyGradleVersion: String by project

id("software.amazon.smithy").version(smithyGradleVersion)
id("java-library")
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}


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

repositories {
mavenLocal()
mavenCentral()
}

buildscript {
dependencies {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}
smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

dependencies {
implementation(project(":custom-trait-examples:custom-string-trait"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ structure MyStructure {
@jsonName("TESTING")
myMember: String
}

Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@

plugins {
val smithyGradleVersion: String by project

id("software.amazon.smithy").version(smithyGradleVersion)
id("java-library")
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}


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

buildscript {
dependencies {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}
smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation(project(":custom-trait-examples:custom-structure-trait"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ namespace example
use io.smithy.example#resourceMetadata

@resourceMetadata(
description: "woo",
description: "woo"
type: "NORMAL"
associatedStructures: [ ForecastStruct ]
associatedStructures: [ForecastStruct]
)
resource Forecast {
identifiers: { forecastId: ForecastId }
identifiers: {forecastId: ForecastId}
}

string ForecastId

structure ForecastStruct {}



Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
description = "A package used to share a common linting configuration between smithy projects"

plugins {
val smithyGradleVersion: String by project

id("software.amazon.smithy").version(smithyGradleVersion)
}

buildscript {
val smithyVersion: String by project

// Set the version of the CLI for the smithy gradle plugin to use when building this project
dependencies {
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
id("java-library")
id("software.amazon.smithy.gradle.smithy-jar").version("0.8.0")
}

repositories {
Expand All @@ -23,9 +13,10 @@ repositories {
dependencies {
val smithyVersion: String by project

smithyCli("software.amazon.smithy:smithy-cli:$smithyVersion")
implementation("software.amazon.smithy:smithy-linters:$smithyVersion")
}

smithy {
tags = setOf("validators", "common-config")
tags.addAll("validators", "common-config")
}
Loading