This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Jib: Adds init script to use with any Gradle project. #68
Open
coollog
wants to merge
1
commit into
knative:master
Choose a base branch
from
coollog:gradle-init-script
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,49 @@ spec: | |
steps: | ||
- name: build-and-push | ||
image: gcr.io/cloud-builders/gradle | ||
command: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might indicate that we want a If we go that route, my personal preference would be to base that image |
||
- sh | ||
- -c | ||
args: | ||
- jib | ||
- -Duser.home=/builder/home | ||
- --image=${IMAGE} | ||
- | | ||
# Adds Gradle init script that applies the Jib Gradle plugin. | ||
echo "\ | ||
initscript { | ||
repositories { | ||
maven { | ||
url 'https://plugins.gradle.org/m2' | ||
} | ||
} | ||
dependencies { | ||
classpath 'gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:+' | ||
} | ||
} | ||
|
||
// Only applies the Jib plugin if the project does not apply it already. | ||
rootProject { | ||
afterEvaluate { | ||
if (!project.plugins.hasPlugin('com.google.cloud.tools.jib')) { | ||
project.apply plugin: com.google.cloud.tools.jib.gradle.JibPlugin | ||
} | ||
} | ||
}\ | ||
" > /builder/home/auto-jib.gradle | ||
|
||
# Runs the Gradle Jib build. | ||
gradle jib \ | ||
--init-script=/builder/home/auto-jib.gradle \ | ||
-Dgradle.user.home=/builder/home/.gradle \ | ||
-Duser.home=/builder/home \ | ||
--image=${IMAGE} | ||
|
||
workingDir: /workspace/${DIRECTORY} | ||
volumeMounts: | ||
- name: ${CACHE} | ||
mountPath: /builder/home/.m2 | ||
subPath: m2-cache | ||
mountPath: /builder/home/.gradle/caches | ||
subPath: gradle-caches | ||
- name: ${CACHE} | ||
mountPath: /builder/home/.gradle/wrapper | ||
subPath: gradle-wrapper | ||
- name: ${CACHE} | ||
mountPath: /builder/home/.cache | ||
subPath: jib-cache | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though it's annoying to have two copies, it might be helpful to be explicit about the steps to speed up Gradle builds specifically. I'm thinking if I'm a heavy Gradle user and doesn't know anything about Maven, I don't want to have to figure out which parts of the Maven-specific "speeding up builds" doc apply to me and which don't.
Let me know if that's a silly thought, and that Gradle developers would necessarily know enough about Maven to figure it out, I don't know the Javas.