Skip to content

Commit 7c76256

Browse files
authored
Upgrade Gradle build system in generated library repo and fix setup issue (#876)
* chore: upgrade Gradle in generated library repo * chore: update configuration names in .bzl * chore: fix incorrect sub-project search * chore: configure publication
1 parent a1fe20f commit 7c76256

12 files changed

Lines changed: 325 additions & 336 deletions

rules_java_gapic/java_gapic_pkg.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def _java_gapic_build_configs_pkg_impl(ctx):
166166

167167
substitutions = dict(ctx.attr.static_substitutions)
168168
substitutions["{{extra_deps}}"] = _construct_extra_deps({
169-
"compile": ctx.attr.deps,
170-
"testCompile": ctx.attr.test_deps,
169+
"implementation": ctx.attr.deps,
170+
"testImplementation": ctx.attr.test_deps,
171171
}, substitutions)
172172

173173
for template in ctx.attr.templates.items():
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
buildscript {
2-
repositories {
3-
mavenLocal()
4-
maven {
5-
url 'https://plugins.gradle.org/m2/'
6-
}
7-
mavenCentral()
8-
}
9-
}
10-
111
subprojects {
12-
apply plugin: 'java'
13-
apply plugin: 'maven'
2+
apply plugin: 'java-library'
3+
apply plugin: 'maven-publish'
144

155
sourceCompatibility = 1.8
166
targetCompatibility = 1.8
@@ -23,7 +13,11 @@ subprojects {
2313
}
2414

2515
repositories {
26-
mavenLocal()
2716
mavenCentral()
17+
mavenLocal()
18+
}
19+
20+
publishing.publications {
21+
library(MavenPublication).from components.java
2822
}
2923
}
Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,17 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
}
5-
}
6-
7-
apply plugin: 'java'
8-
91
description = 'GAPIC library for {{name}}'
102
group = 'com.google.cloud'
11-
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
12-
sourceCompatibility = 1.8
13-
targetCompatibility = 1.8
14-
15-
repositories {
16-
mavenCentral()
17-
mavenLocal()
18-
}
3+
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version
194

205
compileJava.options.encoding = 'UTF-8'
216
javadoc.options.encoding = 'UTF-8'
227

238
dependencies {
24-
compile 'com.google.api:gax:{{version.gax}}'
25-
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
26-
compile 'com.google.api:gax-grpc:{{version.gax_grpc}}'
27-
testCompile 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
28-
testCompile 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
29-
testCompile '{{maven.junit_junit}}'
9+
implementation 'com.google.api:gax:{{version.gax}}'
10+
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
11+
implementation 'com.google.api:gax-grpc:{{version.gax_grpc}}'
12+
testImplementation 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
13+
testImplementation 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
14+
testImplementation '{{maven.junit_junit}}'
3015
{{extra_deps}}
3116
}
3217

@@ -56,6 +41,6 @@ clean {
5641
task allJars(type: Copy) {
5742
dependsOn test, jar
5843
into 'all-jars'
59-
// Replace with `from configurations.testRuntime, jar` to include test dependencies
60-
from configurations.runtime, jar
44+
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
45+
from configurations.runtimeOnly, jar
6146
}
Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
}
5-
}
6-
7-
apply plugin: 'java'
8-
91
description = 'GAPIC library for {{name}}'
102
group = 'com.google.cloud'
11-
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
12-
sourceCompatibility = 1.8
13-
targetCompatibility = 1.8
14-
15-
repositories {
16-
mavenCentral()
17-
mavenLocal()
18-
}
3+
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version
194

205
compileJava.options.encoding = 'UTF-8'
216
javadoc.options.encoding = 'UTF-8'
227

238
dependencies {
24-
compile 'com.google.api:gax:{{version.gax}}'
25-
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
26-
compile 'com.google.api:gax-grpc:{{version.gax_grpc}}'
27-
testCompile 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
28-
compile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
29-
testCompile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
30-
testCompile 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
31-
testCompile '{{maven.junit_junit}}'
9+
implementation 'com.google.api:gax:{{version.gax}}'
10+
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
11+
implementation 'com.google.api:gax-grpc:{{version.gax_grpc}}'
12+
testImplementation 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
13+
implementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
14+
testImplementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
15+
testImplementation 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
16+
testImplementation '{{maven.junit_junit}}'
3217
{{extra_deps}}
3318
}
3419

@@ -58,6 +43,6 @@ clean {
5843
task allJars(type: Copy) {
5944
dependsOn test, jar
6045
into 'all-jars'
61-
// Replace with `from configurations.testRuntime, jar` to include test dependencies
62-
from configurations.runtime, jar
46+
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
47+
from configurations.runtimeOnly, jar
6348
}
Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
}
5-
}
6-
7-
apply plugin: 'java'
8-
91
description = 'GAPIC library for {{name}}'
102
group = 'com.google.cloud'
11-
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
12-
sourceCompatibility = 1.8
13-
targetCompatibility = 1.8
14-
15-
repositories {
16-
mavenCentral()
17-
mavenLocal()
18-
}
3+
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version
194

205
compileJava.options.encoding = 'UTF-8'
216
javadoc.options.encoding = 'UTF-8'
227

238
dependencies {
24-
compile 'com.google.api:gax:{{version.gax}}'
25-
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
26-
compile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
27-
testCompile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
28-
testCompile '{{maven.junit_junit}}'
9+
implementation 'com.google.api:gax:{{version.gax}}'
10+
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
11+
implementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
12+
testImplementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
13+
testImplementation '{{maven.junit_junit}}'
2914
{{extra_deps}}
3015
}
3116

@@ -55,6 +40,6 @@ clean {
5540
task allJars(type: Copy) {
5641
dependsOn test, jar
5742
into 'all-jars'
58-
// Replace with `from configurations.testRuntime, jar` to include test dependencies
59-
from configurations.runtime, jar
43+
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
44+
from configurations.runtimeOnly, jar
6045
}
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Mon May 02 22:26:16 PDT 2016
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip

0 commit comments

Comments
 (0)