|
17 | 17 | plugins { |
18 | 18 | id 'java-library' |
19 | 19 | id 'maven-publish' |
| 20 | + id 'signing' |
| 21 | + id 'com.google.cloud.artifactregistry.gradle-plugin' version '2.2.5' apply false |
| 22 | +} |
| 23 | + |
| 24 | +def isPublishing = gradle.startParameter.taskNames.any { it.endsWith('publish') || it.contains('ArtifactRegistry') } |
| 25 | +if (isPublishing) { |
| 26 | + apply plugin: 'com.google.cloud.artifactregistry.gradle-plugin' |
20 | 27 | } |
21 | 28 |
|
22 | 29 | group = 'com.google.api-ads' |
23 | 30 | description = 'Utilities for working with the Data Manager API' |
24 | 31 | version = '0.4.0' |
25 | 32 |
|
26 | | -sourceCompatibility = 1.8 |
27 | | -targetCompatibility = 1.8 |
| 33 | +java { |
| 34 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 35 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 36 | + withSourcesJar() |
| 37 | + withJavadocJar() |
| 38 | +} |
| 39 | + |
| 40 | +publishing { |
| 41 | + publications { |
| 42 | + library(MavenPublication) { |
| 43 | + from components.java |
| 44 | + pom { |
| 45 | + name = 'Google Data Manager API Utilities' |
| 46 | + description = 'Utilities for working with the Data Manager API' |
| 47 | + url = 'https://github.com/googleads/data-manager-java' |
| 48 | + licenses { |
| 49 | + license { |
| 50 | + name = 'The Apache License, Version 2.0' |
| 51 | + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' |
| 52 | + } |
| 53 | + } |
| 54 | + developers { |
| 55 | + developer { |
| 56 | + id = 'josh' |
| 57 | + name = 'Josh Radcliff' |
| 58 | + email = 'jradcliff@users.noreply.github.com' |
| 59 | + organization = 'Google' |
| 60 | + organizationUrl = 'https://www.google.com' |
| 61 | + } |
| 62 | + developer { |
| 63 | + id = 'lindsey' |
| 64 | + name = 'Lindsey Volta' |
| 65 | + email = 'lindsey-volta@users.noreply.github.com' |
| 66 | + organization = 'Google' |
| 67 | + organizationUrl = 'https://www.google.com' |
| 68 | + } |
| 69 | + } |
| 70 | + scm { |
| 71 | + connection = 'scm:git:git://github.com/googleads/data-manager-java.git' |
| 72 | + developerConnection = 'scm:git:ssh://github.com:googleads/data-manager-java.git' |
| 73 | + url = 'https://github.com/googleads/data-manager-java' |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + repositories { |
| 79 | + if (isPublishing) { |
| 80 | + maven { |
| 81 | + name = 'ExitGateArtifactRegistry' |
| 82 | + url = uri(findProperty('artifact-registry-url') ?: "artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/measurement-devrel--mavencentral") |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | +} |
28 | 87 |
|
29 | | -publishing.publications { |
30 | | - library(MavenPublication).from components.java |
| 88 | +signing { |
| 89 | + def signingKey = findProperty("signingKey") ?: System.getenv("SIGNING_KEY") |
| 90 | + def signingPassword = findProperty("signingPassword") ?: System.getenv("SIGNING_PASSWORD") |
| 91 | + if (signingKey) { |
| 92 | + useInMemoryPgpKeys(signingKey, signingPassword) |
| 93 | + sign publishing.publications.library |
| 94 | + } |
31 | 95 | } |
32 | 96 |
|
33 | 97 | // Creates install "alias". |
|
0 commit comments