Permalink
Browse files

Fixed problem with parameters only needed for first setup of the boot…

… module loader being passed on subsequent invocations.

Now obtaining the Ceylon system version from the System properties.
  • Loading branch information...
quintesse committed Feb 26, 2013
1 parent 681f58a commit 5cea38b9f939d29eac3d8b3f41e31008dae41351
Showing with 27 additions and 13 deletions.
  1. +27 −13 bootstrap/src/main/java/ceylon/modules/bootstrap/CeylonRunTool.java
@@ -21,7 +21,6 @@
import java.util.Collections;
import java.util.List;
-import com.redhat.ceylon.common.Versions;
import com.redhat.ceylon.common.tool.Argument;
import com.redhat.ceylon.common.tool.Description;
import com.redhat.ceylon.common.tool.Option;
@@ -47,7 +46,7 @@
)
public class CeylonRunTool implements Tool {
private static final String CEYLON_RUNTIME = "ceylon.runtime";
- private static final String FULL_CEYLON_RUNTIME = CEYLON_RUNTIME + ":" + Versions.CEYLON_VERSION_NUMBER;
+
private static volatile Module runtimeModule;
private String moduleNameOptVersion;
@@ -108,19 +107,15 @@ public void setVerbose(String verboseFlags) {
public void run() {
ArrayList<String> argList = new ArrayList<String>();
+ String ceylonVersion = System.getProperty("ceylon.system.version");
+
String sysRep;
if (systemRepo != null) {
sysRep = systemRepo;
} else {
sysRep = System.getProperty("ceylon.system.repo");
}
- argList.addAll(Arrays.asList(
- "-mp", sysRep,
- FULL_CEYLON_RUNTIME,
- "+executable", "ceylon.modules.jboss.runtime.JBossRuntime")
- );
-
if (run != null) {
argList.add("-run");
argList.add(run);
@@ -150,20 +145,19 @@ public void run() {
argList.addAll(args);
try {
- String[] args = argList.toArray(new String[argList.size()]);
if (runtimeModule == null) {
synchronized (ModuleLoader.class) {
if (runtimeModule == null) {
- org.jboss.modules.Main.main(args);
+ org.jboss.modules.Main.main(setupArguments(argList, sysRep, ceylonVersion));
// set runtime module
ModuleLoader ml = Module.getBootModuleLoader();
- runtimeModule = ml.loadModule(ModuleIdentifier.create(CEYLON_RUNTIME, Versions.CEYLON_VERSION_NUMBER));
+ runtimeModule = ml.loadModule(ModuleIdentifier.create(CEYLON_RUNTIME, ceylonVersion));
} else {
- runtimeModule.run(args);
+ runtimeModule.run(moduleArguments(argList));
}
}
} else {
- runtimeModule.run(args);
+ runtimeModule.run(moduleArguments(argList));
}
} catch (Error err) {
throw err;
@@ -173,4 +167,24 @@ public void run() {
throw new RuntimeException(t);
}
}
+
+ private String[] setupArguments(List<String> argList, String sysRep, String ceylonVersion) {
+ ArrayList<String> setupArgs = new ArrayList<String>();
+ setupArgs.addAll(Arrays.asList(
+ "-mp", sysRep,
+ CEYLON_RUNTIME + ":" + ceylonVersion,
+ "+executable", "ceylon.modules.jboss.runtime.JBossRuntime"));
+ setupArgs.addAll(argList);
+ String[] args = setupArgs.toArray(new String[setupArgs.size()]);
+ return args;
+ }
+
+ private String[] moduleArguments(List<String> argList) {
+ ArrayList<String> moduleArgs = new ArrayList<String>();
+ moduleArgs.addAll(Arrays.asList(
+ "+executable", "ceylon.modules.jboss.runtime.JBossRuntime"));
+ moduleArgs.addAll(argList);
+ String[] args = moduleArgs.toArray(new String[moduleArgs.size()]);
+ return args;
+ }
}

0 comments on commit 5cea38b

Please sign in to comment.