Skip to content

Commit 0f999cf

Browse files
authored
Add required artifacts for central repo. (#446)
1 parent 193ec97 commit 0f999cf

4 files changed

Lines changed: 90 additions & 75 deletions

File tree

buildSrc/src/main/groovy/com.google.api-ads.java-conventions.gradle

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
*/
1818

1919
plugins {
20-
id 'java-library'
21-
id 'maven-publish'
20+
id 'java-library'
21+
id 'maven-publish'
2222
}
2323

2424
repositories {
25-
mavenLocal()
26-
mavenCentral()
25+
mavenLocal()
26+
mavenCentral()
2727
}
2828

2929
group = 'com.google.api-ads'
@@ -32,92 +32,93 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8
3232
java.targetCompatibility = JavaVersion.VERSION_1_8
3333

3434
java {
35-
withSourcesJar()
35+
withSourcesJar()
36+
withJavadocJar()
3637
}
3738

3839
publishing {
39-
publications {
40-
maven(MavenPublication) {
41-
from(components.java)
42-
}
40+
publications {
41+
maven(MavenPublication) {
42+
from(components.java)
4343
}
44+
}
4445
}
4546

4647
tasks.withType(JavaCompile) {
47-
options.encoding = 'UTF-8'
48+
options.encoding = 'UTF-8'
4849
}
4950

5051
dependencies {
51-
implementation 'com.google.guava:guava:30.0-android'
52-
implementation 'com.google.auto.service:auto-service:1.0-rc2'
53-
implementation 'com.google.api:gax:1.65.1'
54-
implementation 'com.google.api:gax-grpc:1.65.1'
55-
implementation 'com.google.protobuf:protobuf-java:3.14.0'
56-
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2'
57-
testImplementation 'junit:junit:4.13.1'
52+
implementation 'com.google.guava:guava:30.0-android'
53+
implementation 'com.google.auto.service:auto-service:1.0-rc2'
54+
implementation 'com.google.api:gax:1.65.1'
55+
implementation 'com.google.api:gax-grpc:1.65.1'
56+
implementation 'com.google.protobuf:protobuf-java:3.14.0'
57+
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2'
58+
testImplementation 'junit:junit:4.13.1'
5859
}
5960

6061
public class ExampleRunnerTask extends JavaExec {
6162

62-
@Input
63-
public String basePackage = 'com.google.ads.googleads.examples.'
64-
65-
@Optional
66-
@Input
67-
private String exampleArguments
68-
69-
public ExampleRunnerTask() {
70-
group = 'Execution'
71-
description = 'Run a Google Ads API example.'
72-
errorOutput = System.err
63+
@Input
64+
public String basePackage = 'com.google.ads.googleads.examples.'
65+
66+
@Optional
67+
@Input
68+
private String exampleArguments
69+
70+
public ExampleRunnerTask() {
71+
group = 'Execution'
72+
description = 'Run a Google Ads API example.'
73+
errorOutput = System.err
74+
}
75+
76+
@Option(option = 'example', description = 'Sets the example to launch and' +
77+
' any arguments. Required for execution. E.g. ' +
78+
'"basicoperations.GetCampaigns --customerId 1234567890"')
79+
public void setExampleArguments(String exampleArguments) {
80+
this.exampleArguments = exampleArguments.trim()
81+
int firstSpaceIndex = this.exampleArguments.indexOf(' ')
82+
83+
// No additional arguments were passed, just the example name.
84+
if (firstSpaceIndex == -1) {
85+
main = basePackage + this.exampleArguments
7386
}
74-
75-
@Option(option = 'example', description = 'Sets the example to launch and' +
76-
' any arguments. Required for execution. E.g. ' +
77-
'"basicoperations.GetCampaigns --customerId 1234567890"')
78-
public void setExampleArguments(String exampleArguments) {
79-
this.exampleArguments = exampleArguments.trim()
80-
int firstSpaceIndex = this.exampleArguments.indexOf(' ')
81-
82-
// No additional arguments were passed, just the example name.
83-
if (firstSpaceIndex == -1) {
84-
main = basePackage + this.exampleArguments
85-
}
86-
// Otherwise, separate the input and set the arguments to pass to the
87-
// main class.
88-
else {
89-
main = basePackage + this.exampleArguments[0..firstSpaceIndex - 1]
90-
argsString(exampleArguments[(firstSpaceIndex + 1)..-1])
91-
}
87+
// Otherwise, separate the input and set the arguments to pass to the
88+
// main class.
89+
else {
90+
main = basePackage + this.exampleArguments[0..firstSpaceIndex - 1]
91+
argsString(exampleArguments[(firstSpaceIndex + 1)..-1])
9292
}
93-
94-
@TaskAction
95-
@Override
96-
public void exec() {
97-
if (!(exampleArguments?.trim())) {
98-
throw new GradleException('\033[0;31mMissing example!\033[0m ' +
99-
'Please rerun with one provided, e.g. ' +
100-
'\033[0;35m--example="basicoperations.GetCampaigns"\033[0m')
101-
}
102-
logQuietMessage('Running example: ' + main + ', args: ' +
103-
args.toString())
104-
try {
105-
super.exec()
106-
}
107-
catch (Exception e) {
108-
logQuietMessage('\n\033[0;31mrunExample exception!\033[0m Did ' +
109-
'you provide a valid example identifier? E.g. ' +
110-
'\033[0;35m--example="basicoperations.GetCampaigns"\033[0m\n\n' +
111-
e.message)
112-
}
93+
}
94+
95+
@TaskAction
96+
@Override
97+
public void exec() {
98+
if (!(exampleArguments?.trim())) {
99+
throw new GradleException('\033[0;31mMissing example!\033[0m ' +
100+
'Please rerun with one provided, e.g. ' +
101+
'\033[0;35m--example="basicoperations.GetCampaigns"\033[0m')
113102
}
114-
115-
public String getExampleArguments() {
116-
return exampleArguments
103+
logQuietMessage('Running example: ' + main + ', args: ' +
104+
args.toString())
105+
try {
106+
super.exec()
117107
}
118-
119-
private void logQuietMessage(String message) {
120-
logger.quiet(message)
108+
catch (Exception e) {
109+
logQuietMessage('\n\033[0;31mrunExample exception!\033[0m Did ' +
110+
'you provide a valid example identifier? E.g. ' +
111+
'\033[0;35m--example="basicoperations.GetCampaigns"\033[0m\n\n' +
112+
e.message)
121113
}
114+
}
115+
116+
public String getExampleArguments() {
117+
return exampleArguments
118+
}
119+
120+
private void logQuietMessage(String message) {
121+
logger.quiet(message)
122+
}
122123

123124
}

google-ads/build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import com.google.common.collect.Sets
2222

2323
plugins {
2424
id 'com.google.api-ads.java-conventions'
25-
id 'maven-publish'
25+
id 'signing'
2626
id 'com.google.protobuf' version '0.8.15'
2727
id "com.github.hierynomus.license-report" version "0.15.0"
2828
id 'com.github.johnrengelman.shadow' version '6.1.0'
@@ -337,6 +337,13 @@ publishing {
337337
publications {
338338
shadow(MavenPublication) { publication ->
339339
project.shadow.component(publication)
340+
// Publishes the javadoc + sources with the shadowjar.
341+
configurations.javadocElements.artifacts.each {
342+
artifact it
343+
}
344+
configurations.sourcesElements.artifacts.each {
345+
artifact it
346+
}
340347

341348
groupId = 'com.google.api-ads'
342349
artifactId = 'google-ads-shadowjar'
@@ -365,6 +372,10 @@ publishing {
365372
}
366373
}
367374

375+
signing {
376+
sign publishing.publications.shadow
377+
}
378+
368379
// Provide a helpful error message for missing sonatype credentials.
369380
tasks.findAll {
370381
if (it.name.matches("publish.+ToSonatypeRepository")) {
@@ -375,3 +386,4 @@ tasks.findAll {
375386
}
376387
}
377388
}
389+

google-ads/src/main/java/com/google/ads/googleads/lib/GoogleAdsClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private void setLinkedCustomerId(Properties properties) {
423423
public abstract String getEndpoint();
424424

425425
/**
426-
* Optional: Overrides the default endpoint. For the default value see {@see #DEFAULT_ENDPOINT}
426+
* Optional: Overrides the default endpoint. For the default value see {@link GoogleAdsClient#DEFAULT_ENDPOINT}.
427427
*/
428428
public abstract Builder setEndpoint(String endpoint);
429429

google-ads/src/main/java/com/google/ads/googleads/lib/catalog/Version.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public String getVersionName() {
6060
return versionName;
6161
}
6262

63-
/** Allows sorting of versions, higher version numbers have lower sorting rank, as in v1 < v0. */
63+
/**
64+
* Allows sorting of versions, higher version numbers have lower sorting rank, as in v1 &lt; v0.
65+
*/
6466
@Override
6567
public int compareTo(Version o) {
6668
return o.versionName.compareTo(versionName);

0 commit comments

Comments
 (0)