Skip to content

Commit

Permalink
Upgrade Gradle build system in generated library repo and fix setup i…
Browse files Browse the repository at this point in the history
…ssue (#876)

* chore: upgrade Gradle in generated library repo

* chore: update configuration names in .bzl

* chore: fix incorrect sub-project search

* chore: configure publication
  • Loading branch information
chanseokoh committed Dec 3, 2021
1 parent a1fe20f commit 7c76256
Show file tree
Hide file tree
Showing 12 changed files with 325 additions and 336 deletions.
4 changes: 2 additions & 2 deletions rules_java_gapic/java_gapic_pkg.bzl
Expand Up @@ -166,8 +166,8 @@ def _java_gapic_build_configs_pkg_impl(ctx):

substitutions = dict(ctx.attr.static_substitutions)
substitutions["{{extra_deps}}"] = _construct_extra_deps({
"compile": ctx.attr.deps,
"testCompile": ctx.attr.test_deps,
"implementation": ctx.attr.deps,
"testImplementation": ctx.attr.test_deps,
}, substitutions)

for template in ctx.attr.templates.items():
Expand Down
20 changes: 7 additions & 13 deletions rules_java_gapic/resources/gradle/assembly.gradle.tmpl
@@ -1,16 +1,6 @@
buildscript {
repositories {
mavenLocal()
maven {
url 'https://plugins.gradle.org/m2/'
}
mavenCentral()
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'java-library'
apply plugin: 'maven-publish'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -23,7 +13,11 @@ subprojects {
}

repositories {
mavenLocal()
mavenCentral()
mavenLocal()
}

publishing.publications {
library(MavenPublication).from components.java
}
}
33 changes: 9 additions & 24 deletions rules_java_gapic/resources/gradle/client_grpc.gradle.tmpl
@@ -1,32 +1,17 @@
buildscript {
repositories {
mavenCentral()
}
}

apply plugin: 'java'

description = 'GAPIC library for {{name}}'
group = 'com.google.cloud'
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
mavenLocal()
}
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version

compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'

dependencies {
compile 'com.google.api:gax:{{version.gax}}'
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
compile 'com.google.api:gax-grpc:{{version.gax_grpc}}'
testCompile 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
testCompile 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
testCompile '{{maven.junit_junit}}'
implementation 'com.google.api:gax:{{version.gax}}'
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
implementation 'com.google.api:gax-grpc:{{version.gax_grpc}}'
testImplementation 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
testImplementation 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
testImplementation '{{maven.junit_junit}}'
{{extra_deps}}
}

Expand Down Expand Up @@ -56,6 +41,6 @@ clean {
task allJars(type: Copy) {
dependsOn test, jar
into 'all-jars'
// Replace with `from configurations.testRuntime, jar` to include test dependencies
from configurations.runtime, jar
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
from configurations.runtimeOnly, jar
}
37 changes: 11 additions & 26 deletions rules_java_gapic/resources/gradle/client_grpcrest.gradle.tmpl
@@ -1,34 +1,19 @@
buildscript {
repositories {
mavenCentral()
}
}

apply plugin: 'java'

description = 'GAPIC library for {{name}}'
group = 'com.google.cloud'
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
mavenLocal()
}
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version

compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'

dependencies {
compile 'com.google.api:gax:{{version.gax}}'
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
compile 'com.google.api:gax-grpc:{{version.gax_grpc}}'
testCompile 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
compile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
testCompile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
testCompile 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
testCompile '{{maven.junit_junit}}'
implementation 'com.google.api:gax:{{version.gax}}'
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
implementation 'com.google.api:gax-grpc:{{version.gax_grpc}}'
testImplementation 'com.google.api:gax-grpc:{{version.gax_grpc}}:testlib'
implementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
testImplementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
testImplementation 'io.grpc:grpc-netty-shaded:{{version.io_grpc}}'
testImplementation '{{maven.junit_junit}}'
{{extra_deps}}
}

Expand Down Expand Up @@ -58,6 +43,6 @@ clean {
task allJars(type: Copy) {
dependsOn test, jar
into 'all-jars'
// Replace with `from configurations.testRuntime, jar` to include test dependencies
from configurations.runtime, jar
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
from configurations.runtimeOnly, jar
}
31 changes: 8 additions & 23 deletions rules_java_gapic/resources/gradle/client_rest.gradle.tmpl
@@ -1,31 +1,16 @@
buildscript {
repositories {
mavenCentral()
}
}

apply plugin: 'java'

description = 'GAPIC library for {{name}}'
group = 'com.google.cloud'
version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
mavenLocal()
}
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version

compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'

dependencies {
compile 'com.google.api:gax:{{version.gax}}'
testCompile 'com.google.api:gax:{{version.gax}}:testlib'
compile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
testCompile 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
testCompile '{{maven.junit_junit}}'
implementation 'com.google.api:gax:{{version.gax}}'
testImplementation 'com.google.api:gax:{{version.gax}}:testlib'
implementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}'
testImplementation 'com.google.api:gax-httpjson:{{version.gax_httpjson}}:testlib'
testImplementation '{{maven.junit_junit}}'
{{extra_deps}}
}

Expand Down Expand Up @@ -55,6 +40,6 @@ clean {
task allJars(type: Copy) {
dependsOn test, jar
into 'all-jars'
// Replace with `from configurations.testRuntime, jar` to include test dependencies
from configurations.runtime, jar
// Replace with `from configurations.testRuntimeOnly, jar` to include test dependencies
from configurations.runtimeOnly, jar
}
Binary file not shown.
@@ -1,6 +1,5 @@
#Mon May 02 22:26:16 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip

0 comments on commit 7c76256

Please sign in to comment.