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
6889: Provide build script for making it easier to build JMC #100
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
40c4dfc
Add build script for linux
3928693
Merge remote-tracking branch 'origin/master' into enhancement/buildSc…
9a5dac7
fix path to jmc in output
dc6fc5e
Merge remote-tracking branch 'origin/master' into enhancement/buildSc…
e45021b
Add OSTYPE and run option to build script
a9ac601
fix typos, add --run hint after --packageJmc
e051a31
fix subprocessed pid of jetty server
805cd6c
kill jetty parent including child processes
a0d6c43
check entire jetty log for start messeage instead of only last line
deb105d
Fix typo
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ function err_report() { | |
err_log "$(date +%T) current working directory: $PWD" | ||
} | ||
|
||
function exit() { | ||
function exitTrap() { | ||
if [ -n "${JETTY_PID}" ]; then | ||
echo "$(date +%T) terminating jetty server" | ||
kill "${JETTY_PID}" | ||
|
@@ -24,7 +24,7 @@ function err_log() { | |
} | ||
|
||
trap 'err_report $LINENO' ERR | ||
trap 'exit' EXIT | ||
trap 'exitTrap' EXIT | ||
|
||
function printHelp() { | ||
echo "usage: call ./$(basename "$0") with the following options:" | ||
|
@@ -33,6 +33,7 @@ function printHelp() { | |
printf " \t%s\t%s\n" "--runUiTests" "to run the tests including UI tests" | ||
printf " \t%s\t%s\n" "--packageJmc" "to package JMC" | ||
printf " \t%s\t%s\n" "--clean" "to run maven clean" | ||
printf " \t%s\t%s\n" "--run" "to run JMC once it was packaged" | ||
printf " \t%s\t%s\n" "--help" "to show this help dialog" | ||
} | column -ts $'\t' | ||
} | ||
|
@@ -64,7 +65,7 @@ function packageJmc() { | |
local packageLog="${BASEDIR}/build_${timestamp}.4.package.log" | ||
|
||
pushd releng/third-party 1> /dev/null || { | ||
echo "directory releng/third-party not found" | ||
err_log "directory releng/third-party not found" | ||
exit 1 | ||
} | ||
echo "$(date +%T) building p2:site - logging output to ${p2SiteLog}" | ||
|
@@ -82,51 +83,79 @@ function packageJmc() { | |
echo "$(date +%T) jetty server up and running" | ||
|
||
popd 1> /dev/null || { | ||
echo "could not go to project root directory" | ||
err_log "could not go to project root directory" | ||
exit 1 | ||
} | ||
pushd core 1> /dev/null || { | ||
echo "directory core not found" | ||
err_log "directory core not found" | ||
exit 1 | ||
} | ||
|
||
echo "$(date +%T) installing core artfacts - logging output to ${installLog}" | ||
mvn clean install --log-file "${installLog}" | ||
|
||
popd 1> /dev/null || { | ||
echo "could not go to project root directory" | ||
err_log "could not go to project root directory" | ||
exit 1 | ||
} | ||
echo "$(date +%T) packaging jmc - logging output to ${packageLog}" | ||
mvn package --log-file "${packageLog}" | ||
|
||
echo "You can now run jmc by calling ${BASEDIR}/products/org.openjdk.jmc/linux/gtk/x86_64/JDK\ Mission\ Control/jmc" | ||
if [[ "${OSTYPE}" =~ "linux"* ]]; then | ||
echo "You can now run jmc by calling ${BASEDIR}/products/org.openjdk.jmc/linux/gtk/x86_64/JDK\ Mission\ Control/jmc" | ||
thegreystone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
elif [[ "${OSTYPE}" =~ "darwin"* ]]; then | ||
echo "You can now run jmc by calling ${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK\ Mission\ Control.app/Contents/MacOS/jmc" | ||
else | ||
err_log "unknown OS type: \"${OSTYPE}\". Please check your package in ${BASEDIR}/products/org.openjdk.jmc/" | ||
fi | ||
} | ||
|
||
function clean() { | ||
mvn clean | ||
|
||
pushd core 1> /dev/null || { | ||
echo "directory core not found" | ||
err_log "directory core not found" | ||
exit 1 | ||
} | ||
mvn clean | ||
popd 1> /dev/null || { | ||
echo "could not go to project root directory" | ||
err_log "could not go to project root directory" | ||
exit 1 | ||
} | ||
|
||
pushd releng/third-party 1> /dev/null || { | ||
echo "directory releng/third-party not found" | ||
err_log "directory releng/third-party not found" | ||
exit 1 | ||
} | ||
mvn clean | ||
popd 1> /dev/null || { | ||
echo "could not go to project root directory" | ||
err_log "could not go to project root directory" | ||
exit 1 | ||
} | ||
} | ||
|
||
function run() { | ||
local BASEDIR | ||
BASEDIR="$(mvn help:evaluate -Dexpression=project.build.directory --non-recursive -q -DforceStdout)" | ||
|
||
local path | ||
if [[ "${OSTYPE}" =~ "linux"* ]]; then | ||
path="${BASEDIR}/products/org.openjdk.jmc/linux/gtk/x86_64/JDK Mission Control/jmc" | ||
elif [[ "${OSTYPE}" =~ "darwin"* ]]; then | ||
path="${BASEDIR}/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK Mission Control.app/Contents/MacOS/jmc" | ||
else | ||
err_log "unknown OS type: ${OSTYPE}" | ||
exit 1 | ||
fi | ||
|
||
if [ -f "${path}" ]; then | ||
exec "${path}" | ||
else | ||
err_log "JMC not found in \"${path}\". Did you call --packageJmc before?" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function parseArgs() { | ||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
|
@@ -146,8 +175,11 @@ function parseArgs() { | |
--clean) | ||
clean | ||
;; | ||
--run) | ||
run | ||
;; | ||
*) | ||
echo "unknown argument \"$1\"" | ||
err_log "unknown argument \"$1\"" | ||
printHelp | ||
exit 1 | ||
;; | ||
|
@@ -156,4 +188,17 @@ function parseArgs() { | |
done | ||
} | ||
|
||
function checkPreconditions() { | ||
if ! command -v mvn &> /dev/null ; then | ||
err_log "It seems you do not have maven installed. Please ensure you have it installend and executable as \"mvn\"." | ||
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. Typo "installend" -> "installed". |
||
exit 1 | ||
fi | ||
|
||
if ! command -v java &> /dev/null ; then | ||
err_log "It seems you do not have java installed. Please ensure you have it installend and executable as \"java\"." | ||
thegreystone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exit 1 | ||
fi | ||
} | ||
|
||
checkPreconditions | ||
parseArgs "$@" |
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.
Typo. artfacts -> artifacts.