aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-04-07 16:07:40 +0000
committeraclement <aclement>2004-04-07 16:07:40 +0000
commit717e900e8aaa15a7ca2fcca7551a370838dc263f (patch)
treea83bf0df4d5429d6e4f064500a8cb7688b64ad61
parentc5537bf1f37d27f39ca729803f2d664167b3792d (diff)
downloadaspectj-717e900e8aaa15a7ca2fcca7551a370838dc263f.tar.gz
aspectj-717e900e8aaa15a7ca2fcca7551a370838dc263f.zip
Create aj and aj.bat launch scripts at install time.
-rw-r--r--build/src/$installer$/org/aspectj/Main.java125
-rw-r--r--lib/build/build.jarbin145200 -> 145724 bytes
2 files changed, 108 insertions, 17 deletions
diff --git a/build/src/$installer$/org/aspectj/Main.java b/build/src/$installer$/org/aspectj/Main.java
index 8652d0bb8..977ac46a3 100644
--- a/build/src/$installer$/org/aspectj/Main.java
+++ b/build/src/$installer$/org/aspectj/Main.java
@@ -1341,6 +1341,10 @@ class InstallPane extends WizardPane {
lsm.writeScript("ajdoc");
//lsm.writeScript("ajdb");
lsm.writeScript("ajbrowser");
+
+ // While the experimental aj(.bat) launch script is
+ // shipped in the docs path
+ lsm.writeAJLaunchScript();
}
if (hasGui()) {
progressBar.setValue(100);
@@ -1507,7 +1511,75 @@ class LaunchScriptMaker {
this.context = context;
}
- private void writeWindowsHeader(String className, PrintStream ps) {
+ /**
+ *
+ */
+ public void writeAJLaunchScript() throws IOException {
+ String name = "aj";
+ if (!context.onUnix()) {
+ if (context.onOS2()) {
+ name += ".cmd";
+ } else if (context.onWindows()) {
+ name += ".bat";
+ }
+ }
+
+ File destDir = new File(context.getOutputDir(), "doc/examples/ltw");
+ destDir.mkdirs();
+ File file = new File(destDir, name);
+
+ PrintStream ps = getPrintStream(file);
+ writeAJLaunchScriptContent(ps);
+ ps.close();
+
+ if (context.onUnix()) {
+ makeExecutable(file);
+ }
+ }
+
+ /**
+ * @param ps
+ */
+ private void writeAJLaunchScriptContent(PrintStream ps) {
+ if (context.onUnix()) {
+ writeUnixHeader(ps);
+ writeAJUnixLaunchLine(ps);
+ }
+ else {
+ writeWindowsHeader(ps);
+ writeAJWindowsLaunchLine(ps);
+ }
+ }
+
+ /**
+ * @param ps
+ */
+ private void writeAJWindowsLaunchLine(PrintStream ps) {
+ ps.println(
+ "\"%JAVA_HOME%\\bin\\java\" -classpath " +
+ "\"%ASPECTJ_HOME%\\lib\\aspectjtools.jar\"" +
+ " \"-Djava.system.class.loader=org.aspectj.weaver.WeavingURLClassLoader\"" +
+ " \"-Daj.class.path=%ASPECTPATH%;%CLASSPATH%\"" +
+ " \"-Daj.aspect.path=%ASPECTPATH%\"" +
+ " " + makeScriptArgs(false));
+ }
+
+ /**
+ * @param ps
+ */
+ private void writeAJUnixLaunchLine(PrintStream ps) {
+ String sep = File.pathSeparator;
+ ps.println(
+ "\"$JAVA_HOME/bin/java\" -classpath" +
+ " \"$ASPECTJ_HOME/lib/aspectjtools.jar\"" +
+ " \"-Djava.system.class.loader=org.aspectj.weaver.WeavingURLClassLoader\"" +
+ " \"-Daj.class.path=$ASPECTPATH:$CLASSPATH\"" +
+ " \"-Daj.aspect.path=$ASPECTPATH\"" +
+ " " +
+ makeScriptArgs(true));
+ }
+
+ private void writeWindowsHeader(PrintStream ps) {
ps.println("@echo off");
ps.println("REM This file generated by AspectJ installer");
ps.println("REM Created on "+new java.util.Date()+" by "+
@@ -1526,14 +1598,19 @@ class LaunchScriptMaker {
ps.println("echo java does not exist as %JAVA_HOME%\\bin\\java");
ps.println("echo please fix the JAVA_HOME environment variable");
ps.println(":haveJava");
- ps.println("\"%JAVA_HOME%\\bin\\java\" -classpath " +
-// "\"%ASPECTJ_HOME%\\lib\\aspectjtools.jar;%CLASSPATH%\""+
- "\"%ASPECTJ_HOME%\\lib\\aspectjtools.jar;%JAVA_HOME%\\lib\\tools.jar;%CLASSPATH%\""+
- " -Xmx64M " + className + //" -defaultClasspath " + "\"%CLASSPATH%\"" +
- " " + makeScriptArgs(false));
}
- private void writeUnixHeader(String className, PrintStream ps) {
+ private void writeWindowsLaunchLine(String className, PrintStream ps) {
+ ps.println("\"%JAVA_HOME%\\bin\\java\" -classpath " +
+ // "\"%ASPECTJ_HOME%\\lib\\aspectjtools.jar;%CLASSPATH%\""+
+ "\"%ASPECTJ_HOME%\\lib\\aspectjtools.jar;%JAVA_HOME%\\lib\\tools.jar;%CLASSPATH%\""
+ + " -Xmx64M "
+ + className
+ + //" -defaultClasspath " + "\"%CLASSPATH%\"" +
+ " " + makeScriptArgs(false));
+ }
+
+ private void writeUnixHeader(PrintStream ps) {
File binsh = new File(File.separator+"bin", "sh");
if (binsh.canRead()) {
ps.println("#!"+binsh.getPath());
@@ -1549,16 +1626,24 @@ class LaunchScriptMaker {
quote(true, false, context.getOutputDir()));
ps.println("fi");
ps.println("");
- String sep = File.pathSeparator;
-
- ps.println("\"$JAVA_HOME/bin/java\" -classpath "+
- "\"$ASPECTJ_HOME/lib/aspectjtools.jar" + sep +
- "$JAVA_HOME/lib/tools.jar" + sep +
- "$CLASSPATH\""+
- " -Xmx64M " + className +
- " " + makeScriptArgs(true));
}
+ private void writeUnixLaunchLine(
+ String className,
+ PrintStream ps) {
+ String sep = File.pathSeparator;
+ ps.println(
+ "\"$JAVA_HOME/bin/java\" -classpath "
+ + "\"$ASPECTJ_HOME/lib/aspectjtools.jar"
+ + sep
+ + "$JAVA_HOME/lib/tools.jar"
+ + sep
+ + "$CLASSPATH\""
+ + " -Xmx64M "
+ + className
+ + " "
+ + makeScriptArgs(true));
+ }
private void makeExecutable(File file) {
try {
@@ -1629,8 +1714,14 @@ class LaunchScriptMaker {
}
public void writeScript(String className, PrintStream ps, boolean unixStyle) throws IOException {
- if (unixStyle) writeUnixHeader(className, ps);
- else writeWindowsHeader(className, ps);
+ if (unixStyle) {
+ writeUnixHeader(ps);
+ writeUnixLaunchLine(className, ps);
+ }
+ else {
+ writeWindowsHeader(ps);
+ writeWindowsLaunchLine(className, ps);
+ }
/*
ps.print(quote(unixStyle, false, context.javaPath.getAbsolutePath()));
diff --git a/lib/build/build.jar b/lib/build/build.jar
index c83f1113e..eff04e2d0 100644
--- a/lib/build/build.jar
+++ b/lib/build/build.jar
Binary files differ