diff --git a/.gitignore b/.gitignore
index 7d9acc3bab..0e2b2801f1 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
build
target
out
+bin
*.iml
*.ipr
*.iws
diff --git a/.travis.yml b/.travis.yml
index c5ac8dab8d..d56ac09d63 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,11 +16,7 @@ env:
install: true
script:
-- (cd jib-core; ./gradlew --stacktrace build)
-- (cd jib-plugins-common; ./gradlew --stacktrace build)
-- (cd jib-gradle-plugin; ./gradlew --stacktrace build)
-# unset _JAVA_OPTIONS to avoid spurious test failures
-- (cd jib-maven-plugin; unset _JAVA_OPTIONS; ./mvnw -B verify -U)
+- ./gradlew clean build --stacktrace
# cobbled together from
# https://docs.travis-ci.com/user/languages/java/#projects-using-gradle
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c21937c098..a0cddb60ae 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,7 @@ just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
-Agreement. You (or your employer) retain the copyright to your contribution;
+Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to to see
your current agreements on file or to sign a new one.
@@ -17,16 +17,19 @@ again.
## Building Jib
-Jib comes as 3 components:
+Jib comes as 3 public components:
- - `jib-core`: a library
- - `jib-plugins-common`: a library with helpers for plugin builders
+ - `jib-core`: a library for building containers
- `jib-maven-plugin`: a Maven plugin that uses `jib-core` and `jib-plugins-common`
- `jib-gradle-plugin`: a Gradle plugin that uses `jib-core` and `jib-plugins-common`
-To build, use the provided `build.sh` which builds and tests each of the
-components into your local `~/.m2/repository`. Note that this script does
-not run integration tests.
+And 1 internal component:
+
+ - `jib-plugins-common`: a library with helpers for maven/gradle plugins
+
+The project is configured as a single gradle build. Run `./gradlew build` to build the
+whole project. Run `./gradlew install` to install all public components into the
+local maven repository.
## Code Reviews
@@ -40,10 +43,7 @@ not run integration tests.
3. We follow our own [Java style guide](STYLE_GUIDE.md) that extends the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
3. Please include unit tests (and integration tests if applicable) for all new code.
4. Make sure all existing tests pass (but see the note below about integration tests).
- * In `jib-core`, run `./gradlew clean goJF build integrationTest`
- * In `jib-gradle-plugin`, run `./gradlew clean goJF build integrationTest`
- * In `jib-plugins-common`, run `./gradlew clean goJF build`
- * In `jib-maven-plugin`, run `./mvnw clean fmt:format verify -PintegrationTest`
+ * run `./gradlew clean goJF build integrationTest`
5. Associate the change with an existing issue or file a [new issue](../../issues).
6. Create a pull request!
@@ -63,56 +63,29 @@ integration tests will create local registries on ports 5000 and 6000.
## Configuring Eclipse
-Jib is a mix of Gradle and Maven projects. But since we do not
-publish all artifacts, we instead have the projects reference
-source from their dependencies directly using `sourceSets` and
-`build-helper-maven-plugin`. This complicates importing these projects
-as the Gradle and Maven tooling for Eclipse faithfully replicate the
-direct source references. This has a side-effect that classes
-appear both in the originating project _and_ in the subprojects,
-and can interfere with Eclipse's incremental compilation.
-
-The following instructions first import the projects, and then replaces
-the source-set-style references to use Eclipse's project references
-instead.
+Although jib is a mix of Gradle and Maven projects, we build everything using one
+unifed gradle build. There is special code to include some projects directly as
+source, but importing your project should be pretty straight forward.
1. Ensure you have installed the Gradle tooling for Eclipse, called
_Buildship_ (available from [the Eclipse
Marketplace](https://marketplace.eclipse.org/content/buildship-gradle-integration)).
- 2. **Import the Maven project:** Use _File → Open Projects from File System..._
- to use the Eclipe Smart Import feature and specify the root of the Jib project.
- Import the `jib-maven-plugin` project.
- 3. **Import the Gradle projects:** Buildship does [not yet support
+ 1. **Import the Gradle project:** Buildship does [not yet support
Eclipse Smart Import](https://github.com/eclipse/buildship/issues/356).
Use _File → Import → Gradle → Existing Gradle Project_
- and import each of `jib-core`, `jib-plugins-common`, and `jib-gradle-plugin`.
- 4. **Turn source-set references to project references:** For each of
- `jib-plugins-common`, `jib-maven-plugin`, and `jib-gradle-plugin`:
- - Right-click on the correponding project and select _Properties → Java Build Path_
- - Open the _Source_ panel and remove all _linked_ source folders: these are like
- symbolic links to other locations and appear like
- `jib-plugins-common/main-java - /path/to/jib-core/src/main/java`.
- Only folders within the project should remain when complete.
- - you may wish to remove `jib-gradle-plugin`'s `src/test/resources` and
- `src/integration-test/resources` too as these contain test projects,
- and are not linked in as separate projects and so seem have compilation errors
- - Open the _Projects_ panel and click _Add_ to select the dependencies:
- - `jib-plugins-common` depends on `jib-core`
- - `jib-maven-plugin` depends on `jib-core` and `jib-plugins-common`
- - `jib-gradle-plugin` depends on `jib-core` and `jib-plugins-common`
+ and import `jib`.
Note that you will likely need to re-apply these changes whenever
you refresh or update these projects.
## Debugging the Jib Maven Plugin (`jib-maven-plugin`)
-### Build and use a local snapshot
+### Build and use a local snapshot
To use a local build of the `jib-maven-plugin`:
1. Build and install `jib-maven-plugin` into your local `~/.m2/repository`
- with `(cd jib-maven-plugin && ./mvnw install)`; this also builds `jib-core`.
- Alternatively, use the provided `build.sh` which performs an `install`.
+ with `./gradlew jib-maven-plugin:install`;
1. Modify your test project's `pom.xml` to reference the `-SNAPSHOT`
version of the `com.google.cloud.tools.jib` plugin.
@@ -120,7 +93,7 @@ If developing from within Eclipse with M2Eclipse (the Maven tooling for Eclipse)
1. Modify your test project's `pom.xml` to reference the `-SNAPSHOT`
version of the `com.google.cloud.tools.jib` plugin.
- 2. Create and launch a _Maven Build_ launch configuration for the
+ 1. Create and launch a _Maven Build_ launch configuration for the
test project, and ensure the _Resolve Workspace artifacts_ is checked.
### Attaching a debugger
@@ -131,13 +104,12 @@ If developing with Eclipse and M2Eclipse (the Maven tooling for Eclipse), just l
## Debugging the Jib Gradle Plugin (`jib-gradle-plugin`)
-### Build and use a local snapshot
+### Build and use a local snapshot
To use a local build of the `jib-gradle-plugin`:
1. Build and install `jib-gradle-plugin` into your local `~/.m2/repository`
- with `(cd jib-gradle-plugin && ./gradlew build install)`; this also builds `jib-core`.
- Alternatively, use the provided `build.sh` which performs an `install`.
+ with `./gradlew jib-gradle-plugin:install`;
1. Modify your test project's `build.gradle` to look like the following:
```groovy
buildscript {
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..e6aa95d4b4
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,348 @@
+// define all versioned plugins here and apply in subprojects as necessary without version
+plugins {
+ id 'com.github.sherter.google-java-format' version '0.8' apply false
+ id 'net.ltgt.apt' version '0.19' apply false
+ id 'net.ltgt.errorprone' version '0.6' apply false
+ id 'net.researchgate.release' version '2.7.0' apply false
+ id 'com.gradle.plugin-publish' version '0.10.1' apply false
+ id 'io.freefair.maven-plugin' version '3.8.1' apply false
+}
+
+import net.ltgt.gradle.errorprone.CheckSeverity
+
+subprojects {
+ group 'com.google.cloud.tools'
+
+ repositories {
+ mavenCentral()
+ }
+
+ apply plugin: 'java'
+ apply plugin: 'checkstyle'
+ apply plugin: 'com.github.sherter.google-java-format'
+ apply plugin: 'net.ltgt.apt'
+ apply plugin: 'net.ltgt.errorprone'
+
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ compileJava.options.encoding = 'UTF-8'
+ compileJava.options.compilerArgs += [ '-Xlint:deprecation' ]
+ compileTestJava.options.compilerArgs += [ '-Xlint:deprecation' ]
+
+ /* PROJECT DEPENDENCY VERSIONS */
+ // define all common versioned dependencies here
+ project.ext.dependencyVersions = [
+ // For Google libraries, check , , ,
+ // ... in https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/pom.xml
+ // for best compatibility.
+ GOOGLE_HTTP_CLIENT: '1.31.0',
+ GOOGLE_HTTP_CLIENT_APACHE_V2: '1.31.0',
+ GOOGLE_AUTH_LIBRARY_OAUTH2_HTTP: '0.16.2',
+ GUAVA: '28.0-jre',
+
+ // TODO: remove once https://github.com/googleapis/google-http-java-client/issues/795 is fixed and released.
+ // Forcing to downgrade this to 4.5.6 fixes https://github.com/GoogleContainerTools/jib/issues/1914
+ // However, #795 and upgrading httpclient alone may not fix #1914. We may need to explicitly disable URI
+ // normalization as discussed in #795.
+ APACHE_HTTP_CLIENT_OVERRIDE: '4.5.6',
+ COMMONS_COMPRESS: '1.18',
+ JACKSON_DATABIND: '2.9.9.2',
+ ASM: '7.0',
+
+ //test
+ JUNIT: '4.12',
+ MOCKITO_CORE: '2.23.4',
+ SLF4J_API: '1.7.25',
+ SYSTEM_RULES: '1.19.0',
+ ]
+
+ // Use this to ensure we correctly override transitive dependencies
+ // TODO: There might be a plugin that does this
+ task ensureTransitiveDependencyOverrides {
+ def rules = ["httpclient": dependencyVersions.APACHE_HTTP_CLIENT_OVERRIDE]
+ doLast {
+ configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+ def dependency = artifact.moduleVersion.id
+ if (rules[dependency.name] && rules[dependency.name] != dependency.version) {
+ throw new GradleException(
+ dependency.name + " version error in " + project
+ + ", expected:" + rules[dependency.name]
+ + ", found:" + dependency.version);
+ }
+ }
+ }
+ }
+ compileJava.dependsOn ensureTransitiveDependencyOverrides
+ /* PROJECT DEPENDENCY VERSIONS */
+
+ /* NULLAWAY */
+ dependencies {
+ // NullAway errorprone plugin
+ annotationProcessor 'com.uber.nullaway:nullaway:0.6.4'
+ errorprone 'com.google.errorprone:error_prone_core:2.3.2'
+ // Using github.com/google/error-prone-javac is required when running on
+ // JDK 8. Remove when migrating to JDK 11.
+ if (System.getProperty("java.version").startsWith("1.8.")) {
+ errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
+ }
+ }
+
+ // Adds NullAway errorprone checks.
+ tasks.withType(JavaCompile) {
+ if (!name.toLowerCase().contains("test")) {
+ options.errorprone {
+ check('NullAway', CheckSeverity.ERROR)
+ option('NullAway:ExcludedFieldAnnotations', 'org.apache.maven.plugins.annotations.Component')
+ option('NullAway:AnnotatedPackages', 'com.google.cloud.tools')
+ }
+ }
+ }
+ /* NULLAWAY */
+
+ /* GOOGLE JAVA FORMAT */
+ googleJavaFormat {
+ toolVersion = '1.6'
+ }
+ check.dependsOn verifyGoogleJavaFormat
+ /* GOOGLE JAVA FORMAT */
+
+ /* CHECKSTYLE */
+ checkstyle {
+ toolVersion = '8.18'
+
+ // get the google_checks.xml file from the checkstyle jar and take out the java checks
+ def googleChecks = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml').asString()
+ def fileExtensionsBefore = ''
+ def fileExtensionsAfter = ''
+ def googleChecksNoJava = googleChecks.replace(fileExtensionsBefore, fileExtensionsAfter)
+ assert !googleChecks.equals(googleChecksNoJava)
+
+ config = resources.text.fromString(googleChecksNoJava)
+
+ maxErrors = 0
+ maxWarnings = 0
+ }
+ /* CHECKSTYLE */
+
+ /* TEST CONFIG */
+ tasks.withType(Test) {
+ reports.html.setDestination file("${reporting.baseDir}/${name}")
+ }
+
+ test {
+ testLogging {
+ showStandardStreams = true
+ exceptionFormat = 'full'
+ }
+ }
+ // jar to export tests classes for import in other project by doing:
+ // testCompile project(path:':project-name', configuration:'tests')
+ task testJar(type: Jar) {
+ from sourceSets.test.output.classesDirs
+ classifier = 'tests'
+ }
+ // to import resources do: sourceSets.test.resources.srcDirs project(':project-name').sourceSets.test.resources
+
+ configurations {
+ tests
+ }
+
+ artifacts {
+ tests testJar
+ }
+ /* TEST CONFIG */
+
+ /* INTEGRATION TESTS */
+ sourceSets {
+ integrationTest {
+ java.srcDir file('src/integration-test/java')
+ resources.srcDir file('src/integration-test/resources')
+ }
+ }
+
+ configurations {
+ integrationTestImplementation.extendsFrom testImplementation
+ integrationTestRuntime.extendsFrom testRuntime
+ }
+
+ dependencies {
+ integrationTestImplementation sourceSets.main.output
+ integrationTestImplementation sourceSets.test.output
+ integrationTestImplementation configurations.compile
+ integrationTestImplementation configurations.testImplementation
+ integrationTestImplementation configurations.runtime
+ integrationTestImplementation configurations.testRuntime
+ }
+
+ // Integration tests must be run explicitly
+ task integrationTest(type: Test) {
+ testClassesDirs = sourceSets.integrationTest.output.classesDirs
+ classpath = sourceSets.integrationTest.runtimeClasspath
+ systemProperty '_JIB_DISABLE_USER_AGENT', true
+ }
+ integrationTest.dependsOn test
+
+ task integrationTestJar(type: Jar) {
+ from sourceSets.integrationTest.output.classesDirs
+ classifier = 'integration-tests'
+ }
+
+ configurations {
+ integrationTests
+ }
+
+ artifacts {
+ integrationTests integrationTestJar
+ }
+ /* INTEGRATION TESTS */
+
+ /* JAVADOC ENFORCEMENT */
+ // Fail build on javadoc warnings
+ tasks.withType(Javadoc) {
+ options.addBooleanOption('Xwerror', true)
+ }
+ assemble.dependsOn javadoc
+ /* JAVADOC ENFORCEMENT */
+
+ /* JAR */
+ jar {
+ manifest {
+ attributes 'Implementation-Title': project.name,
+ 'Implementation-Version': version,
+ 'Built-By': System.getProperty('user.name'),
+ 'Built-Date': new Date(),
+ 'Built-JDK': System.getProperty('java.version'),
+ 'Built-Gradle': gradle.gradleVersion
+ }
+ }
+ /* JAR */
+
+ /* MAVEN CENTRAL RELEASES */
+ // for projects that release to maven central
+ project.ext.configureMavenRelease = {
+ apply plugin: 'maven-publish'
+ task sourceJar(type: Jar) {
+ from sourceSets.main.allJava
+ classifier 'sources'
+ }
+
+ task javadocJar(type: Jar, dependsOn: javadoc) {
+ from javadoc.destinationDir
+ classifier 'javadoc'
+ }
+
+ publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ pom {
+ // to be filled by subproject after calling configure configureMavenRelease
+ // name = ''
+ // description = ''
+
+ url = 'https://github.com/GoogleContainerTools/jib'
+ inceptionYear = '2018'
+
+ licenses {
+ license {
+ name = 'The Apache License, Version 2.0'
+ url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution = 'repo'
+ }
+ }
+ developers {
+ developer {
+ id = 'chanseokoh'
+ name = 'Chanseok Oh'
+ email = 'chanseok@google.com'
+ }
+ developer {
+ id = 'loosebazooka'
+ name = 'Appu Goundan'
+ email = 'appu@google.com'
+ }
+ developer {
+ id = 'TadCordle'
+ name = 'Tad Cordle'
+ email = 'tcordle@google.com'
+ }
+ developer {
+ id = 'briandealwis'
+ name = 'Brian de Alwis'
+ email = 'bdealwis@google.com'
+ }
+ developer {
+ id = 'coollog'
+ name = 'Qingyang Chen'
+ }
+ }
+ scm {
+ url = 'https://github.com/GoogleContainerTools/jib'
+ connection = 'scm:https://github.com/GoogleContainerTools/jib.git'
+ developerConnection = 'scm:git://github.com/GoogleContainerTools/jib.git'
+ }
+ }
+ }
+ }
+ }
+ generatePomFileForMavenJavaPublication {
+ destination = file("${project.buildDir}/pom/${project.name}-${project.version}.pom")
+ }
+ // define a special install task that handles installing locally for manual testing
+ task install {
+ dependsOn publishToMavenLocal
+ }
+
+ // For kokoro sign and release to maven central
+ task prepareRelease(type: Copy) {
+ from jar
+ from sourceJar
+ from javadocJar
+ from generatePomFileForMavenJavaPublication
+ into "${project.buildDir}/release-artifacts"
+ dependsOn build
+ dependsOn cleanPrepareRelease
+ }
+ }
+ /* MAVEN CENTRAL RELEASE */
+
+ /* INCLUDED PROJECT DEPENDENCY HELPER */
+ // to keep track of all source projects
+ project.ext.sourceProjects = []
+ // sourceProject(Project) accepts a project and adds it as a dependency in a special manner:
+ // 1. add the project classes as "compileOnly" and make it available to tests in "testImplementation"
+ // 2. add the project's depedencies as "implementation"
+ // 3. remove any transitive reference of any sourceProject depenency that may have appeared
+ // 4. add the project's classes to the final jar
+ // Other nice effects (vs shadowJar)
+ // 1. Generated poms will be correct
+ // 2. Configuration is isolated to this single "sourceProject" call
+ // 3. These configurations are compliant with IDEs
+ project.ext.sourceProject = { Project dependencyProject ->
+ def dependencyProjectClasses = dependencyProject.sourceSets.main.output
+ dependencies {
+ // add the dependencyProject classes as compileOnly, make it available to tests
+ compileOnly(dependencyProject) { transitive = false }
+ testImplementation dependencyProjectClasses
+ // add dependencyProject's dependencies as implementation dependencies
+ implementation dependencyProject.configurations.implementation.dependencies
+ if (dependencyProject.configurations.hasProperty('api')) {
+ implementation dependencyProject.configurations.api.dependencies
+ }
+ // if we find any project dependencies that are brought in transitively, go remove them
+ project.sourceProjects.each { projectToRemove ->
+ project.configurations.implementation.dependencies.remove projectToRemove
+ }
+ }
+ // keep track of all dependencyProjects for later removal
+ sourceProjects += dependencyProject
+ // adds dependencyProject's classes to jar (fat jar-esque)
+ jar {
+ from dependencyProjectClasses
+ }
+ // also configure the java-gradle-plugin if necessary
+ if (project.hasProperty("gradlePlugin")) {
+ project.tasks.pluginUnderTestMetadata.pluginClasspath.from dependencyProjectClasses
+ }
+ }
+ /* INCLUDED PROJECT DEPENDENCY HELPER */
+}
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 33ba046a21..0000000000
--- a/build.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/sh
-# Build Jib
-
-quickMode=false
-mavenOptions=""
-gradleOptions=""
-dryRun=""
-
-usage()
-{
- eval 1>&2
- echo "Simple builder for Jib for jib-core, jib-plugins-common, jib-maven-plugin, and jib-gradle-plugin"
- echo "use: $0 [-qe] [clean | core | plugins | maven | gradle | it | format]"
- echo " providing no target is the same as 'core plugins gradle maven'"
- echo " -q quick mode: skip tests, formatting"
- echo " -e show error information (mvn: -e, gradle: --stacktrace --info)"
- echo " -n dry run: show what will be performed"
- exit 1
-}
-
-# doBuild: Run a command in a directory
-# $1 = directory
-# $2... = build command
-doBuild() {
- (directory="$1"; shift; echo ">>> (cd $directory; $*)"; [ -z "$dryRun" ] && cd "$directory" && eval '"$@"')
-}
-
-while getopts qen c; do
- case $c in
- q) quickMode=true;;
- e) mavenOptions="$mavenOptions -e"
- gradleOptions="$gradleOptions --stacktrace --info"
- ;;
- n) dryRun=true;;
- \?) usage;;
- esac
-done
-shift $( expr $OPTIND - 1 )
-
-if [ $# -eq 0 ]; then
- set -- core plugins gradle maven
-fi
-
-set -o errexit # exit on error
-for target in "$@"; do
- case "$target" in
- clean)
- doBuild jib-core ./gradlew $gradleOptions clean
- doBuild jib-plugins-common ./gradlew $gradleOptions clean
- doBuild jib-gradle-plugin ./gradlew $gradleOptions clean
- doBuild jib-maven-plugin ./mvnw $mavenOptions clean
- ;;
-
- core)
- if [ "$quickMode" = false ]; then
- doBuild jib-core ./gradlew $gradleOptions googleJavaFormat build
- else
- doBuild jib-core ./gradlew $gradleOptions build \
- --exclude-task test --exclude-task check
- fi
- ;;
-
- plugins)
- if [ "$quickMode" = false ]; then
- doBuild jib-plugins-common ./gradlew $gradleOptions googleJavaFormat build
- else
- doBuild jib-plugins-common ./gradlew $gradleOptions build \
- --exclude-task test --exclude-task check
- fi
- ;;
-
- maven)
- if [ "$quickMode" = false ]; then
- doBuild jib-maven-plugin ./mvnw $mavenOptions fmt:format install -U
- else
- # jib-maven-plugin pulls in jib-core directly
- doBuild jib-maven-plugin ./mvnw $mavenOptions -Dcheckstyle.skip -Dfmt.skip -DskipTests install -U
- fi
- ;;
-
- gradle)
- if [ "$quickMode" = false ]; then
- doBuild jib-gradle-plugin ./gradlew $gradleOptions googleJavaFormat build install
- else
- # jib-gradle-plugin pulls in jib-core directly
- doBuild jib-gradle-plugin ./gradlew $gradleOptions build install \
- --exclude-task test --exclude-task check
- fi
- ;;
-
- it)
- doBuild jib-core ./gradlew $gradleOptions integrationTest
- doBuild jib-maven-plugin ./mvnw $mavenOptions -PintegrationTest verify -U
- doBuild jib-gradle-plugin ./gradlew $gradleOptions integrationTest
- ;;
-
- format)
- doBuild jib-core ./gradlew googleJavaFormat
- doBuild jib-plugins-common ./gradlew googleJavaFormat
- doBuild jib-gradle-plugin ./gradlew googleJavaFormat
- doBuild jib-maven-plugin ./mvnw fmt:format
- ;;
- esac
-done
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..87b738cbd0
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/jib-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
similarity index 91%
rename from jib-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
rename to gradle/wrapper/gradle-wrapper.properties
index e0b3fb8d70..44e7c4d1d7 100644
--- a/jib-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/jib-plugins-common/gradlew b/gradlew
similarity index 99%
rename from jib-plugins-common/gradlew
rename to gradlew
index cccdd3d517..af6708ff22 100755
--- a/jib-plugins-common/gradlew
+++ b/gradlew
@@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
diff --git a/jib-core/gradlew.bat b/gradlew.bat
similarity index 98%
rename from jib-core/gradlew.bat
rename to gradlew.bat
index f9553162f1..6d57edc706 100644
--- a/jib-core/gradlew.bat
+++ b/gradlew.bat
@@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/jib-core/build.gradle b/jib-core/build.gradle
index ff02b8c97c..dd158cd31f 100644
--- a/jib-core/build.gradle
+++ b/jib-core/build.gradle
@@ -1,87 +1,29 @@
plugins {
- id 'java-library'
- id 'checkstyle'
- id 'com.github.sherter.google-java-format' version '0.8'
- id 'net.ltgt.apt' version '0.19'
- id 'net.ltgt.errorprone' version '0.6'
- id 'biz.aQute.bnd.builder' version '4.0.0'
-
- // For release.
- id 'maven'
- id 'net.researchgate.release' version '2.7.0'
-}
-
-group 'com.google.cloud.tools'
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-compileJava.options.compilerArgs += [ '-Xlint:deprecation' ]
-compileTestJava.options.compilerArgs += [ '-Xlint:deprecation' ]
-
-repositories {
- mavenCentral()
-}
-
-sourceSets {
- integrationTest {
- java.srcDir file('src/integration-test/java')
- resources.srcDir file('src/integration-test/resources')
- }
-}
-
-configurations {
- integrationTestImplementation.extendsFrom testImplementation
- integrationTestRuntime.extendsFrom testRuntime
+ id 'net.researchgate.release'
+ id 'maven-publish'
}
dependencies {
- // Make sure these are consistent with jib-maven-plugin.
-
- // For Google libraries, check , , ,
- // ... in https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/pom.xml
- // for best compatibility.
- //
- // TODO: remove once https://github.com/googleapis/google-http-java-client/issues/795 is fixed and released.
- // Forcing to downgrade this to 4.5.6 fixes https://github.com/GoogleContainerTools/jib/issues/1914
- // However, #795 and upgrading httpclient alone may not fix #1914. We may need to explicitly disable URI
- // normalization as discussed in #795.
- implementation('com.google.http-client:google-http-client:1.31.0') {
+ implementation("com.google.http-client:google-http-client:${dependencyVersions.GOOGLE_HTTP_CLIENT}") {
exclude group: "org.apache.httpcomponents", module: "httpclient"
}
- implementation('com.google.http-client:google-http-client-apache-v2:1.31.0') {
+ implementation("com.google.http-client:google-http-client-apache-v2:${dependencyVersions.GOOGLE_HTTP_CLIENT_APACHE_V2}") {
exclude group: "org.apache.httpcomponents", module: "httpclient"
}
- implementation('com.google.auth:google-auth-library-oauth2-http:0.16.2') {
+ implementation("com.google.auth:google-auth-library-oauth2-http:${dependencyVersions.GOOGLE_AUTH_LIBRARY_OAUTH2_HTTP}") {
exclude group: "org.apache.httpcomponents", module: "httpclient"
}
- implementation 'org.apache.httpcomponents:httpclient:4.5.6'
- implementation 'com.google.guava:guava:28.0-jre'
+ implementation "org.apache.httpcomponents:httpclient:${dependencyVersions.APACHE_HTTP_CLIENT_OVERRIDE}"
- implementation 'org.apache.commons:commons-compress:1.18'
- implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9.2'
- implementation 'org.ow2.asm:asm:7.0'
+ implementation "org.apache.commons:commons-compress:${dependencyVersions.COMMONS_COMPRESS}"
+ implementation "com.google.guava:guava:${dependencyVersions.GUAVA}"
+ implementation "com.fasterxml.jackson.core:jackson-databind:${dependencyVersions.JACKSON_DATABIND}"
+ implementation "org.ow2.asm:asm:${dependencyVersions.ASM}"
- testImplementation 'junit:junit:4.12'
- testImplementation 'org.mockito:mockito-core:2.23.4'
- testImplementation 'org.slf4j:slf4j-api:1.7.25'
- testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
-
- // NullAway errorprone plugin
- annotationProcessor 'com.uber.nullaway:nullaway:0.6.4'
- errorprone 'com.google.errorprone:error_prone_core:2.3.2'
- // Using github.com/google/error-prone-javac is required when running on
- // JDK 8. Remove when migrating to JDK 11.
- if (System.getProperty("java.version").startsWith("1.8.")) {
- errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
- }
-
- integrationTestCompile sourceSets.main.output
- integrationTestCompile sourceSets.test.output
- integrationTestCompile configurations.compile
- integrationTestCompile configurations.testCompile
- integrationTestCompile configurations.runtime
- integrationTestCompile configurations.testRuntime
+ testImplementation "junit:junit:${dependencyVersions.JUNIT}"
+ testImplementation "org.mockito:mockito-core:${dependencyVersions.MOCKITO_CORE}"
+ testImplementation "org.slf4j:slf4j-api:${dependencyVersions.SLF4J_API}"
+ testImplementation "com.github.stefanbirkner:system-rules:${dependencyVersions.SYSTEM_RULES}"
}
jar {
@@ -99,149 +41,21 @@ jar {
}
}
-// Integration tests must be run explicitly
-task integrationTest(type: Test) {
- testClassesDirs = sourceSets.integrationTest.output.classesDirs
- classpath = sourceSets.integrationTest.runtimeClasspath
- systemProperty '_JIB_DISABLE_USER_AGENT', true
-}
-integrationTest.dependsOn test
-
-test {
- testLogging {
- showStandardStreams = true
- exceptionFormat = 'full'
- }
-}
-
-import net.ltgt.gradle.errorprone.CheckSeverity
-
-// Adds NullAway errorprone checks.
-tasks.withType(JavaCompile) {
- if (!name.toLowerCase().contains("test")) {
- options.errorprone {
- check('NullAway', CheckSeverity.ERROR)
- option('NullAway:AnnotatedPackages', 'com.google.cloud.tools')
- }
- }
-}
-
-// Fail build on javadoc warnings
-tasks.withType(Javadoc) {
- options.addBooleanOption('Xwerror', true)
-}
-assemble.dependsOn javadoc
-
-tasks.withType(Test) {
- reports.html.setDestination file("${reporting.baseDir}/${name}")
-}
-
-/* GOOGLE JAVA FORMAT */
-googleJavaFormat {
- toolVersion = '1.6'
-}
-check.dependsOn verifyGoogleJavaFormat
-/* GOOGLE JAVA FORMAT */
-
-/* CHECKSTYLE */
-checkstyle {
- toolVersion = '8.18'
-
- // get the google_checks.xml file from the checkstyle jar and take out the java checks
- def googleChecks = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml').asString()
- def fileExtensionsBefore = ''
- def fileExtensionsAfter = ''
- def googleChecksNoJava = googleChecks.replace(fileExtensionsBefore, fileExtensionsAfter)
- assert !googleChecks.equals(googleChecksNoJava)
-
- config = resources.text.fromString(googleChecksNoJava)
-
- maxErrors = 0
- maxWarnings = 0
-}
-/* CHECKSTYLE */
+configureMavenRelease()
/* RELEASE */
-task sourceJar(type: Jar) {
- from sourceSets.main.allJava
- classifier 'sources'
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- from javadoc.destinationDir
- classifier 'javadoc'
-}
-
-task writePom {
- project.afterEvaluate {
- def outputFile = file("${project.buildDir}/pom/${project.name}-${project.version}.pom")
- outputs.file outputFile
-
- doLast {
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
pom {
- project {
- name 'Jib Core'
- description 'Build container images.'
- url 'https://github.com/GoogleContainerTools/jib'
- inceptionYear '2018'
-
- scm {
- url 'https://github.com/GoogleContainerTools/jib'
- connection 'scm:https://github.com/GoogleContainerTools/jib.git'
- developerConnection 'scm:git://github.com/GoogleContainerTools/jib.git'
- }
-
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
-
- developers {
- developer {
- id 'coollog'
- name 'Qingyang Chen'
- email 'qingyangc@google.com'
- }
- developer {
- id 'loosebazooka'
- name 'Appu Goundan'
- email 'appu@google.com'
- }
- developer {
- id 'TadCordle'
- name 'Tad Cordle'
- email 'tcordle@google.com'
- }
- developer {
- id 'chanseokoh'
- name 'Chanseok Oh'
- email 'chanseok@google.com'
- }
- developer {
- id 'briandealwis'
- name 'Brian de Alwis'
- email 'bdealwis@google.com'
- }
- }
- }
- }.writeTo(outputFile)
+ name = "Jib Core"
+ description = 'Build container images.'
+ }
+ from components.java
}
}
}
-// For Kokoro sign and releases
-task prepareRelease(type: Copy) {
- from jar
- from sourceJar
- from javadocJar
- from writePom
- into "${project.buildDir}/release-artifacts"
- dependsOn build
- dependsOn cleanPrepareRelease
-}
// Release plugin (git release commits and version updates)
release {
tagTemplate = 'v$version-core'
diff --git a/jib-core/gradle/wrapper/gradle-wrapper.jar b/jib-core/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 29953ea141..0000000000
Binary files a/jib-core/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/jib-core/gradle/wrapper/gradle-wrapper.properties b/jib-core/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index e0b3fb8d70..0000000000
--- a/jib-core/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/jib-core/gradlew b/jib-core/gradlew
deleted file mode 100755
index cccdd3d517..0000000000
--- a/jib-core/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/jib-core/kokoro/release_build.sh b/jib-core/kokoro/release_build.sh
index 44d19b9b0f..f795c4d446 100644
--- a/jib-core/kokoro/release_build.sh
+++ b/jib-core/kokoro/release_build.sh
@@ -5,5 +5,5 @@ set -e
# Display commands to stderr.
set -x
-cd github/jib/jib-core
-./gradlew prepareRelease
+cd github/jib
+./gradlew :jib-core:prepareRelease
diff --git a/jib-core/scripts/prepare_release.sh b/jib-core/scripts/prepare_release.sh
index 120cc81eb0..8fb09d3236 100755
--- a/jib-core/scripts/prepare_release.sh
+++ b/jib-core/scripts/prepare_release.sh
@@ -1,5 +1,5 @@
#!/bin/bash -
-# Usage: ./scripts/prepare_release.sh
+# Usage: ./jib-core/scripts/prepare_release.sh
set -e
@@ -16,7 +16,7 @@ Die() {
}
DieUsage() {
- Die "Usage: ./prepare_release.sh []"
+ Die "Usage: ./jib-core/scripts/prepare_release.sh []"
}
# Usage: CheckVersion
@@ -40,14 +40,14 @@ if [[ $(git status -uno --porcelain) ]]; then
fi
# Runs integration tests.
-./gradlew integrationTest --info --stacktrace
+./gradlew :jib-core:integrationTest --info --stacktrace
# Checks out a new branch for this version release (eg. 1.5.7).
BRANCH=core_release_v${VERSION}
git checkout -b ${BRANCH}
# Changes the version for release and creates the commits/tags.
-echo | ./gradlew release -Prelease.releaseVersion=${VERSION} ${POST_RELEASE_VERSION:+"-Prelease.newVersion=${POST_RELEASE_VERSION}"}
+echo | ./gradlew :jib-core:release -Prelease.releaseVersion=${VERSION} ${POST_RELEASE_VERSION:+"-Prelease.newVersion=${POST_RELEASE_VERSION}"}
# Pushes the release branch and tag to Github.
git push origin ${BRANCH}
diff --git a/jib-gradle-plugin/build.gradle b/jib-gradle-plugin/build.gradle
index 4513a2c180..e3c6b8045b 100644
--- a/jib-gradle-plugin/build.gradle
+++ b/jib-gradle-plugin/build.gradle
@@ -1,176 +1,42 @@
plugins {
id 'java-gradle-plugin'
- id 'checkstyle'
- id 'com.github.sherter.google-java-format' version '0.8'
-
- // For local install
+ id 'net.researchgate.release'
+ id 'com.gradle.plugin-publish'
+ // for local build/test
id 'maven'
-
- // Error-prone checker
- id 'net.ltgt.apt' version '0.19'
- id 'net.ltgt.errorprone' version '0.6'
-
- // Prepare release
- id 'net.researchgate.release' version '2.6.0'
- // Gradle Plugin Portal publish
- id 'com.gradle.plugin-publish' version '0.9.10'
+ // for eclipse import modifications
+ id 'eclipse'
}
-group 'com.google.cloud.tools'
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-
repositories {
- // Use jcenter for gradle plugin portal releases.
+ // because gradle plugin dependencies are pulling from jcenter
jcenter()
}
-sourceSets {
- main {
- java.srcDir file('../jib-core/src/main/java')
- resources.srcDir file('../jib-core/src/main/resources')
- java.srcDir file('../jib-plugins-common/src/main/java')
- resources.srcDir file('../jib-plugins-common/src/main/resources')
- }
- test {
- java.srcDir file('../jib-core/src/test/java')
- resources.srcDir file('../jib-core/src/test/resources')
- java.srcDir file('../jib-plugins-common/src/test/java')
- resources.srcDir file('../jib-plugins-common/src/test/resources')
- }
- integrationTest {
- java {
- compileClasspath += main.output + test.output
- runtimeClasspath += main.output + test.output
- srcDir file('src/integration-test/java')
- srcDir file('../jib-core/src/integration-test/java')
- }
- resources {
- srcDir file('src/integration-test/resources')
- srcDir file('../jib-core/src/integration-test/resources')
- }
- }
-}
-
-configurations {
- integrationTestCompile.extendsFrom testCompile
- integrationTestRuntime.extendsFrom testRuntime
-}
-
dependencies {
- // These are copied over from jib-core and are necessary for the jib-core sourcesets.
- compile('com.google.http-client:google-http-client:1.31.0') {
- exclude group: "org.apache.httpcomponents", module: "httpclient"
- }
- compile('com.google.http-client:google-http-client-apache-v2:1.31.0') {
- exclude group: "org.apache.httpcomponents", module: "httpclient"
- }
- compile('com.google.auth:google-auth-library-oauth2-http:0.16.2') {
- exclude group: "org.apache.httpcomponents", module: "httpclient"
- }
- compile 'org.apache.httpcomponents:httpclient:4.5.6'
- compile 'com.google.guava:guava:28.0-jre'
-
- compile 'org.apache.commons:commons-compress:1.18'
- compile 'com.fasterxml.jackson.core:jackson-databind:2.9.9.2'
- compile 'org.ow2.asm:asm:7.0'
-
- testCompile 'junit:junit:4.12'
- testCompile 'org.mockito:mockito-core:2.23.4'
- testCompile 'org.slf4j:slf4j-api:1.7.25'
- testCompile 'com.github.stefanbirkner:system-rules:1.19.0'
-
- // only for testing a concrete Spring Boot example in a test (not for test infrastructure)
- testCompile 'org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE'
-
- compile gradleApi()
- // NullAway errorprone plugin
- annotationProcessor 'com.uber.nullaway:nullaway:0.6.4'
- errorprone 'com.google.errorprone:error_prone_core:2.3.2'
- // Using github.com/google/error-prone-javac is required when running on
- // JDK 8. Remove when migrating to JDK 11.
- if (System.getProperty("java.version").startsWith("1.8.")) {
- errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
- }
-}
-
-// Integration tests must be run explicitly
-task integrationTest(type: Test) {
- testClassesDirs = sourceSets.integrationTest.output.classesDirs
- classpath = sourceSets.integrationTest.runtimeClasspath
- systemProperty '_JIB_DISABLE_USER_AGENT', true
-}
-integrationTest.dependsOn test
+ sourceProject project(":jib-core")
+ sourceProject project(":jib-plugins-common")
-test {
- testLogging {
- showStandardStreams = true
- exceptionFormat = 'full'
+ implementation ("com.google.http-client:google-http-client:${dependencyVersions.GOOGLE_HTTP_CLIENT}") {
+ exclude group: "org.apache.httpcomponents", module: "httpclient"
}
-}
+ implementation "org.apache.httpcomponents:httpclient:${dependencyVersions.APACHE_HTTP_CLIENT_OVERRIDE}"
-import net.ltgt.gradle.errorprone.CheckSeverity
+ implementation "com.google.guava:guava:${dependencyVersions.GUAVA}"
+ implementation "com.fasterxml.jackson.core:jackson-databind:${dependencyVersions.JACKSON_DATABIND}"
-// Adds NullAway errorprone checks.
-tasks.withType(JavaCompile) {
- if (!name.toLowerCase().contains("test")) {
- options.errorprone {
- check('NullAway', CheckSeverity.ERROR)
- option('NullAway:AnnotatedPackages', 'com.google.cloud.tools')
- }
- }
-}
-
-// Fail build on javadoc warnings
-tasks.withType(Javadoc) {
- options.addBooleanOption('Xwerror', true)
-}
+ testImplementation "junit:junit:${dependencyVersions.JUNIT}"
+ testImplementation "org.mockito:mockito-core:${dependencyVersions.MOCKITO_CORE}"
+ testImplementation "org.slf4j:slf4j-api:${dependencyVersions.SLF4J_API}"
+ testImplementation "com.github.stefanbirkner:system-rules:${dependencyVersions.SYSTEM_RULES}"
-tasks.withType(Test) {
- reports.html.setDestination file("${reporting.baseDir}/${name}")
-}
+ testImplementation project(path:':jib-plugins-common', configuration:'tests')
+ integrationTestImplementation project(path:':jib-core', configuration:'integrationTests')
-/* GOOGLE JAVA FORMAT */
-googleJavaFormat {
- toolVersion = '1.6'
-}
-check.dependsOn verifyGoogleJavaFormat
-/* GOOGLE JAVA FORMAT */
-
-/* CHECKSTYLE */
-checkstyle {
- toolVersion = '8.18'
-
- // get the google_checks.xml file from the checkstyle jar and take out the java checks
- def googleChecks = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml').asString()
- def fileExtensionsBefore = ''
- def fileExtensionsAfter = ''
- def googleChecksNoJava = googleChecks.replace(fileExtensionsBefore, fileExtensionsAfter)
- assert !googleChecks.equals(googleChecksNoJava)
-
- config = resources.text.fromString(googleChecksNoJava)
-
- maxErrors = 0
- maxWarnings = 0
-}
-/* CHECKSTYLE */
-
-/* JAR */
-// Necessary for adding version information into the JAR.
-jar {
- manifest {
- attributes 'Implementation-Title': project.name,
- 'Implementation-Version': version,
- 'Built-By': System.getProperty('user.name'),
- 'Built-Date': new Date(),
- 'Built-JDK': System.getProperty('java.version'),
- 'Built-Gradle': gradle.gradleVersion
- }
+ // only for testing a concrete Spring Boot example in a test (not for test infrastructure)
+ testImplementation 'org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE'
}
-/* JAR */
/* RELEASE */
// Prepare release
@@ -196,3 +62,13 @@ pluginBundle {
}
tasks.publishPlugins.dependsOn integrationTest
/* RELEASE */
+
+/* ECLIPSE */
+eclipse.classpath.file.whenMerged { cp ->
+ cp.entries.each {
+ if (it.path == "src/test/resources" || it.path == "src/integration-test/resources") {
+ it.excludes += "gradle/projects/"
+ }
+ }
+}
+/* ECLIPSE */
diff --git a/jib-gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/jib-gradle-plugin/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 29953ea141..0000000000
Binary files a/jib-gradle-plugin/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/jib-gradle-plugin/gradlew b/jib-gradle-plugin/gradlew
deleted file mode 100755
index cccdd3d517..0000000000
--- a/jib-gradle-plugin/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/jib-gradle-plugin/gradlew.bat b/jib-gradle-plugin/gradlew.bat
deleted file mode 100644
index f9553162f1..0000000000
--- a/jib-gradle-plugin/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/jib-gradle-plugin/scripts/prepare_release.sh b/jib-gradle-plugin/scripts/prepare_release.sh
index 024587e193..da14f408aa 100755
--- a/jib-gradle-plugin/scripts/prepare_release.sh
+++ b/jib-gradle-plugin/scripts/prepare_release.sh
@@ -16,7 +16,7 @@ Die() {
}
DieUsage() {
- Die "Usage: ./scripts/prepare_release.sh []"
+ Die "Usage: ./jib-gradle-plugin/scripts/prepare_release.sh []"
}
# Usage: CheckVersion
@@ -40,14 +40,14 @@ if [[ $(git status -uno --porcelain) ]]; then
fi
# Runs integration tests.
-./gradlew integrationTest --info --stacktrace
+./gradlew jib-gradle-plugin:integrationTest --info --stacktrace
# Checks out a new branch for this version release (eg. 1.5.7).
BRANCH=gradle_release_v${VERSION}
git checkout -b ${BRANCH}
# Changes the version for release and creates the commits/tags.
-echo | ./gradlew release -Prelease.releaseVersion=${VERSION} ${POST_RELEASE_VERSION:+"-Prelease.newVersion=${POST_RELEASE_VERSION}"}
+echo | ./gradlew jib-gradle-plugin:release -Prelease.releaseVersion=${VERSION} ${POST_RELEASE_VERSION:+"-Prelease.newVersion=${POST_RELEASE_VERSION}"}
# Pushes the release branch and tag to Github.
git push origin ${BRANCH}
@@ -57,4 +57,4 @@ git push origin v${VERSION}-gradle
EchoGreen 'File a PR for the new release branch:'
echo https://github.com/GoogleContainerTools/jib/compare/${BRANCH}
-EchoGreen "Once approved and merged, checkout the 'v${VERSION}-gradle' tag and run './gradlew publishPlugins'."
+EchoGreen "Once approved and merged, checkout the 'v${VERSION}-gradle' tag and run './gradlew jib-gradle-plugin:publishPlugins'."
diff --git a/jib-maven-plugin/.mvn/wrapper/maven-wrapper.jar b/jib-maven-plugin/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100755
index f775b1c04c..0000000000
Binary files a/jib-maven-plugin/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/jib-maven-plugin/.mvn/wrapper/maven-wrapper.properties b/jib-maven-plugin/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100755
index a447c9fa81..0000000000
--- a/jib-maven-plugin/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1 +0,0 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
\ No newline at end of file
diff --git a/jib-maven-plugin/build.gradle b/jib-maven-plugin/build.gradle
new file mode 100644
index 0000000000..a821461150
--- /dev/null
+++ b/jib-maven-plugin/build.gradle
@@ -0,0 +1,74 @@
+plugins {
+ id 'io.freefair.maven-plugin'
+ id 'net.researchgate.release'
+ id 'maven-publish'
+ id 'eclipse'
+}
+
+// only maven specific dependencies should be versioned, everything else should be defined by constrains in
+// parent build.gradle
+dependencies {
+ sourceProject project(':jib-plugins-common')
+ sourceProject project(':jib-core')
+
+ implementation 'org.apache.maven:maven-plugin-api:3.5.2'
+ implementation 'org.apache.maven:maven-core:3.5.2'
+
+ // equivalent to "provided"
+ compileOnly 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.5'
+ testImplementation 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.5'
+
+ // maven-plugin-testing-harness pulls in conflicting implementations of DefaultPlexusContainer
+ // (sisu (correct) vs default-plexus-container (wrong)) so ensure this is first in the test classpath
+ testImplementation 'org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.3'
+ testImplementation 'org.apache.maven.plugin-testing:maven-plugin-testing-harness:3.3.0'
+
+ testImplementation "junit:junit:${dependencyVersions.JUNIT}"
+ testImplementation "org.mockito:mockito-core:${dependencyVersions.MOCKITO_CORE}"
+ testImplementation "org.slf4j:slf4j-api:${dependencyVersions.SLF4J_API}"
+ testImplementation "com.github.stefanbirkner:system-rules:${dependencyVersions.SYSTEM_RULES}"
+
+ testImplementation 'org.apache.maven.shared:maven-verifier:1.6'
+ testImplementation 'org.apache.maven:maven-compat:3.5.4'
+
+ testImplementation project(path:':jib-plugins-common', configuration:'tests')
+ integrationTestImplementation project(path:':jib-core', configuration:'integrationTests')
+}
+
+/* TESTING */
+test.dependsOn publishToMavenLocal
+integrationTest.dependsOn publishToMavenLocal
+/* TESTING */
+
+/* RELEASE */
+configureMavenRelease()
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ pom {
+ name = 'Jib'
+ description = 'A Maven plugin for building container images for your Java applications.'
+ }
+ }
+ }
+}
+
+
+release {
+ tagTemplate = 'v$version-gradle'
+ git {
+ requireBranch = /^maven_release_v\d+.*$/ //regex
+ }
+}
+/* RELEASE */
+
+/* ECLIPSE */
+eclipse.classpath.file.whenMerged { cp ->
+ cp.entries.each {
+ if (it.path == "src/test/resources") {
+ it.excludes += "maven/projects/"
+ }
+ }
+}
+/* ECLIPSE */
diff --git a/jib-maven-plugin/gradle.properties b/jib-maven-plugin/gradle.properties
new file mode 100644
index 0000000000..ced16a7bbb
--- /dev/null
+++ b/jib-maven-plugin/gradle.properties
@@ -0,0 +1 @@
+version = 1.5.1-SNAPSHOT
diff --git a/jib-maven-plugin/kokoro/release_build.sh b/jib-maven-plugin/kokoro/release_build.sh
index 6fa083b173..393547a807 100644
--- a/jib-maven-plugin/kokoro/release_build.sh
+++ b/jib-maven-plugin/kokoro/release_build.sh
@@ -5,10 +5,5 @@ set -e
# Display commands to stderr.
set -x
-cd github/jib/jib-maven-plugin
-./mvnw -Prelease -B -U verify
-
-# copy pom with the name expected in the Maven repository
-ARTIFACT_ID=$(mvn -B help:evaluate -Dexpression=project.artifactId 2>/dev/null | grep -v "^\[")
-PROJECT_VERSION=$(mvn -B help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[")
-cp pom.xml target/${ARTIFACT_ID}-${PROJECT_VERSION}.pom
+cd github/jib
+./gradlew :jib-maven-plugin:prepareRelease
diff --git a/jib-maven-plugin/mvnw b/jib-maven-plugin/mvnw
deleted file mode 100755
index e96ccd5fbb..0000000000
--- a/jib-maven-plugin/mvnw
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="`/usr/libexec/java_home`"
- else
- export JAVA_HOME="/Library/Java/Home"
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
- # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=`cd "$wdir/.."; pwd`
- fi
- # end of workaround
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-if [ "$MVNW_VERBOSE" = true ]; then
- echo $MAVEN_PROJECTBASEDIR
-fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/jib-maven-plugin/mvnw.cmd b/jib-maven-plugin/mvnw.cmd
deleted file mode 100755
index 6a6eec39ba..0000000000
--- a/jib-maven-plugin/mvnw.cmd
+++ /dev/null
@@ -1,145 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
diff --git a/jib-maven-plugin/pom.xml b/jib-maven-plugin/pom.xml
deleted file mode 100644
index 0e0e8ab1f2..0000000000
--- a/jib-maven-plugin/pom.xml
+++ /dev/null
@@ -1,504 +0,0 @@
-
-
- 4.0.0
-
- com.google.cloud.tools
- jib-maven-plugin
- 1.5.2-SNAPSHOT
- maven-plugin
-
- Jib
- A tool for building container images for your Java applications.
- https://github.com/GoogleContainerTools/jib
-
-
-
- The Apache License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
-
- coollog
- Qingyang Chen
- qingyangc@google.com
-
-
- loosebazooka
- Appu Goundan
- appu@google.com
-
-
-
-
- scm:git:https://github.com/GoogleContainerTools/jib.git
-
- scm:git:https://github.com/GoogleContainerTools/jib.git
-
- https://github.com/GoogleContainerTools/jib
-
-
-
- UTF-8
- UTF-8
-
- 8
- 8
-
-
-
-
-
- com.google.http-client
- google-http-client
- 1.31.0
- compile
-
-
- com.google.http-client
- google-http-client-apache-v2
- 1.31.0
- compile
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.6
- compile
-
-
- com.google.auth
- google-auth-library-oauth2-http
- 0.16.2
-
-
- com.google.guava
- guava
- 28.0-jre
- compile
-
-
- org.apache.commons
- commons-compress
- 1.18
- compile
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.9.9.2
- compile
-
-
- org.ow2.asm
- asm
- 7.0
- compile
-
-
-
-
- org.apache.maven
- maven-plugin-api
- 3.5.2
-
-
-
-
- org.apache.maven.plugin-tools
- maven-plugin-annotations
- 3.5
- provided
-
-
-
- org.apache.maven
- maven-core
- 3.5.2
-
-
- org.apache.maven.shared
- maven-verifier
- 1.6
-
-
-
- junit
- junit
- 4.12
- test
-
-
- org.mockito
- mockito-core
- 2.23.4
- test
-
-
- org.slf4j
- slf4j-api
- 1.7.25
- test
-
-
- com.github.stefanbirkner
- system-rules
- 1.19.0
- test
-
-
-
- org.apache.maven.plugin-testing
- maven-plugin-testing-harness
- 3.3.0
- test
-
-
- org.apache.maven
- maven-compat
- 3.5.4
- test
-
-
-
-
-
-
-
- integrationTest
-
-
-
- org.apache.maven.plugins
- maven-failsafe-plugin
- 2.22.1
-
- ${project.build.directory}/classes
-
- **/*IntegrationTest.java
-
-
- <_JIB_DISABLE_USER_AGENT>true
-
- false
-
-
-
- integration-test
-
- integration-test
- verify
-
-
-
-
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 3.0.0
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.0.1
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
-
-
-
-
- jdk8
-
- 1.8
-
-
- 9+181-r4173-1
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- -J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar
-
-
-
-
-
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 3.0.0
-
-
-
- add-jib-core-sources
- generate-sources
-
- add-source
-
-
-
-
-
-
-
-
-
- add-jib-core-resources
- generate-sources
-
- add-resource
-
-
-
-
- ${basedir}/../jib-core/src/main/resources
-
-
- ${basedir}/../jib-plugins-common/src/main/resources
-
-
-
-
-
- add-jib-core-test-sources
- generate-test-sources
-
- add-test-source
-
-
-
-
-
-
-
-
-
- add-jib-core-test-resources
- generate-test-sources
-
- add-test-resource
-
-
-
-
- ${basedir}/../jib-core/src/test/resources
-
-
- ${basedir}/../jib-plugins-common/src/test/resources
-
-
-
-
-
- add-jib-core-integration-test-sources
- generate-test-sources
-
- add-test-source
-
-
-
-
-
-
-
-
- add-jib-core-integration-test-resources
- generate-test-sources
-
- add-test-resource
-
-
-
-
- ${basedir}/../jib-core/src/integration-test/resources
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.0
-
-
- compile-with-nullaway
- compile
-
- compile
-
-
-
-
- ${maven.compiler.target}
- true
- true
-
-
- com.google.errorprone
- error_prone_core
- 2.3.2
-
-
- com.uber.nullaway
- nullaway
- 0.6.4
-
-
-
- -XDcompilePolicy=simple
- -Xplugin:ErrorProne -Xep:NullAway:ERROR -XepOpt:NullAway:ExcludedFieldAnnotations=org.apache.maven.plugins.annotations.Component -XepOpt:NullAway:AnnotatedPackages=com.google.cloud.tools
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.22.1
-
-
- **/*IntegrationTest.java
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-plugin-plugin
- 3.6.0
-
-
-
-
- com.coveo
- fmt-maven-plugin
- 2.6.0
-
-
- com.google.googlejavaformat
- google-java-format
- 1.6
-
-
-
-
- validate
-
- check
-
-
-
-
-
-
-
- maven-checkstyle-plugin
- 3.0.0
-
-
- com.puppycrawl.tools
- checkstyle
- 8.18
-
-
-
- true
- true
- warning
-
- {project.build.sourceDirectory}
-
-
-
-
- google-checks
- validate
-
- check
-
-
- config/google-checks-no-indent.xml
-
-
-
- header-check
- validate
-
- check
-
-
- config/checkstyle-header.xml
- config/header-java.txt
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 3.1.0
-
-
-
-
- true
- true
-
-
-
-
-
-
-
-
diff --git a/jib-maven-plugin/scripts/prepare_release.sh b/jib-maven-plugin/scripts/prepare_release.sh
index 23f0133299..a82daa259e 100755
--- a/jib-maven-plugin/scripts/prepare_release.sh
+++ b/jib-maven-plugin/scripts/prepare_release.sh
@@ -1,35 +1,27 @@
#!/bin/bash -
-# Usage: ./scripts/prepare_release.sh []
+# Usage: ./jib-maven-plugin/scripts/prepare_release.sh []
set -e
EchoRed() {
- echo "$(tput setaf 1; tput bold)$1$(tput sgr0)"
+ echo "$(tput setaf 1; tput bold)$1$(tput sgr0)"
}
EchoGreen() {
- echo "$(tput setaf 2; tput bold)$1$(tput sgr0)"
+ echo "$(tput setaf 2; tput bold)$1$(tput sgr0)"
}
Die() {
- EchoRed "$1"
- exit 1
+ EchoRed "$1"
+ exit 1
}
DieUsage() {
- Die "Usage: ./scripts/prepare_release.sh []"
+ Die "Usage: ./jib-maven-plugin/scripts/prepare_release.sh []"
}
# Usage: CheckVersion
CheckVersion() {
- [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+)?$ ]] || Die "Version: $1 not in ###.###.###[-XXX] format."
-}
-
-# Usage: IncrementVersion
-IncrementVersion() {
- local version=$1
- local minorVersion=$(echo $version | sed 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]\)*/\1/')
- local nextMinorVersion=$((minorVersion+1))
- echo $version | sed "s/\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9][0-9]*/\1.$nextMinorVersion/"
+ [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+)?$ ]] || Die "Version: $1 not in ###.###.###[-XXX] format."
}
[ $# -ne 1 ] && [ $# -ne 2 ] && DieUsage
@@ -38,48 +30,28 @@ EchoGreen '===== RELEASE SETUP SCRIPT ====='
VERSION=$1
CheckVersion ${VERSION}
-
if [ -n "$2" ]; then
- NEXT_VERSION=$2
- CheckVersion ${NEXT_VERSION}
-else
- NEXT_VERSION=$(IncrementVersion $VERSION)
- CheckVersion ${NEXT_VERSION}
+ POST_RELEASE_VERSION=$2
+ CheckVersion ${POST_RELEASE_VERSION}
fi
if [[ $(git status -uno --porcelain) ]]; then
- Die 'There are uncommitted changes.'
+ Die 'There are uncommitted changes.'
fi
# Runs integration tests.
-./mvnw -e -PintegrationTest verify
+./gradlew jib-maven-plugin:integrationTest --info --stacktrace
# Checks out a new branch for this version release (eg. 1.5.7).
BRANCH=maven_release_v${VERSION}
git checkout -b ${BRANCH}
-# Updates the pom.xml with the version to release.
-mvn versions:set versions:commit -DnewVersion=${VERSION}
-
-# Tags a new commit for this release.
-TAG=v${VERSION}-maven
-git commit -am "preparing release ${VERSION}"
-git tag ${TAG}
-
-# Updates the pom.xml with the next snapshot version.
-# For example, when releasing 1.5.7, the next snapshot version would be 1.5.8-SNAPSHOT.
-NEXT_SNAPSHOT=${NEXT_VERSION}
-if [[ "${NEXT_SNAPSHOT}" != *-SNAPSHOT ]]; then
- NEXT_SNAPSHOT=${NEXT_SNAPSHOT}-SNAPSHOT
-fi
-mvn versions:set versions:commit -DnewVersion=${NEXT_SNAPSHOT}
-
-# Commits this next snapshot version.
-git commit -am "${NEXT_SNAPSHOT}"
+# Changes the version for release and creates the commits/tags.
+echo | ./gradlew jib-maven-plugin:release -Prelease.releaseVersion=${VERSION} ${POST_RELEASE_VERSION:+"-Prelease.newVersion=${POST_RELEASE_VERSION}"}
-# Pushes the tag and release branch to Github.
+# Pushes the release branch and tag to Github.
git push origin ${BRANCH}
-git push origin ${TAG}
+git push origin v${VERSION}-maven
# File a PR on Github for the new branch. Have someone LGTM it, which gives you permission to continue.
EchoGreen 'File a PR for the new release branch:'
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java
similarity index 96%
rename from jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java
rename to jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java
index 61e1b8e88f..f6aec49feb 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java
+++ b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildDockerMojoIntegrationTest.java
@@ -32,17 +32,12 @@
/** Integration tests for {@link BuildDockerMojo}. */
public class BuildDockerMojoIntegrationTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
-
- @ClassRule
- public static final TestProject emptyTestProject = new TestProject(testPlugin, "empty");
+ @ClassRule public static final TestProject emptyTestProject = new TestProject("empty");
@ClassRule
- public static final TestProject defaultTargetTestProject =
- new TestProject(testPlugin, "default-target");
+ public static final TestProject defaultTargetTestProject = new TestProject("default-target");
private static void buildToDockerDaemon(Path projectRoot, String imageReference, String pomXml)
throws VerificationException, DigestException, IOException {
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
similarity index 97%
rename from jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
rename to jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
index 3fab07385e..9f1fc25e17 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
+++ b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
@@ -56,23 +56,16 @@ public class BuildImageMojoIntegrationTest {
public static final LocalRegistry localRegistry2 =
new LocalRegistry(6000, "testuser2", "testpassword2");
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
+ @ClassRule public static final TestProject emptyTestProject = new TestProject("empty");
- @ClassRule
- public static final TestProject emptyTestProject = new TestProject(testPlugin, "empty");
+ @ClassRule public static final TestProject skippedTestProject = new TestProject("empty");
@ClassRule
- public static final TestProject skippedTestProject = new TestProject(testPlugin, "empty");
+ public static final TestProject defaultTargetTestProject = new TestProject("default-target");
- @ClassRule
- public static final TestProject defaultTargetTestProject =
- new TestProject(testPlugin, "default-target");
-
- @ClassRule
- public static final TestProject servlet25Project = new TestProject(testPlugin, "war_servlet25");
+ @ClassRule public static final TestProject servlet25Project = new TestProject("war_servlet25");
private static String getTestImageReference(String label) {
String nameBase = IntegrationTestingConfiguration.getTestRepositoryLocation() + '/';
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java
similarity index 93%
rename from jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java
rename to jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java
index 03643d68d4..5f13807080 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java
+++ b/jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildTarMojoIntegrationTest.java
@@ -29,13 +29,9 @@
public class BuildTarMojoIntegrationTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
-
- @ClassRule
- public static final TestProject skippedTestProject = new TestProject(testPlugin, "empty");
+ @ClassRule public static final TestProject skippedTestProject = new TestProject("empty");
@Test
public void testExecute_simple()
diff --git a/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldBindingMojo.java b/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldBindingMojo.java
index aa90a7fba6..8d24e2dfa3 100644
--- a/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldBindingMojo.java
+++ b/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldBindingMojo.java
@@ -26,7 +26,6 @@
/** Base class for Skaffold-related goals. */
abstract class SkaffoldBindingMojo extends AbstractMojo {
-
@Nullable
@Parameter(defaultValue = "${plugin}", readonly = true)
protected PluginDescriptor descriptor;
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenRawConfigurationTest.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenRawConfigurationTest.java
index a796fcc415..e881854202 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenRawConfigurationTest.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenRawConfigurationTest.java
@@ -20,6 +20,7 @@
import com.google.cloud.tools.jib.maven.JibPluginConfiguration.FromAuthConfiguration;
import com.google.cloud.tools.jib.plugins.common.AuthProperty;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -101,7 +102,8 @@ public void testGetters() {
Assert.assertEquals(
Arrays.asList("--log", "info"), rawConfiguration.getProgramArguments().get());
Assert.assertEquals(
- new HashSet<>(Arrays.asList("additional", "tags")), rawConfiguration.getToTags());
+ new HashSet<>(Arrays.asList("additional", "tags")),
+ Sets.newHashSet(rawConfiguration.getToTags()));
Assert.assertTrue(rawConfiguration.getUseCurrentTimestamp());
Assert.assertEquals("admin:wheel", rawConfiguration.getUser().get());
Assert.assertEquals("2011-12-03T22:42:05Z", rawConfiguration.getFilesModificationTime());
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestPlugin.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestPlugin.java
deleted file mode 100644
index 59396ec0bd..0000000000
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestPlugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2018 Google LLC.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.cloud.tools.jib.maven;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.apache.maven.it.VerificationException;
-import org.apache.maven.it.Verifier;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.junit.rules.ExternalResource;
-
-/** Sets up the plugin for testing. */
-public class TestPlugin extends ExternalResource {
-
- private String pluginVersion;
-
- String getVersion() {
- return pluginVersion;
- }
-
- @Override
- protected void before() throws IOException, XmlPullParserException, VerificationException {
- // Installs the plugin for use in tests.
- Verifier verifier = new Verifier(".", true);
- verifier.setAutoclean(false);
- verifier.addCliOption("-DskipTests");
- verifier.addCliOption("-Dfmt.skip");
- verifier.addCliOption("-Dcheckstyle.skip");
- verifier.executeGoal("install");
-
- // Reads the project version.
- MavenXpp3Reader reader = new MavenXpp3Reader();
- Model model =
- reader.read(Files.newBufferedReader(Paths.get("pom.xml"), StandardCharsets.UTF_8));
- pluginVersion = model.getVersion();
- }
-}
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestProject.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestProject.java
index 83cb1e655a..649796e459 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestProject.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/TestProject.java
@@ -21,6 +21,8 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.it.util.ResourceExtractor;
@@ -36,14 +38,12 @@ private static boolean isPomXml(Path path) {
return filename.startsWith("pom") && filename.endsWith(".xml");
}
- private final TestPlugin testPlugin;
private final String projectDir;
private Path projectRoot;
/** Initialize to a specific project directory. */
- public TestProject(TestPlugin testPlugin, String projectDir) {
- this.testPlugin = testPlugin;
+ public TestProject(String projectDir) {
this.projectDir = projectDir;
}
@@ -71,12 +71,17 @@ private void copyProject() throws IOException {
.toPath();
// Puts the correct plugin version into the test project pom.xml.
+ Path gradleProperties = Paths.get("gradle.properties");
+ Properties properties = new Properties();
+ properties.load(Files.newInputStream(gradleProperties));
+ String pluginVersion = properties.getProperty("version");
+
try (Stream files = Files.list(projectRoot)) {
for (Path pomXml : files.filter(TestProject::isPomXml).collect(Collectors.toList())) {
Files.write(
pomXml,
new String(Files.readAllBytes(pomXml), StandardCharsets.UTF_8)
- .replace("@@PluginVersion@@", testPlugin.getVersion())
+ .replace("@@PluginVersion@@", pluginVersion)
.getBytes(StandardCharsets.UTF_8));
}
}
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/CheckJibVersionMojoTest.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/CheckJibVersionMojoTest.java
index 2fff0678b7..9181ee1f1c 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/CheckJibVersionMojoTest.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/CheckJibVersionMojoTest.java
@@ -17,7 +17,6 @@
package com.google.cloud.tools.jib.maven.skaffold;
import com.google.cloud.tools.jib.maven.MojoCommon;
-import com.google.cloud.tools.jib.maven.TestPlugin;
import com.google.cloud.tools.jib.maven.TestProject;
import java.io.IOException;
import org.apache.maven.it.VerificationException;
@@ -28,10 +27,8 @@
/** Tests for {@link CheckJibVersionMojo}. */
public class CheckJibVersionMojoTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
@Test
public void testIdentifiers() {
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoTest.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoTest.java
index f35601d6ee..3be6104cce 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoTest.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoTest.java
@@ -16,7 +16,6 @@
package com.google.cloud.tools.jib.maven.skaffold;
-import com.google.cloud.tools.jib.maven.TestPlugin;
import com.google.cloud.tools.jib.maven.TestProject;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
@@ -36,13 +35,9 @@
/** Tests for {@link FilesMojo}. */
public class FilesMojoTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
-
- @ClassRule
- public static final TestProject multiTestProject = new TestProject(testPlugin, "multi");
+ @ClassRule public static final TestProject multiTestProject = new TestProject("multi");
private static void verifyFiles(Path projectRoot, String pomXml, String module, List files)
throws VerificationException, IOException {
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2Test.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2Test.java
index 1fb8c6578c..18cc60cd1b 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2Test.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2Test.java
@@ -16,7 +16,6 @@
package com.google.cloud.tools.jib.maven.skaffold;
-import com.google.cloud.tools.jib.maven.TestPlugin;
import com.google.cloud.tools.jib.maven.TestProject;
import com.google.cloud.tools.jib.plugins.common.SkaffoldFilesOutput;
import com.google.common.base.Strings;
@@ -37,13 +36,9 @@
/** Tests for {@link FilesMojoV2}. */
public class FilesMojoV2Test {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
-
- @ClassRule
- public static final TestProject multiTestProject = new TestProject(testPlugin, "multi");
+ @ClassRule public static final TestProject multiTestProject = new TestProject("multi");
private static void verifyFiles(
Path projectRoot,
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/PackageGoalsMojoTest.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/PackageGoalsMojoTest.java
index 71d685b6e3..beb0385ea8 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/PackageGoalsMojoTest.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/PackageGoalsMojoTest.java
@@ -16,7 +16,6 @@
package com.google.cloud.tools.jib.maven.skaffold;
-import com.google.cloud.tools.jib.maven.TestPlugin;
import com.google.cloud.tools.jib.maven.TestProject;
import com.google.common.base.Strings;
import java.io.IOException;
@@ -35,10 +34,7 @@
/** Tests for {@link PackageGoalsMojo}. */
public class PackageGoalsMojoTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
-
- @ClassRule
- public static final TestProject multiTestProject = new TestProject(testPlugin, "multi");
+ @ClassRule public static final TestProject multiTestProject = new TestProject("multi");
private void verifyGoals(Path projectRoot, String profilesString, String... expectedGoals)
throws VerificationException, IOException {
diff --git a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldInitMojoTest.java b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldInitMojoTest.java
index 51e050bbcf..341c928e77 100644
--- a/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldInitMojoTest.java
+++ b/jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/skaffold/SkaffoldInitMojoTest.java
@@ -16,7 +16,6 @@
package com.google.cloud.tools.jib.maven.skaffold;
-import com.google.cloud.tools.jib.maven.TestPlugin;
import com.google.cloud.tools.jib.maven.TestProject;
import com.google.cloud.tools.jib.plugins.common.SkaffoldInitOutput;
import java.io.IOException;
@@ -38,13 +37,9 @@
/** Tests for {@link SkaffoldInitMojo}. */
public class SkaffoldInitMojoTest {
- @ClassRule public static final TestPlugin testPlugin = new TestPlugin();
+ @ClassRule public static final TestProject simpleTestProject = new TestProject("simple");
- @ClassRule
- public static final TestProject simpleTestProject = new TestProject(testPlugin, "simple");
-
- @ClassRule
- public static final TestProject multiTestProject = new TestProject(testPlugin, "multi");
+ @ClassRule public static final TestProject multiTestProject = new TestProject("multi");
/**
* Verifies that the files task succeeded and returns the list of JSON strings printed by the
diff --git a/jib-maven-plugin/src/test/resources/maven/projects/multi/lib/src/test/java/com/lib/LibTest.java b/jib-maven-plugin/src/test/resources/maven/projects/multi/lib/src/test/java/com/lib/LibTest.java
index 41fee95d40..ab7425f896 100644
--- a/jib-maven-plugin/src/test/resources/maven/projects/multi/lib/src/test/java/com/lib/LibTest.java
+++ b/jib-maven-plugin/src/test/resources/maven/projects/multi/lib/src/test/java/com/lib/LibTest.java
@@ -16,18 +16,14 @@
package com.lib;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Assert;
import org.junit.Test;
-/**
- * Unit test for simple App.
- */
+/** Unit test for simple App. */
public class LibTest {
- /** Rigorous Test :-) */
- @Test
- public void testGetThing() {
- Assert.assertEquals("thing", new Lib().getThing());
- }
+ /** Rigorous Test :-) */
+ @Test
+ public void testGetThing() {
+ Assert.assertEquals("thing", new Lib().getThing());
+ }
}
diff --git a/jib-plugins-common/build.gradle b/jib-plugins-common/build.gradle
index 8ee67d0889..413febd980 100644
--- a/jib-plugins-common/build.gradle
+++ b/jib-plugins-common/build.gradle
@@ -1,115 +1,17 @@
-plugins {
- id 'java'
- id 'checkstyle'
- id 'com.github.sherter.google-java-format' version '0.8'
- id 'net.ltgt.apt' version '0.19'
- id 'net.ltgt.errorprone' version '0.6'
-}
-
-group 'com.google.cloud.tools'
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-
-repositories {
- mavenCentral()
-}
-
-sourceSets {
- main {
- java.srcDir file('../jib-core/src/main/java')
- resources.srcDir file('../jib-core/src/main/resources')
- }
- test {
- java.srcDir file('../jib-core/src/test/java')
- resources.srcDir file('../jib-core/src/test/resources')
- }
-}
-
dependencies {
- // Make sure these are consistent with jib-maven-plugin.
- compile('com.google.http-client:google-http-client:1.31.0') {
- exclude group: "org.apache.httpcomponents", module: "httpclient"
- }
- compile('com.google.http-client:google-http-client-apache-v2:1.31.0') {
- exclude group: "org.apache.httpcomponents", module: "httpclient"
- }
- compile('com.google.auth:google-auth-library-oauth2-http:0.16.2') {
+ implementation project(':jib-core')
+ implementation ("com.google.http-client:google-http-client:${dependencyVersions.GOOGLE_HTTP_CLIENT}") {
exclude group: "org.apache.httpcomponents", module: "httpclient"
}
- compile 'org.apache.httpcomponents:httpclient:4.5.6'
- compile 'com.google.guava:guava:28.0-jre'
-
- compile 'org.apache.commons:commons-compress:1.18'
- compile 'com.fasterxml.jackson.core:jackson-databind:2.9.9.2'
- compile 'org.ow2.asm:asm:7.0'
-
- testCompile 'junit:junit:4.12'
- testCompile 'org.mockito:mockito-core:2.23.4'
- testCompile 'org.slf4j:slf4j-api:1.7.25'
- testCompile 'com.github.stefanbirkner:system-rules:1.19.0'
-
- // NullAway errorprone plugin
- annotationProcessor 'com.uber.nullaway:nullaway:0.6.4'
- errorprone 'com.google.errorprone:error_prone_core:2.3.2'
- // Using github.com/google/error-prone-javac is required when running on
- // JDK 8. Remove when migrating to JDK 11.
- if (System.getProperty("java.version").startsWith("1.8.")) {
- errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
- }
-}
-
-test {
- testLogging {
- showStandardStreams = true
- exceptionFormat = 'full'
- }
-}
-
-import net.ltgt.gradle.errorprone.CheckSeverity
-
-// Adds NullAway errorprone checks.
-tasks.withType(JavaCompile) {
- if (!name.toLowerCase().contains("test")) {
- options.errorprone {
- check('NullAway', CheckSeverity.ERROR)
- option('NullAway:AnnotatedPackages', 'com.google.cloud.tools')
- }
- }
-}
+ implementation "org.apache.httpcomponents:httpclient:${dependencyVersions.APACHE_HTTP_CLIENT_OVERRIDE}"
+ implementation "com.google.guava:guava:${dependencyVersions.GUAVA}"
+ implementation "com.fasterxml.jackson.core:jackson-databind:${dependencyVersions.JACKSON_DATABIND}"
-// Fail build on javadoc warnings
-tasks.withType(Javadoc) {
- options.addBooleanOption('Xwerror', true)
+ testImplementation "junit:junit:${dependencyVersions.JUNIT}"
+ testImplementation "org.mockito:mockito-core:${dependencyVersions.MOCKITO_CORE}"
+ testImplementation "org.slf4j:slf4j-api:${dependencyVersions.SLF4J_API}"
+ testImplementation "com.github.stefanbirkner:system-rules:${dependencyVersions.SYSTEM_RULES}"
+ testImplementation project(path:':jib-core', configuration:'tests')
}
-assemble.dependsOn javadoc
-tasks.withType(Test) {
- reports.html.setDestination file("${reporting.baseDir}/${name}")
-}
-
-/* GOOGLE JAVA FORMAT */
-googleJavaFormat {
- toolVersion = '1.6'
-}
-check.dependsOn verifyGoogleJavaFormat
-/* GOOGLE JAVA FORMAT */
-
-/* CHECKSTYLE */
-checkstyle {
- toolVersion = '8.18'
-
- // get the google_checks.xml file from the checkstyle jar and take out the java checks
- def googleChecks = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml').asString()
- def fileExtensionsBefore = ''
- def fileExtensionsAfter = ''
- def googleChecksNoJava = googleChecks.replace(fileExtensionsBefore, fileExtensionsAfter)
- assert !googleChecks.equals(googleChecksNoJava)
-
- config = resources.text.fromString(googleChecksNoJava)
-
- maxErrors = 0
- maxWarnings = 0
-}
-/* CHECKSTYLE */
+sourceSets.test.resources.srcDirs project(':jib-core').sourceSets.test.resources
diff --git a/jib-plugins-common/gradle/wrapper/gradle-wrapper.jar b/jib-plugins-common/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 29953ea141..0000000000
Binary files a/jib-plugins-common/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/jib-plugins-common/gradle/wrapper/gradle-wrapper.properties b/jib-plugins-common/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index e0b3fb8d70..0000000000
--- a/jib-plugins-common/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/jib-plugins-common/gradlew.bat b/jib-plugins-common/gradlew.bat
deleted file mode 100644
index f9553162f1..0000000000
--- a/jib-plugins-common/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/jib-plugins-common/settings.gradle b/jib-plugins-common/settings.gradle
deleted file mode 100644
index 86f932126b..0000000000
--- a/jib-plugins-common/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'jib-plugins-common'
diff --git a/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JavaContainerBuilderHelperTest.java b/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JavaContainerBuilderHelperTest.java
index 5cf1c06d49..4ba44e0189 100644
--- a/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JavaContainerBuilderHelperTest.java
+++ b/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JavaContainerBuilderHelperTest.java
@@ -108,7 +108,6 @@ public void testFromExplodedWar()
Path temporaryExplodedWar = temporaryFolder.getRoot().toPath().resolve("exploded-war");
Files.createDirectories(temporaryExplodedWar.resolve("WEB-INF/classes/empty_dir"));
- Paths.get(Resources.getResource("core/layer").toURI());
JavaContainerBuilder javaContainerBuilder =
JavaContainerBuilder.from(RegistryImage.named("base"))
diff --git a/kokoro/continuous.bat b/kokoro/continuous.bat
index 949622bea1..f7e2264453 100755
--- a/kokoro/continuous.bat
+++ b/kokoro/continuous.bat
@@ -13,9 +13,6 @@ REM Sets the integration testing project.
set JIB_INTEGRATION_TESTING_PROJECT=jib-integration-testing
REM TODO: Enable integration tests once docker works (b/73345382).
-cd jib-core && call gradlew.bat clean build --info --stacktrace && ^
-cd ../jib-plugins-common && call gradlew.bat clean build --info --stacktrace && ^
-cd ../jib-maven-plugin && call mvnw.cmd clean install -B -U -e && ^
-cd ../jib-gradle-plugin && call gradlew.bat clean build --info --stacktrace
+gradlew.bat clean build --info --stacktrace
exit /b %ERRORLEVEL%
diff --git a/kokoro/continuous.sh b/kokoro/continuous.sh
index bc3b5e3f5d..b1e9833dd7 100755
--- a/kokoro/continuous.sh
+++ b/kokoro/continuous.sh
@@ -30,7 +30,4 @@ if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then
while ! docker info > /dev/null 2>&1; do sleep 1; done
fi
-(cd github/jib/jib-core; ./gradlew clean build integrationTest --info --stacktrace)
-(cd github/jib/jib-plugins-common; ./gradlew clean build --info --stacktrace)
-(cd github/jib/jib-maven-plugin; ./mvnw clean install -PintegrationTest -B -U -e)
-(cd github/jib/jib-gradle-plugin; ./gradlew clean build integrationTest --info --stacktrace)
+./gradlew clean build integrationTest --info --stacktrace
diff --git a/kokoro/presubmit.bat b/kokoro/presubmit.bat
index 7dab7f73e5..4b2280097c 100755
--- a/kokoro/presubmit.bat
+++ b/kokoro/presubmit.bat
@@ -9,9 +9,6 @@ cd github/jib
REM Stops any left-over containers.
REM FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm -vf %%i
-cd jib-core && call gradlew.bat clean build --info --stacktrace && ^
-cd ../jib-plugins-common && call gradlew.bat clean build --info --stacktrace && ^
-cd ../jib-maven-plugin && call mvnw.cmd clean install -B -U -e && ^
-cd ../jib-gradle-plugin && call gradlew.bat clean build --info --stacktrace
+call gradlew.bat clean build --info --stacktrace
exit /b %ERRORLEVEL%
diff --git a/kokoro/presubmit.sh b/kokoro/presubmit.sh
index f84c885fbe..5fe0edf282 100755
--- a/kokoro/presubmit.sh
+++ b/kokoro/presubmit.sh
@@ -28,7 +28,5 @@ cd github/jib
# TODO: Follow-up with Kokoro about why this is happening.
rm /usr/local/bin/docker-credential-osxkeychain || true
-(cd jib-core; ./gradlew clean build integrationTest --info --stacktrace)
-(cd jib-plugins-common; ./gradlew clean build --info --stacktrace)
-(cd jib-maven-plugin; ./mvnw clean install -B -U -e)
-(cd jib-gradle-plugin; ./gradlew clean build --info --stacktrace)
+# we only run integration tests on jib-core for presubmit
+./gradlew clean build :jib-core:integrationTest --info --stacktrace
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000000..f8851b6def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,4 @@
+include ":jib-core"
+include ":jib-plugins-common"
+include ":jib-gradle-plugin"
+include ":jib-maven-plugin"