-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Gradle build support, initial version (fixes #118) #121
Conversation
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.
tbh, I'm not a Gradle user at all, so its probably hard for me to support this feature on the long run.
If there are others (@dhirajsb @jamesnetherton ...) willing to support this, I'm happy to integrate the PR.
added some minor comments, too.
BTW, what would you think to add some real shell integration tests with bats
, like we do for https://github.com/fabric8io-images/run-java-sh ?
java/images/jboss/s2i/assemble
Outdated
|
||
# Normalize dir | ||
# TODO how do you get this to check not one but two (../..) up? | ||
# dir=$(echo ${dir} | tr -s /) |
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.
what is this section supposed to do ?
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.
it was inspired by the equivalent for Maven, but things work without this (as proven by java/examples/gradle
in upcoming PR), so I've just removed in the new clean-up commit; hope that's OK? It could always be added back later (and covered by the example / test), if really needed.
java/images/jboss/s2i/assemble
Outdated
@@ -111,6 +136,10 @@ function setup_maven() { | |||
fi | |||
} | |||
|
|||
function setup_gradle() { |
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.
Can we remove it for now if not used ?
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.
Yup, sure, makes sense; so done now in new clean up commit. PS: Just for future reference, see Gradle doc re. proxies - this would have to do something like that, similarly to function setup_maven()
, I guess.
local gradle_args=${GRADLE_ARGS:-build -x test} | ||
|
||
# If there is no user provided GRADLE_OPTS, use options from run-java.sh | ||
if [ -f ${RUN_JAVA_DIR}/run-java.sh -a -z "${GRADLE_OPTS}" ]; then |
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.
using [ .... ] && [ .... ]
proved to be more robust to me. -a
fails in certain edge case (which I dont remember right now ;-)
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.
Unfortunately my bash foo smartness is not nearly good enough 😃 to understand what exactly you mean here, but FYI I've just copy/pasted this from an almost identical line in build_maven()
... perhaps you would like to raise a follow-up PR, when this is in, to adjust both this and the original that I got inspired from for this however you see fit?
export GRADLE_OPTS=$(${RUN_JAVA_DIR}/run-java.sh options) | ||
fi | ||
|
||
if [ ! -z "${GRADLE_OPTS}" ]; then |
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.
-n
?
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.
similarly to above, build_maven()
uses if [ ! -z "${MAVEN_OPTS}" ]; then
- this should probably be kept consistent, and changed in both places, in a separate PR when this is in? I can raise one proposing that as a follow-up to this - if you would like?
java/images/jboss/s2i/assemble
Outdated
|
||
# ====================== | ||
# TODO Remove repo if desired | ||
# if [ "x${MAVEN_CLEAR_REPO}" != "x" ]; then |
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.
Why commented out ?
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.
I've un-commented it in the final clean-up commit now, using GRADLE_CLEAR_REPO
and ${S2I_ARTIFACTS_DIR}/gradle
, in anticipation of related future work under #150 ... OK?
If we are going to support Gradle then we should restrict its implementation to the community images initially. |
agree with @jamesnetherton |
@rhuss I'm hoping to be able to make time to pick this up after my other pending PRs are in; the idea would be to cover this using my new self testing approach for this example as well. @jamesnetherton @dhirajsb sure OK for me initially community images only; so I'll put a big IFF into the respective templates - OK for you as well @rhuss ? |
@vorburger yes, sounds like a plan. I'm still a bit hesitant ans I'm not sure how good we can support the Gradle support in case of an error, but hey, let's try it ;-) |
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.
@rhuss as per more detailed in-line comments, I've reacted to all of your review feedback.
@jamesnetherton @dhirajsb @rhuss the (hopefully) last commit in this PR restricts the implementation to the community image by a bunch of {{? fp.param.base != "rhel"}}
in the template - OK for you?
java/images/jboss/s2i/assemble
Outdated
|
||
# Normalize dir | ||
# TODO how do you get this to check not one but two (../..) up? | ||
# dir=$(echo ${dir} | tr -s /) |
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.
it was inspired by the equivalent for Maven, but things work without this (as proven by java/examples/gradle
in upcoming PR), so I've just removed in the new clean-up commit; hope that's OK? It could always be added back later (and covered by the example / test), if really needed.
java/images/jboss/s2i/assemble
Outdated
@@ -111,6 +136,10 @@ function setup_maven() { | |||
fi | |||
} | |||
|
|||
function setup_gradle() { |
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.
Yup, sure, makes sense; so done now in new clean up commit. PS: Just for future reference, see Gradle doc re. proxies - this would have to do something like that, similarly to function setup_maven()
, I guess.
local gradle_args=${GRADLE_ARGS:-build -x test} | ||
|
||
# If there is no user provided GRADLE_OPTS, use options from run-java.sh | ||
if [ -f ${RUN_JAVA_DIR}/run-java.sh -a -z "${GRADLE_OPTS}" ]; then |
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.
Unfortunately my bash foo smartness is not nearly good enough 😃 to understand what exactly you mean here, but FYI I've just copy/pasted this from an almost identical line in build_maven()
... perhaps you would like to raise a follow-up PR, when this is in, to adjust both this and the original that I got inspired from for this however you see fit?
export GRADLE_OPTS=$(${RUN_JAVA_DIR}/run-java.sh options) | ||
fi | ||
|
||
if [ ! -z "${GRADLE_OPTS}" ]; then |
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.
similarly to above, build_maven()
uses if [ ! -z "${MAVEN_OPTS}" ]; then
- this should probably be kept consistent, and changed in both places, in a separate PR when this is in? I can raise one proposing that as a follow-up to this - if you would like?
java/images/jboss/s2i/assemble
Outdated
|
||
# ====================== | ||
# TODO Remove repo if desired | ||
# if [ "x${MAVEN_CLEAR_REPO}" != "x" ]; then |
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.
I've un-commented it in the final clean-up commit now, using GRADLE_CLEAR_REPO
and ${S2I_ARTIFACTS_DIR}/gradle
, in anticipation of related future work under #150 ... OK?
and mkdir -p it, because it can (and in our use case does) not exist, yet.
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.
lgtm. Haven't really tested a gradel build, but I'm confident @vorburger will help us if there should be an issue.
BTW, @vorburger I added you with write access to this repo so that you then can work on and fix Gradle issues ;-P
OK, cool - will do my best! |
running s2i with
I'm not sure but seems this if clause doesn't do anything:
Instead it should have been:
|
@vorburger could you please have a look ? |
@maslick sorry I don't really have the time to help with this project anymore, but if you'd like to raise a PR putting what you are suggesting above into code, then perhaps someone will help to review and merge it. |
No description provided.