Skip to content

Commit

Permalink
Clean up build.gradle (GoogleContainerTools#3497)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh authored Nov 10, 2021
1 parent 1f82812 commit d6a11a4
Showing 1 changed file with 47 additions and 62 deletions.
109 changes: 47 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,67 @@
// define all versioned plugins here and apply in subprojects as necessary without version
plugins {
id 'com.github.sherter.google-java-format' version '0.9' apply false
id 'net.ltgt.apt' version '0.21' apply false
id 'net.ltgt.errorprone' version '2.0.2' apply false
id 'net.researchgate.release' version '2.8.1' apply false
id 'com.gradle.plugin-publish' version '0.16.0' apply false
id 'io.freefair.maven-plugin' version '5.3.3.3' apply false

// apply so we can correctly configure the test runner to be gradle at the project level
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.1'

// apply so that we can collect quality metrics at the root project level
id 'org.sonarqube' version '3.3'
}

// run tests in intellij using gradle test runner
idea.project.settings {
delegateActions {
delegateBuildRunToGradle = false
testRunner = 'GRADLE'
}
}
/* PROJECT DEPENDENCY VERSIONS */
// define all common versioned dependencies here
project.ext.dependencyStrings = [
// For Google libraries, check the following boms for best compatibility.
// - https://github.com/googleapis/java-shared-dependencies
// - https://github.com/googleapis/java-cloud-bom
GOOGLE_HTTP_CLIENT: 'com.google.http-client:google-http-client:1.34.0',
GOOGLE_HTTP_CLIENT_APACHE_V2: 'com.google.http-client:google-http-client-apache-v2:1.34.0',
GOOGLE_AUTH_LIBRARY_OAUTH2_HTTP: 'com.google.auth:google-auth-library-oauth2-http:0.18.0',
GUAVA: 'com.google.guava:guava:31.0.1-jre',
JSR305: 'com.google.code.findbugs:jsr305:3.0.2', // transitively pulled in by GUAVA

// for Build Plan and Jib Plugins Extension API
BUILD_PLAN: 'com.google.cloud.tools:jib-build-plan:0.4.0',
EXTENSION_COMMON: 'com.google.cloud.tools:jib-plugins-extension-common:0.2.0',
GRADLE_EXTENSION: 'com.google.cloud.tools:jib-gradle-plugin-extension-api:0.4.0',
MAVEN_EXTENSION: 'com.google.cloud.tools:jib-maven-plugin-extension-api:0.4.0',

COMMONS_COMPRESS: 'org.apache.commons:commons-compress:1.21',
COMMONS_TEXT: 'org.apache.commons:commons-text:1.9',
JACKSON_DATABIND: 'com.fasterxml.jackson.core:jackson-databind:2.13.0',
JACKSON_DATAFORMAT_YAML: 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.0',
JACKSON_DATATYPE_JSR310: 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0',
ASM: 'org.ow2.asm:asm:9.2',
PICOCLI: 'info.picocli:picocli:4.6.2',

MAVEN_API: 'org.apache.maven:maven-plugin-api:3.8.3',
MAVEN_CORE: 'org.apache.maven:maven-core:3.8.3',
MAVEN_COMPAT: 'org.apache.maven:maven-compat:3.8.3',
MAVEN_PLUGIN_ANNOTATIONS: 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.1',

//test
TRUTH: 'com.google.truth:truth:1.1.3',
TRUTH8: 'com.google.truth.extensions:truth-java8-extension:1.1.3', // should match TRUTH version
JUNIT: 'junit:junit:4.13.2',
JUNIT_PARAMS: 'pl.pragmatists:JUnitParams:1.1.1',
MAVEN_TESTING_HARNESS: 'org.apache.maven.plugin-testing:maven-plugin-testing-harness:3.3.0',
MAVEN_VERIFIER: 'org.apache.maven.shared:maven-verifier:1.7.2',
MOCKITO_CORE: 'org.mockito:mockito-core:4.0.0',
SISU_PLEXUS: 'org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.5',
SLF4J_API: 'org.slf4j:slf4j-api:1.7.30',
SLF4J_SIMPLE: 'org.slf4j:slf4j-simple:1.7.32',
SYSTEM_RULES: 'com.github.stefanbirkner:system-rules:1.19.0',
JBCRYPT: 'org.mindrot:jbcrypt:0.4',
]

import net.ltgt.gradle.errorprone.CheckSeverity

// `java-library` must be applied before `java`
// `java-library` must be applied before `java`.
// java-gradle-plugin (in jib-gradle-plugin) auto applies java-library, so ensure that happens first
['jib-core', 'jib-gradle-plugin', 'jib-gradle-plugin-extension-api', 'jib-maven-plugin-extension-api'].each { projectName ->
project(projectName) {
apply plugin: 'java-library'
}
project(projectName).apply plugin: 'java-library'
}

subprojects {
Expand All @@ -42,7 +74,6 @@ subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'com.github.sherter.google-java-format'
apply plugin: 'net.ltgt.apt'
apply plugin: 'net.ltgt.errorprone'
apply plugin: 'jacoco'

Expand All @@ -52,52 +83,6 @@ subprojects {
compileJava.options.compilerArgs += [ '-Xlint:deprecation' ]
compileTestJava.options.compilerArgs += [ '-Xlint:deprecation' ]

/* PROJECT DEPENDENCY VERSIONS */
// define all common versioned dependencies here
project.ext.dependencyStrings = [
// For Google libraries, check the following boms for best compatibility.
// - https://github.com/googleapis/java-shared-dependencies
// - https://github.com/googleapis/java-cloud-bom
GOOGLE_HTTP_CLIENT: 'com.google.http-client:google-http-client:1.34.0',
GOOGLE_HTTP_CLIENT_APACHE_V2: 'com.google.http-client:google-http-client-apache-v2:1.34.0',
GOOGLE_AUTH_LIBRARY_OAUTH2_HTTP: 'com.google.auth:google-auth-library-oauth2-http:0.18.0',
GUAVA: 'com.google.guava:guava:31.0.1-jre',
JSR305: 'com.google.code.findbugs:jsr305:3.0.2', // transitively pulled in by GUAVA

// for Build Plan and Jib Plugins Extension API
BUILD_PLAN: 'com.google.cloud.tools:jib-build-plan:0.4.0',
EXTENSION_COMMON: 'com.google.cloud.tools:jib-plugins-extension-common:0.2.0',
GRADLE_EXTENSION: 'com.google.cloud.tools:jib-gradle-plugin-extension-api:0.4.0',
MAVEN_EXTENSION: 'com.google.cloud.tools:jib-maven-plugin-extension-api:0.4.0',

COMMONS_COMPRESS: 'org.apache.commons:commons-compress:1.21',
COMMONS_TEXT: 'org.apache.commons:commons-text:1.9',
JACKSON_DATABIND: 'com.fasterxml.jackson.core:jackson-databind:2.13.0',
JACKSON_DATAFORMAT_YAML: 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.0',
JACKSON_DATATYPE_JSR310: 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0',
ASM: 'org.ow2.asm:asm:9.2',
PICOCLI: 'info.picocli:picocli:4.6.2',

MAVEN_API: 'org.apache.maven:maven-plugin-api:3.8.3',
MAVEN_CORE: 'org.apache.maven:maven-core:3.8.3',
MAVEN_COMPAT: 'org.apache.maven:maven-compat:3.8.3',
MAVEN_PLUGIN_ANNOTATIONS: 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.1',

//test
TRUTH: 'com.google.truth:truth:1.1.3',
TRUTH8: 'com.google.truth.extensions:truth-java8-extension:1.1.3', // should match TRUTH version
JUNIT: 'junit:junit:4.13.2',
JUNIT_PARAMS: 'pl.pragmatists:JUnitParams:1.1.1',
MAVEN_TESTING_HARNESS: 'org.apache.maven.plugin-testing:maven-plugin-testing-harness:3.3.0',
MAVEN_VERIFIER: 'org.apache.maven.shared:maven-verifier:1.7.2',
MOCKITO_CORE: 'org.mockito:mockito-core:4.0.0',
SISU_PLEXUS: 'org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.5',
SLF4J_API: 'org.slf4j:slf4j-api:1.7.30',
SLF4J_SIMPLE: 'org.slf4j:slf4j-simple:1.7.32',
SYSTEM_RULES: 'com.github.stefanbirkner:system-rules:1.19.0',
JBCRYPT: 'org.mindrot:jbcrypt:0.4',
]

// Use this to ensure we correctly override transitive dependencies
// TODO: There might be a plugin that does this
task ensureTransitiveDependencyOverrides {
Expand Down

0 comments on commit d6a11a4

Please sign in to comment.