-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #726 New scripts to run examples - greatly simplified, no Maven…
… or Ant dependency.
- Loading branch information
Showing
4 changed files
with
91 additions
and
145 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@echo off | ||
|
||
:: Ensure we have at least one parameter (the class name) | ||
IF "%~1"=="" ( | ||
echo Usage: %~nx0 [--all ^| full.class.Name] [-jvm-option]... | ||
echo --all run all examples. | ||
echo full.class.Name fully qualified class name to run. | ||
echo -jvm-option options and values passed to the java command. | ||
exit /b | ||
) | ||
|
||
:: Build the classpath | ||
setlocal enabledelayedexpansion | ||
for /r target\libs %%g in (*.jar) do ( | ||
set CLASSPATH=!CLASSPATH!;%%g | ||
) | ||
set CLASSPATH=target\classes%CLASSPATH% | ||
|
||
:: Run the java processes | ||
if /I "%~1"=="--all" ( | ||
for /r target\classes %%g in (*Job.class) do ( | ||
set "file=%%~g" | ||
setlocal enabledelayedexpansion | ||
set "class=!file:target\classes\=!" | ||
set "class=!class:\=.!" | ||
set "class=!class:.class=!" | ||
echo ======================================================================= | ||
echo Running !class! | ||
echo ======================================================================= | ||
java %*:~2 -cp "!CLASSPATH!" "!class!" | ||
endlocal | ||
) | ||
) else ( | ||
echo ======================================================================= | ||
echo Running %~1 | ||
echo ======================================================================= | ||
java %*:~2 -cp "%CLASSPATH%" "%~1" | ||
) |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
function ctrl_c() { | ||
echo 'Script interrupted by user' | ||
trap - SIGINT SIGTERM ## Clear the trap | ||
kill -- -$$ ## Sends SIGTERM to child/sub processes | ||
} | ||
|
||
print_line() { | ||
echo -e "\e[1m=======================================================================\e[0m" | ||
echo -e "\e[1mRunning $1 \e[0m" | ||
echo -e "\e[1m=======================================================================\e[0m" | ||
} | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "Usage: $0 [--all | full.class.Name] [-jvm-option]..." | ||
echo " --all run all examples." | ||
echo " full.class.Name fully qualified class name to run." | ||
echo " -jvm-option options and values passed to the java command." | ||
exit 1 | ||
fi | ||
|
||
trap ctrl_c SIGINT SIGTERM | ||
|
||
CLASSPATH=target/classes:$(echo target/libs/*.jar | tr ' ' ':') | ||
|
||
if [ "$1" = "--all" ]; then | ||
while IFS= read -r -d '' file; do | ||
class=$(echo "${file#target/classes/}" | sed 's/\//./g' | sed 's/\.class$//') | ||
print_line "$class" | ||
java "${@:2}" -cp "$CLASSPATH" "$class" | ||
done < <(find target/classes -type f -name "*Job.class" -print0 | sort -z) | ||
else | ||
print_line "$1" | ||
java "${@:2}" -cp "$CLASSPATH" "$1" | ||
fi |