@@ -7,10 +7,12 @@ plugins {
77 `java`
88 `java- library`
99 `maven- publish`
10+ `signing`
11+ id(" io.github.gradle-nexus.publish-plugin" ) version " 1.3.0"
1012}
1113
1214group = " software.amazon.cryptography"
13- version = " 1.0-SNAPSHOT "
15+ version = " 3.0.0-preview-1 "
1416description = " Aws Database Encryption Sdk for DynamoDb Java"
1517
1618java {
@@ -68,7 +70,7 @@ val dynamodb by configurations.creating
6870dependencies {
6971 implementation(" org.dafny:DafnyRuntime:4.1.0" )
7072 implementation(" software.amazon.smithy.dafny:conversion:0.1" )
71- implementation(" software.amazon.cryptography:AwsCryptographicMaterialProviders :1.0-SNAPSHOT " )
73+ implementation(" software.amazon.cryptography:aws-cryptographic-material-providers :1.0.0-preview-1 " )
7274
7375 implementation(platform(" software.amazon.awssdk:bom:2.19.1" ))
7476 implementation(" software.amazon.awssdk:dynamodb" )
@@ -107,12 +109,55 @@ dependencies {
107109}
108110
109111publishing {
112+ publications.create<MavenPublication >(" mavenLocal" ) {
113+ groupId = " software.amazon.cryptography"
114+ artifactId = " aws-database-encryption-sdk-dynamodb"
115+ from(components[" java" ])
116+ }
117+
110118 publications.create<MavenPublication >(" maven" ) {
111119 groupId = " software.amazon.cryptography"
112120 artifactId = " aws-database-encryption-sdk-dynamodb"
113121 from(components[" java" ])
122+
123+ // Include extra information in the POMs.
124+ afterEvaluate {
125+ pom {
126+ name.set(" AWS Database Encryption SDK for DynamoDB" )
127+ description.set(" AWS Database Encryption SDK for DynamoDB in Java" )
128+ url.set(" https://github.com/aws/aws-database-encryption-sdk-dynamodb-java" )
129+ licenses {
130+ license {
131+ name.set(" Apache License 2.0" )
132+ url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
133+ distribution.set(" repo" )
134+ }
135+ }
136+ developers {
137+ developer {
138+ id.set(" amazonwebservices" )
139+ organization.set(" Amazon Web Services" )
140+ organizationUrl.set(" https://aws.amazon.com" )
141+ roles.add(" developer" )
142+ }
143+ }
144+ scm {
145+ url.set(" https://github.com/aws/aws-database-encryption-sdk-dynamodb-java.git" )
146+ }
147+ }
148+ }
149+ }
150+ repositories {
151+ mavenLocal()
152+ maven {
153+ name = " StagingCodeArtifact"
154+ url = URI .create(" https://crypto-tools-internal-587316601012.d.codeartifact.us-east-1.amazonaws.com/maven/java-dbesdk-ddb-staging/" )
155+ credentials {
156+ username = " aws"
157+ password = System .getenv(" CODEARTIFACT_TOKEN" )
158+ }
159+ }
114160 }
115- repositories { mavenLocal() }
116161}
117162
118163tasks.withType<JavaCompile >() {
@@ -185,3 +230,36 @@ tasks.javadoc {
185230 }
186231 exclude(" src/main/dafny-generated" )
187232}
233+
234+ nexusPublishing {
235+ // We are using the nexusPublishing plugin since it is recommended by Sonatype Gradle Project configurations
236+ // and it is easy to supply the creds we need to deploy
237+ // https://github.com/gradle-nexus/publish-plugin/
238+ repositories {
239+ sonatype {
240+ nexusUrl.set(uri(" https://aws.oss.sonatype.org/service/local/" ))
241+ snapshotRepositoryUrl.set(uri(" https://aws.oss.sonatype.org/content/repositories/snapshots/" ))
242+ username.set(System .getenv(" SONA_USERNAME" ))
243+ password.set(System .getenv(" SONA_PASSWORD" ))
244+ }
245+ }
246+ }
247+
248+ signing {
249+ useGpgCmd()
250+
251+ // Dynamically set these properties
252+ project.ext.set(" signing.gnupg.executable" , " gpg" )
253+ project.ext.set(" signing.gnupg.useLegacyGpg" , " true" )
254+ project.ext.set(" signing.gnupg.homeDir" , System .getenv(" HOME" ) + " /.gnupg/" )
255+ project.ext.set(" signing.gnupg.optionsFile" , System .getenv(" HOME" ) + " /.gnupg/gpg.conf" )
256+ project.ext.set(" signing.gnupg.keyName" , System .getenv(" GPG_KEY" ))
257+ project.ext.set(" signing.gnupg.passphrase" , System .getenv(" GPG_PASS" ))
258+
259+ // Signing is required if building a release version and if we're going to publish it.
260+ // Otherwise if doing a maven publication we will sign
261+ setRequired({
262+ gradle.getTaskGraph().hasTask(" publish" )
263+ })
264+ sign(publishing.publications[" maven" ])
265+ }
0 commit comments