RFR: 6946: There should be an option to build the agent in the build script [v10]

Alex Macdonald aptmac at openjdk.java.net
Wed Jan 6 19:16:58 UTC 2021


On Wed, 6 Jan 2021 15:02:08 GMT, Miroslav Wengner <mwengner at openjdk.org> wrote:

>> https://bugs.openjdk.java.net/browse/JMC-6946
>> added: 
>> - build.sh --packageAgent
>> - build.sh --runAgentExample
>
> Miroslav Wengner has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - 6946: typo correction
>  - 6946: runAgentByClass improvements

build.sh line 150:

> 148: 
> 149:     if [[ "${OSTYPE}" =~ "linux"* ]] || [[ "${OSTYPE}" =~ "darwin"* ]]; then
> 150:        printf "%s\n" "You can nor run agent by calling \"${PROGNAME} --runAgentExample\""

s/nor/now/

build.sh line 295:

> 293: 
> 294: function checkJava() {
> 295:     if ! command -v   java &> /dev/null ; then

maven looks up JAVA_HOME instead of system java installations, should it look up the env variable instead for verification of java?

build.sh line 314:

> 312: }
> 313: 
> 314: checkPreconditions

Thinking about it now, should checkPreconditions happen here, or would it be better to have it before valid arguments in `parseArgs`?

My reasoning being if I just wanted to just see the help menu, the script has to first check for java & maven, and then prints the menu. It's not a particularly long delay, but there is a delay while it verifies. I also noticed this because I had JAVA_HOME unset so the script failed without any output even though I just wanted to read the options.

build.sh line 214:

> 212:     local agentExampleClass=$1
> 213:     if [[ -z "${agentExampleClass}" ]]; then
> 214:         err_log "emtpy class"

s/emtpy/empty/

build.sh line 89:

> 87:         printf " \t%s\t%s\n" "--run" "to run JMC once it was packaged"
> 88:         printf " \t%s\t%s\n" "--runAgentExample" "to run Agent Example once it was packaged"
> 89:         printf " \t%s\t%s\n" "--runAgentCustomExample --class:'org.openjdk.jmc.agent.test.InstrumentMe'" "to run custom agent class, once Agent was packaged"

This line is really long and causes multi-lines at small widths; it's difficult to read the menu. 

Does this line do anything at the moment? It doesn't have a match in `parseArgs`

-------------

PR: https://git.openjdk.java.net/jmc/pull/183


More information about the jmc-dev mailing list