Skip to content

Commit 27bdb57

Browse files
committed
Fixed new-line problems and path specification for java-options.conf in
batch file
1 parent 200d27f commit 27bdb57

File tree

3 files changed

+69
-65
lines changed

3 files changed

+69
-65
lines changed

.gitattributes

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
*.bat eol=crlf
1818
*.sh eol=lf
1919

20+
# The batch script can only handle the config
21+
# properly if it uses crlf as end-of-line marker:
22+
src/main/config/java-options.conf eol=crlf
23+
2024
# Denote all files that are truly binary and should not be modified:
2125
*.bz2 binary
2226
*.bzip2 binary
2327
*.gz binary
2428
*.gzip binary
25-
*.xz binary
29+
*.xz binary

src/main/config/java-options.conf

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# JVM options in this file are passed to the java command.
2-
# Environment variables can be specified by prefixing them
3-
# with $ (e.g. $VAR). The variable $METAFACTURE_HOME refers
4-
# to the folder containing the flux start-up script.
5-
# Undefined variables remain in the configuration.
6-
7-
-Xmx512m
8-
-Dlog4j.configuration="file:///$METAFACTURE_HOME/config/log4j.xml"
9-
10-
# Append additional options defined in the
11-
# environment (The start-up script ensures
12-
# that this variable is always defined):
13-
$FLUX_JAVA_OPTIONS
1+
# JVM options in this file are passed to the java command.
2+
# Environment variables can be specified by prefixing them
3+
# with $ (e.g. $VAR). The variable $METAFACTURE_HOME refers
4+
# to the folder containing the flux start-up script.
5+
# Undefined variables remain in the configuration.
6+
7+
-Xmx512m
8+
-Dlog4j.configuration="file:///$METAFACTURE_HOME/config/log4j.xml"
9+
10+
# Append additional options defined in the
11+
# environment (The start-up script ensures
12+
# that this variable is always defined):
13+
$FLUX_JAVA_OPTIONS

src/main/scripts/flux.bat

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
@ECHO OFF
2-
3-
SETLOCAL EnableDelayedExpansion
4-
5-
SET METAFACTURE_HOME=%~dp0
6-
7-
REM Use the java command available on the path by default.
8-
REM Define FLUX_JAVA_BIN in your environment to use a
9-
REM different executable.
10-
IF "x%FLUX_JAVA_BIN%" == "x" (
11-
SET FLUX_JAVA_BIN=java
12-
)
13-
14-
SET JAVA_OPTS_FILE="%METAFACTURE_HOME%/config/java-options.conf"
15-
SET JAR_FILE="%METAFACTURE_HOME%${project.build.finalName}.jar"
16-
17-
REM Read JVM options from configuration file. Lines starting
18-
REM with # are treated as comments. Empty lines are ignored.
19-
REM
20-
REM The space character at the end of the following
21-
REM line is important and must not be removed:
22-
SET JAVA_OPTS=
23-
<%JAVA_OPTS_FILE% (
24-
FOR /F %%I IN ('FINDSTR /N "^" %JAVA_OPTS_FILE%') DO (
25-
SET /P LINE=
26-
IF NOT "x!LINE!" == "x" (
27-
SET FIRST=!LINE:~0,1!
28-
IF NOT "!FIRST!" == "#" (
29-
SET JAVA_OPTS=!JAVA_OPTS! !LINE!
30-
)
31-
)
32-
SET LINE=
33-
)
34-
)
35-
36-
REM Substitute environment variables in the configuration.
37-
REM Undefined variables remain in the configuration. Since
38-
REM FLUX_JAVA_OPTIONS is included in the configuration by
39-
REM default we make sure that it can always be substituted.
40-
IF "x%FLUX_JAVA_OPTIONS%" == "x" (
41-
REM The space character at the end of the following
42-
REM line is important and must not be removed:
43-
SET FLUX_JAVA_OPTIONS=
44-
)
45-
FOR /F "tokens=1,* delims==" %%I IN ('SET') DO (
46-
SET JAVA_OPTS=!JAVA_OPTS:$%%I=%%J!
47-
)
48-
49-
REM Start flux:
50-
%FLUX_JAVA_BIN% !JAVA_OPTS! -jar %JAR_FILE% %*
51-
1+
@ECHO OFF
2+
3+
SETLOCAL EnableDelayedExpansion
4+
5+
SET METAFACTURE_HOME=%~dp0
6+
7+
REM Use the java command available on the path by default.
8+
REM Define FLUX_JAVA_BIN in your environment to use a
9+
REM different executable.
10+
IF "x%FLUX_JAVA_BIN%" == "x" (
11+
SET FLUX_JAVA_BIN=java
12+
)
13+
14+
SET JAVA_OPTS_FILE="%METAFACTURE_HOME%\config\java-options.conf"
15+
SET JAR_FILE="%METAFACTURE_HOME%${project.build.finalName}.jar"
16+
17+
REM Read JVM options from configuration file. Lines starting
18+
REM with # are treated as comments. Empty lines are ignored.
19+
REM
20+
REM The space character at the end of the following
21+
REM line is important and must not be removed:
22+
SET JAVA_OPTS=
23+
<%JAVA_OPTS_FILE% (
24+
FOR /F %%I IN ('FINDSTR /N "^" %JAVA_OPTS_FILE%') DO (
25+
SET /P LINE=
26+
IF NOT "x!LINE!" == "x" (
27+
SET FIRST=!LINE:~0,1!
28+
IF NOT "!FIRST!" == "#" (
29+
SET JAVA_OPTS=!JAVA_OPTS! !LINE!
30+
)
31+
)
32+
SET LINE=
33+
)
34+
)
35+
36+
REM Substitute environment variables in the configuration.
37+
REM Undefined variables remain in the configuration. Since
38+
REM FLUX_JAVA_OPTIONS is included in the configuration by
39+
REM default we make sure that it can always be substituted.
40+
IF "x%FLUX_JAVA_OPTIONS%" == "x" (
41+
REM The space character at the end of the following
42+
REM line is important and must not be removed:
43+
SET FLUX_JAVA_OPTIONS=
44+
)
45+
FOR /F "tokens=1,* delims==" %%I IN ('SET') DO (
46+
SET JAVA_OPTS=!JAVA_OPTS:$%%I=%%J!
47+
)
48+
49+
REM Start flux:
50+
%FLUX_JAVA_BIN% !JAVA_OPTS! -jar %JAR_FILE% %*
51+
5252
ENDLOCAL

0 commit comments

Comments
 (0)