Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Java2ScriptCompiler {
* The name of the J2S options file, aka as the "Dot-j2s" file.
*/
private static final String J2S_OPTIONS_FILE_NAME = ".j2s";

private static final String J2S_OPTIONS_ALT_FILE_CONF = "j2s.config.altfileproperty";

private int nResources, nSources, nJS, nHTML;

Expand Down Expand Up @@ -218,7 +220,51 @@ boolean initializeProject(IJavaProject project, boolean isCompilationParticipant
props = new Properties();
try {
File j2sFile = new File(projectFolder, J2S_OPTIONS_FILE_NAME);
props.load(new FileInputStream(j2sFile));
Properties j2sProps = new Properties();
j2sProps.load(new FileInputStream(j2sFile));
boolean j2sAltFileUsed = false;
if (j2sProps.getProperty(J2S_OPTIONS_ALT_FILE_CONF) != null) {
String j2sAltFileProperty = j2sProps
.getProperty(J2S_OPTIONS_ALT_FILE_CONF);
System.out.println(
"Alternative J2S configuration file property is set to '"
+ j2sAltFileProperty + "'");
String j2sAltFileName = System.getProperty(j2sAltFileProperty);
System.out
.println("Alternative J2S configuration file is set to '"
+ j2sAltFileName + "'");
if (j2sAltFileName != null) {
File j2sAltFile = new File(projectFolder, j2sAltFileName);
if (j2sAltFile.exists()) {
System.out
.println("Using alternative J2S configuration file '"
+ j2sAltFileName + "'");
props.load(new FileInputStream(j2sAltFile));
j2sAltFileUsed = true;
} else {
System.err.println(
"Alternative J2S configuration file property '"
+ j2sAltFileProperty + "' is set to '"
+ j2sAltFileName
+ "' but this file does not exist. Using original '"
+ J2S_OPTIONS_FILE_NAME + "' file.");
}
} else {
System.out.println(
"J2S did not find property value for j2s alt file property '"
+ j2sAltFileProperty + "'");
}
if (!j2sAltFileUsed) {
j2sProps.remove(J2S_OPTIONS_ALT_FILE_CONF);
props = j2sProps;
}
} else {
System.out.println("J2S did not find configuration for '"
+ J2S_OPTIONS_ALT_FILE_CONF + "' in "
+ j2sFile.getPath());
props = j2sProps;
}

String status = getProperty(J2S_COMPILER_STATUS, J2S_COMPILER_STATUS_ENABLED);
if (!J2S_COMPILER_STATUS_ENABLE.equalsIgnoreCase(status)
&& !J2S_COMPILER_STATUS_ENABLED.equalsIgnoreCase(status)) {
Expand Down