|
3 | 3 | * SPDX-License-Identifier: Apache-2.0. |
4 | 4 | */ |
5 | 5 |
|
| 6 | +apply plugin: 'maven-publish' |
| 7 | +apply plugin: 'signing' |
| 8 | + |
6 | 9 | // FIXME: Create a real "javadoc" JAR from the Dokka output |
7 | 10 | tasks.register("javadocJar", Jar) { |
8 | 11 | archiveClassifier.set("javadoc") |
9 | 12 | from() |
10 | 13 | } |
11 | 14 |
|
12 | | -project.afterEvaluate { |
13 | | - String publishGroupName = project.findProperty("publishGroupName") |
14 | | - if (publishGroupName == null || project.group.startsWith(publishGroupName)) { |
15 | | - apply plugin: 'maven-publish' |
16 | | - apply plugin: 'signing' |
17 | | - |
18 | | - publishing { |
19 | | - repositories { |
20 | | - maven { name = "testLocal"; url = "$rootProject.buildDir/m2" } |
21 | | - maven { |
22 | | - name = "awsCodeArtifact" |
23 | | - url = project.findProperty("codeartifact.url") |
24 | | - credentials { |
25 | | - username = "aws" |
26 | | - password = project.findProperty("codeartifact.token") ?: System.getenv("CODEARTIFACT_TOKEN") |
27 | | - } |
28 | | - } |
| 15 | +publishing { |
| 16 | + repositories { |
| 17 | + maven { name = "testLocal"; url = "$rootProject.buildDir/m2" } |
| 18 | + maven { |
| 19 | + name = "awsCodeArtifact" |
| 20 | + url = project.findProperty("codeartifact.url") |
| 21 | + credentials { |
| 22 | + username = "aws" |
| 23 | + password = project.findProperty("codeartifact.token") ?: System.getenv("CODEARTIFACT_TOKEN") |
29 | 24 | } |
| 25 | + } |
| 26 | + } |
30 | 27 |
|
31 | | - publications.all { |
32 | | - pom { |
33 | | - name = project.name |
34 | | - description = project.description |
35 | | - url = "https://github.com/awslabs/aws-sdk-kotlin" |
36 | | - licenses { |
37 | | - license { |
38 | | - name = "The Apache License, Version 2.0" |
39 | | - url = "http://www.apache.org/licenses/LICENSE-2.0.txt" |
40 | | - } |
41 | | - } |
42 | | - developers { |
43 | | - developer { |
44 | | - id = "aws-sdk-kotlin" |
45 | | - name = "AWS SDK Kotlin Team" |
46 | | - // TODO - team email? |
47 | | - } |
| 28 | + publications.all { |
| 29 | + project.afterEvaluate { |
| 30 | + pom { |
| 31 | + name = project.name |
| 32 | + description = project.description |
| 33 | + url = "https://github.com/awslabs/aws-sdk-kotlin" |
| 34 | + licenses { |
| 35 | + license { |
| 36 | + name = "The Apache License, Version 2.0" |
| 37 | + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" |
48 | 38 | } |
49 | | - scm { |
50 | | - connection = "scm:git:git://github.com/awslabs/aws-sdk-kotlin.git" |
51 | | - developerConnection = "scm:git:ssh://github.com/awslabs/aws-sdk-kotlin.git" |
52 | | - url = "https://github.com/awslabs/aws-sdk-kotlin" |
| 39 | + } |
| 40 | + developers { |
| 41 | + developer { |
| 42 | + id = "aws-sdk-kotlin" |
| 43 | + name = "AWS SDK Kotlin Team" |
| 44 | + // TODO - team email? |
53 | 45 | } |
54 | | - |
55 | | - artifact(tasks["javadocJar"]) |
56 | 46 | } |
57 | | - } |
58 | | - |
59 | | - if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) { |
60 | | - signing { |
61 | | - useInMemoryPgpKeys( |
62 | | - (String) project.property("signingKey"), |
63 | | - (String) project.property("signingPassword") |
64 | | - ) |
65 | | - sign(publications) |
| 47 | + scm { |
| 48 | + connection = "scm:git:git://github.com/awslabs/aws-sdk-kotlin.git" |
| 49 | + developerConnection = "scm:git:ssh://github.com/awslabs/aws-sdk-kotlin.git" |
| 50 | + url = "https://github.com/awslabs/aws-sdk-kotlin" |
66 | 51 | } |
| 52 | + |
| 53 | + artifact(tasks["javadocJar"]) |
67 | 54 | } |
68 | 55 | } |
| 56 | + } |
69 | 57 |
|
70 | | - tasks.register('publishToAwsCodeArtifact') { |
71 | | - dependsOn 'publishAllPublicationsToAwsCodeArtifactRepository' |
72 | | - group 'publishing' |
| 58 | + if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) { |
| 59 | + signing { |
| 60 | + useInMemoryPgpKeys( |
| 61 | + (String) project.property("signingKey"), |
| 62 | + (String) project.property("signingPassword") |
| 63 | + ) |
| 64 | + sign(publications) |
73 | 65 | } |
74 | 66 | } |
75 | 67 | } |
| 68 | + |
| 69 | +tasks.register('publishToAwsCodeArtifact') { |
| 70 | + dependsOn 'publishAllPublicationsToAwsCodeArtifactRepository' |
| 71 | + group 'publishing' |
| 72 | +} |
| 73 | + |
| 74 | +def isAvailableForPublication(publication) { |
| 75 | + return !project.hasProperty("publishGroupName") || |
| 76 | + publication.groupId.startsWith((String) project.property("publishGroupName")) |
| 77 | +} |
| 78 | + |
| 79 | +tasks.withType(AbstractPublishToMaven).all { |
| 80 | + onlyIf { isAvailableForPublication(publication) } |
| 81 | +} |
0 commit comments