mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
. Introduce the JAVAVM_DRYRUN variable. If this is set, then javavm will
not invoke any Java programmes, but will instead print out what it would have invoked and some related settings. This work was inspired by the PR, but doesn't use its implementation. PR: 96050
This commit is contained in:
parent
ba930d27f0
commit
2469e3b726
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=164848
3 changed files with 50 additions and 6 deletions
|
@ -8,8 +8,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
PORTNAME= javavmwrapper
|
PORTNAME= javavmwrapper
|
||||||
PORTVERSION= 2.1
|
PORTVERSION= 2.2
|
||||||
PORTREVISION= 3
|
|
||||||
CATEGORIES= java
|
CATEGORIES= java
|
||||||
MASTER_SITES= # none
|
MASTER_SITES= # none
|
||||||
DISTFILES= # none
|
DISTFILES= # none
|
||||||
|
|
|
@ -130,11 +130,37 @@ Java VM as options.
|
||||||
For more information on environment variables which can be used to set
|
For more information on environment variables which can be used to set
|
||||||
options see
|
options see
|
||||||
.Pa %%PREFIX%%/etc/javavm_opts.conf.dist .
|
.Pa %%PREFIX%%/etc/javavm_opts.conf.dist .
|
||||||
|
.It Ev JAVAVM_DRYRUN
|
||||||
|
When this variable is set, no Java VM is invoked.
|
||||||
|
Instead, the Java VM wrapper prints out the following information:
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Ev JAVA_HOME
|
||||||
|
The value of the
|
||||||
|
.Ev JAVA_HOME
|
||||||
|
environment variable which the Java VM wrapper would have set before
|
||||||
|
invoking the Java VM.
|
||||||
|
.It Ev JAVAVM_CONF
|
||||||
|
The Java VM wrapper configuration file being used.
|
||||||
|
.It Ev JAVAVM_OPTS_CONF
|
||||||
|
The Java VM wrapper option configuration file being used.
|
||||||
|
.It Ev JAVAVM_PROG
|
||||||
|
The Java VM that would have been invoked.
|
||||||
|
.It Ev JAVAVM_OPTS
|
||||||
|
The options that would have been passed to the invoked Java VM.
|
||||||
|
It is important to note that this variable may not be the same as the
|
||||||
|
.Ev JAVAVM_OPTS
|
||||||
|
environment variable due to processing of the Java VM wrapper option
|
||||||
|
configuration file.
|
||||||
|
.It Ev JAVAVM_COMMAND
|
||||||
|
The full command line that would have been used to invoke the Java VM.
|
||||||
|
.El
|
||||||
.El
|
.El
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Pa %%PREFIX%%/etc/javavms
|
.It Pa %%PREFIX%%/etc/javavms
|
||||||
The location of the Java VM wrapper configuration file.
|
The location of the Java VM wrapper configuration file.
|
||||||
|
.It Pa %%PREFIX%%/etc/javavm_opts.conf
|
||||||
|
The location of the Java VM wrapper option configuration file.
|
||||||
.It Pa %%PORTSDIR%%/Mk/bsd.java.mk
|
.It Pa %%PORTSDIR%%/Mk/bsd.java.mk
|
||||||
The file usually used, along with
|
The file usually used, along with
|
||||||
.Nm make ,
|
.Nm make ,
|
||||||
|
@ -157,6 +183,14 @@ with
|
||||||
This is necessary if MyApp uses JNI, for instance.
|
This is necessary if MyApp uses JNI, for instance.
|
||||||
.It Ev JAVA_VERSION="1.2 1.4" Pa %%LOCALBASE%%/bin/java Fl jar Pa MyApp.jar
|
.It Ev JAVA_VERSION="1.2 1.4" Pa %%LOCALBASE%%/bin/java Fl jar Pa MyApp.jar
|
||||||
Execute MyApp with either a Java VM that is either version 1.2 or version 1.4.
|
Execute MyApp with either a Java VM that is either version 1.2 or version 1.4.
|
||||||
|
.It Ev JAVAVM_DRYRUN=yes Pa %%LOCALBASE%%/bin/java
|
||||||
|
Don't invoke the Java VM, but print out information about what would have
|
||||||
|
been done.
|
||||||
|
This could be used in a script to determine the
|
||||||
|
.Ev JAVA_HOME
|
||||||
|
that the Java VM wrapper will use, for instance:
|
||||||
|
.Lp
|
||||||
|
.Ev JAVA_HOME=`env JAVAVM_DRYRUN=yes %%LOCALBASE%%/bin/java | grep '^JAVA_HOME' | cut -c11-`
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr checkvms 1 ,
|
.Xr checkvms 1 ,
|
||||||
|
|
|
@ -42,6 +42,17 @@ _JAVAVM_MAKE=/usr/bin/make
|
||||||
# Try to run a Java command.
|
# Try to run a Java command.
|
||||||
#
|
#
|
||||||
tryJavaCommand () {
|
tryJavaCommand () {
|
||||||
|
# If this is a test run, spit out the configuration and exit
|
||||||
|
if [ -n "${JAVAVM_DRYRUN}" ]; then
|
||||||
|
echo "JAVA_HOME=${JAVA_HOME}"
|
||||||
|
echo "JAVAVM_CONF=${_JAVAVM_CONF}"
|
||||||
|
echo "JAVAVM_OPTS_CONF=${_JAVAVM_OPTS_CONF}"
|
||||||
|
echo "JAVAVM_PROG=${1}"
|
||||||
|
echo "JAVAVM_OPTS=${_JAVAVM_OPTS}"
|
||||||
|
echo "JAVAVM_COMMAND=${@}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for the command being executable and exec it if so.
|
# Check for the command being executable and exec it if so.
|
||||||
if [ -x "${1}" ]; then
|
if [ -x "${1}" ]; then
|
||||||
if [ -n "${_JAVAVM_SAVE_PATH}" ]; then
|
if [ -n "${_JAVAVM_SAVE_PATH}" ]; then
|
||||||
|
@ -67,16 +78,16 @@ setJavaOptions () {
|
||||||
|
|
||||||
# Possible environment variables are stackable
|
# Possible environment variables are stackable
|
||||||
if [ -n "${JAVA_HOME_PROG_OPTS}" ]; then
|
if [ -n "${JAVA_HOME_PROG_OPTS}" ]; then
|
||||||
_JAVAVM_OPTS="${_JAVAVM_OPTS} ${JAVA_HOME_PROG_OPTS}"
|
_JAVAVM_OPTS="${JAVA_HOME_PROG_OPTS} ${_JAVAVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
if [ -n "${JAVA_HOME_OPTS}" ]; then
|
if [ -n "${JAVA_HOME_OPTS}" ]; then
|
||||||
_JAVAVM_OPTS="${_JAVAVM_OPTS} ${JAVA_HOME_OPTS}"
|
_JAVAVM_OPTS="${JAVA_HOME_OPTS} ${_JAVAVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
if [ -n "${PROG_OPTS}" ]; then
|
if [ -n "${PROG_OPTS}" ]; then
|
||||||
_JAVAVM_OPTS="${_JAVAVM_OPTS} ${PROG_OPTS}"
|
_JAVAVM_OPTS="${PROG_OPTS} ${_JAVAVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
if [ -n "${JAVAVM_OPTS}" ]; then
|
if [ -n "${JAVAVM_OPTS}" ]; then
|
||||||
_JAVAVM_OPTS="${_JAVAVM_OPTS} ${JAVAVM_OPTS}"
|
_JAVAVM_OPTS="${JAVAVM_OPTS} ${_JAVAVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue