From aac7e58448f0e5a961075baca670dac1ae53ce98 Mon Sep 17 00:00:00 2001
From: Andy Clement
Date: Fri, 1 Feb 2019 12:42:09 -0800
Subject: mavenizing build - wip
---
build/.classpath | 9 -
build/.cvsignore | 2 -
build/.isJava5 | 1 -
build/.project | 17 -
build/local.properties | 12 -
build/pom.xml | 33 +
build/src/$installer$/org/aspectj/Main.java | 1861 --------------------
.../internal/tools/ant/taskdefs/AJInstaller.java | 364 ++++
.../internal/tools/ant/taskdefs/AJPush.java | 91 +
.../internal/tools/ant/taskdefs/AntBuilder.java | 833 +++++++++
.../internal/tools/ant/taskdefs/BuildModule.java | 165 ++
.../internal/tools/ant/taskdefs/Checklics.java | 676 +++++++
.../tools/ant/taskdefs/ConditionalTask.java | 187 ++
.../ant/taskdefs/CopyAndInlineStylesheet.java | 120 ++
.../tools/ant/taskdefs/StripNonBodyHtml.java | 244 +++
.../tools/ant/taskdefs/TestBuildModule.java | 79 +
.../tools/ant/taskdefs/VersionUptodate.java | 144 ++
.../tools/ant/taskdefs/taskdefs.properties | 21 +
.../aspectj/internal/tools/build/BuildSpec.java | 80 +
.../aspectj/internal/tools/build/Builder.java | 676 +++++++
.../internal/tools/build/Builder.properties | 20 +
.../aspectj/internal/tools/build/Messager.java | 43 +
.../java./aspectj/internal/tools/build/Module.java | 754 ++++++++
.../aspectj/internal/tools/build/Modules.java | 66 +
.../internal/tools/build/ProductModule.java | 70 +
.../java./aspectj/internal/tools/build/Result.java | 387 ++++
.../internal/tools/build/SampleGatherer.java | 1049 +++++++++++
.../java./aspectj/internal/tools/build/Util.java | 483 +++++
.../aspectj/internal/tools/build/package.html | 12 +
.../main/java/$installer$/org/aspectj/Main.java | 1861 ++++++++++++++++++++
.../internal/tools/ant/taskdefs/AJInstaller.java | 364 ----
.../internal/tools/ant/taskdefs/AJPush.java | 91 -
.../internal/tools/ant/taskdefs/AntBuilder.java | 833 ---------
.../internal/tools/ant/taskdefs/BuildModule.java | 165 --
.../internal/tools/ant/taskdefs/Checklics.java | 676 -------
.../tools/ant/taskdefs/ConditionalTask.java | 187 --
.../ant/taskdefs/CopyAndInlineStylesheet.java | 120 --
.../tools/ant/taskdefs/StripNonBodyHtml.java | 244 ---
.../tools/ant/taskdefs/TestBuildModule.java | 79 -
.../tools/ant/taskdefs/VersionUptodate.java | 144 --
.../tools/ant/taskdefs/taskdefs.properties | 21 -
.../aspectj/internal/tools/build/BuildSpec.java | 80 -
.../org/aspectj/internal/tools/build/Builder.java | 676 -------
.../internal/tools/build/Builder.properties | 20 -
.../org/aspectj/internal/tools/build/Messager.java | 43 -
.../org/aspectj/internal/tools/build/Module.java | 754 --------
.../org/aspectj/internal/tools/build/Modules.java | 66 -
.../internal/tools/build/ProductModule.java | 70 -
.../org/aspectj/internal/tools/build/Result.java | 387 ----
.../internal/tools/build/SampleGatherer.java | 1049 -----------
.../src/org/aspectj/internal/tools/build/Util.java | 483 -----
.../org/aspectj/internal/tools/build/package.html | 12 -
.../java/org/aspectj/build/BuildModuleTests.java | 304 ++++
.../aspectj/internal/build/BuildClasspathTest.java | 67 +
.../aspectj/internal/build/BuildModuleTest.java | 468 +++++
.../org/aspectj/internal/build/ModulesTest.java | 304 ++++
.../aspectj/internal/tools/build/UtilsTest.01.MF | 8 +
.../aspectj/internal/tools/build/UtilsTest.02.MF | 9 +
.../aspectj/internal/tools/build/UtilsTest.03.MF | 9 +
.../aspectj/internal/tools/build/UtilsTest.java | 200 +++
.../org/aspectj/build/BuildModuleTests.java | 304 ----
.../aspectj/internal/build/BuildClasspathTest.java | 67 -
.../aspectj/internal/build/BuildModuleTest.java | 468 -----
.../org/aspectj/internal/build/ModulesTest.java | 304 ----
.../aspectj/internal/tools/build/UtilsTest.01.MF | 8 -
.../aspectj/internal/tools/build/UtilsTest.02.MF | 9 -
.../aspectj/internal/tools/build/UtilsTest.03.MF | 9 -
.../aspectj/internal/tools/build/UtilsTest.java | 200 ---
68 files changed, 9827 insertions(+), 9835 deletions(-)
delete mode 100644 build/.classpath
delete mode 100644 build/.cvsignore
delete mode 100644 build/.isJava5
delete mode 100644 build/.project
delete mode 100644 build/local.properties
create mode 100644 build/pom.xml
delete mode 100644 build/src/$installer$/org/aspectj/Main.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/AJInstaller.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/AJPush.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/AntBuilder.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/BuildModule.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/Checklics.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/ConditionalTask.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/CopyAndInlineStylesheet.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/StripNonBodyHtml.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/TestBuildModule.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/VersionUptodate.java
create mode 100644 build/src/main/java./aspectj/internal/tools/ant/taskdefs/taskdefs.properties
create mode 100644 build/src/main/java./aspectj/internal/tools/build/BuildSpec.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Builder.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Builder.properties
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Messager.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Module.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Modules.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/ProductModule.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Result.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/SampleGatherer.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/Util.java
create mode 100644 build/src/main/java./aspectj/internal/tools/build/package.html
create mode 100644 build/src/main/java/$installer$/org/aspectj/Main.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/AJPush.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/BuildModule.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/CopyAndInlineStylesheet.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/StripNonBodyHtml.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/TestBuildModule.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/VersionUptodate.java
delete mode 100644 build/src/org/aspectj/internal/tools/ant/taskdefs/taskdefs.properties
delete mode 100644 build/src/org/aspectj/internal/tools/build/BuildSpec.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Builder.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Builder.properties
delete mode 100644 build/src/org/aspectj/internal/tools/build/Messager.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Module.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Modules.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/ProductModule.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Result.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/SampleGatherer.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/Util.java
delete mode 100644 build/src/org/aspectj/internal/tools/build/package.html
create mode 100644 build/src/test/java/org/aspectj/build/BuildModuleTests.java
create mode 100644 build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java
create mode 100644 build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java
create mode 100644 build/src/test/java/org/aspectj/internal/build/ModulesTest.java
create mode 100644 build/src/test/java/org/aspectj/internal/tools/build/UtilsTest.01.MF
create mode 100644 build/src/test/java/org/aspectj/internal/tools/build/UtilsTest.02.MF
create mode 100644 build/src/test/java/org/aspectj/internal/tools/build/UtilsTest.03.MF
create mode 100644 build/src/test/java/org/aspectj/internal/tools/build/UtilsTest.java
delete mode 100644 build/testsrc/org/aspectj/build/BuildModuleTests.java
delete mode 100644 build/testsrc/org/aspectj/internal/build/BuildClasspathTest.java
delete mode 100644 build/testsrc/org/aspectj/internal/build/BuildModuleTest.java
delete mode 100644 build/testsrc/org/aspectj/internal/build/ModulesTest.java
delete mode 100644 build/testsrc/org/aspectj/internal/tools/build/UtilsTest.01.MF
delete mode 100644 build/testsrc/org/aspectj/internal/tools/build/UtilsTest.02.MF
delete mode 100644 build/testsrc/org/aspectj/internal/tools/build/UtilsTest.03.MF
delete mode 100644 build/testsrc/org/aspectj/internal/tools/build/UtilsTest.java
(limited to 'build')
diff --git a/build/.classpath b/build/.classpath
deleted file mode 100644
index 2eb26a332..000000000
--- a/build/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/build/.cvsignore b/build/.cvsignore
deleted file mode 100644
index 6654feb84..000000000
--- a/build/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-local.properties
diff --git a/build/.isJava5 b/build/.isJava5
deleted file mode 100644
index 136d06384..000000000
--- a/build/.isJava5
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/build/.project b/build/.project
deleted file mode 100644
index 1f143eab5..000000000
--- a/build/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- build
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/build/local.properties b/build/local.properties
deleted file mode 100644
index b93e1c816..000000000
--- a/build/local.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# for non-release builds, versions should all be DEVELOPMENT
-# except for build.version.base
-build.version=1.8.2
-build.version.base=1.8
-build.version.long=1.8.2
-build.version.short=1.8.2
-# Repo version is for maven (as built with 'ant repo')
-repo.version=1.6.4
-java11.home=c:/home/apps/jdk11
-java13.home=c:/home/apps/jdk13
-java14.home=c:/home/apps/jdk14
-java15.home=c:/home/apps/jdk15
diff --git a/build/pom.xml b/build/pom.xml
new file mode 100644
index 000000000..5dcf70b71
--- /dev/null
+++ b/build/pom.xml
@@ -0,0 +1,33 @@
+
+ 4.0.0
+
+
+ org.aspectj
+ aspectj-parent
+ 1.9.3.BUILD-SNAPSHOT
+ ..
+
+
+ build
+ jar
+ build
+
+
+
+ org.aspectj
+ testing-util
+ ${project.version}
+
+
+
+ ant
+ ant
+ 1.0
+ system
+ ${project.basedir}/../lib/ant/lib/ant.jar
+
+
+
+
diff --git a/build/src/$installer$/org/aspectj/Main.java b/build/src/$installer$/org/aspectj/Main.java
deleted file mode 100644
index 748b035ae..000000000
--- a/build/src/$installer$/org/aspectj/Main.java
+++ /dev/null
@@ -1,1861 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2000-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-package $installer$.org.aspectj;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.Icon;
-import javax.swing.JButton;
-import javax.swing.JEditorPane;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-import javax.swing.border.Border;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-
-/**
- * Invoke the Installer gui. There are two ways to run without GUI by passing parameters to main:
- *
- * pass -text {pathToPropertiesFile}
:
- *
- *
- * pass -to {pathToTargetDir}
:
- *
- * "-to".equals(arg[0])
- * arg[1] is the path to a writable install directory.
- *
- *
- */
-public class Main {
- public static void main(String[] args) {
- Options.loadArgs(args);
- boolean hasGui = true;
- Properties properties = new Properties();
- InputStream istream = null;
- try {
- istream = Main.class.getResourceAsStream(Installer.RESOURCE_DIR + "/properties.txt");
- if (istream == null) {
- System.err.println("unable to load properties.txt using Main.class - exiting");
- Main.exit(-1);
- }
- properties.load(istream);
- // when running outside GUI, load values into properties
- // so that property-value resolution works
- // (otherwise, could just set values below).
- // XXX not sure if this indirection is actually needed.
- if (null != Options.textProperties) {
- istream.close();
- istream = new FileInputStream(Options.textProperties);
- properties.load(istream);
- hasGui = false;
- } else if (null != Options.targetDir) {
- String path = null;
- try {
- path = Options.targetDir.getCanonicalPath();
- } catch (IOException e) {
- path = Options.targetDir.getAbsolutePath();
- }
- String javaPath = ConfigureLauncherPane.getDefaultJavaHomeLocation();
- if (null == javaPath) {
- System.err.println("using GUI - unable to find java");
- } else {
- properties.setProperty("output.dir", path);
- properties.setProperty("context.javaPath", javaPath);
- hasGui = false;
- }
- }
- } catch (IOException ioe) {
- handleException(ioe);
- } finally {
- if (null != istream) {
- try {
- istream.close();
- } catch (IOException e) {
- } // ignore
- }
- }
-
- try {
- String className = (String) properties.get("installer.main.class");
- //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- Installer installer = (Installer) Class.forName(className).newInstance();
- InstallContext installerContext = new InstallContext(properties);
- installerContext.setHasGui(hasGui);
- installer.setContext(installerContext);
- if (installerContext.hasGui()) { // let context force whether or not to run gui
- installer.runGUI();
- } else {
- // set output dir and java path in context after minimal validation
- String propName = "output.dir";
- String propValue = properties.getProperty(propName);
- if (null == propValue) {
- throw new Exception("expecting property " + propName);
- }
- String outputDirName = propValue;
- propName = "context.javaPath";
- propValue = properties.getProperty(propName);
- if (null == propValue) {
- throw new Exception("expecting property " + propName);
- }
- String javaPath = propValue;
- File outputDir = new File(outputDirName);
- if (!outputDir.isDirectory()) {
- throw new Exception("not a dir outputDirName: " + outputDirName + " dir: " + outputDir);
- }
- if (!outputDir.canWrite()) {
- throw new Exception("cannot write outputDirName: " + outputDirName + " dir: " + outputDir);
- }
- InstallContext context = installer.getContext(); // todo: why not use installerContext?
- context.setOutputDir(outputDir);
- context.javaPath = new File(javaPath);
- // todo: check javaPath for ... bin/java? lib/rt.jar?
- if (!outputDir.isDirectory() || !outputDir.canRead()) {
- throw new Exception("invalid javaPath: " + javaPath);
- }
- // directly set context and run
- WizardPane.setContext(installerContext);
- installer.run();
- }
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public static void handleException(Throwable e) {
- System.out.println("internal error: " + e.toString());
- e.printStackTrace();
- Main.exit(-1);
- }
-
- /** indirection for System.exit - todo apply cleanup here as necessary */
- public static void exit(int value) {
- System.exit(value);
- }
-} // class Main
-
-class Options {
- public static boolean verbose = false;
- public static String textProperties = null;
- public static File targetDir = null;
- public static boolean forceError1 = false;
- public static boolean forceError2 = false;
- public static boolean forceHandConfigure = false;
-
- public static void loadArgs(String[] args) {
- if (args == null) {
- return;
- }
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg == null) {
- continue;
- }
-
- if (arg.equals("-verbose")) {
- verbose = true;
- } else if (arg.equals("-forceError1")) {
- forceError1 = true;
- } else if (arg.equals("-forceError2")) {
- forceError2 = true;
- } else if (arg.equals("-forceHandConfigure")) {
- forceHandConfigure = true;
- } else if (arg.equals("-text")) {
- if (i + 1 < args.length) {
- textProperties = args[++i];
- }
- } else if (arg.equals("-to")) {
- String next = "no argument";
- if (i + 1 < args.length) {
- next = args[++i];
- File targDir = new File(next);
- if (targDir.isDirectory() && targDir.canWrite()) {
- targetDir = targDir;
- }
- }
- if (null == targetDir) {
- System.err.println("invalid -to dir: " + next);
- }
- }
- }
- }
-}
-
-/** tools installer installs the entire 1.1+ distribution */
-class ToolsInstaller extends Installer {
- public String getTitle() {
- return "Installer for AspectJ(TM)";
- }
-
- public String getPrefix() {
- return "tools";
- }
-
- public String getReadmeFilename() {
- return "README-AspectJ.html";
- }
-
- public ToolsInstaller() {
- InstallPane installPane = new InstallPane(true);
- setInstallPane(installPane);
- panes = new WizardPane[] { new IntroPane(), new ConfigureLauncherPane(), new LocationPane(), installPane, new FinishPane() };
- }
-}
-
-class DocsInstaller extends Installer {
- public String getTitle() {
- return "AspectJ(TM) Documentation and Examples Installer";
- }
-
- public String getPrefix() {
- return "docs";
- }
-
- public DocsInstaller() {
- InstallPane installPane = new InstallPane(false);
- setInstallPane(installPane);
- panes = new WizardPane[] { new IntroPane(), new LocationPane(), installPane, new FinishPane() };
- }
-}
-
-class AJDEForJBuilderInstaller extends Installer {
- public String getTitle() {
- return "AspectJ(TM) Support for JBuilder";
- }
-
- public String getPrefix() {
- return "ajdeForJBuilder";
- }
-
- public AJDEForJBuilderInstaller() {
- InstallPane installPane = new InstallPane(false);
- setInstallPane(installPane);
- panes = new WizardPane[] { new IntroPane(), new LocationPane() {
- public String getDefaultLocation() {
- if (context.onWindows()) {
- // check some default locations
- String[] paths = { "c:\\JBuilder6\\lib\\ext", "c:\\apps\\JBuilder6\\lib\\ext",
- "c:\\Program Files\\JBuilder6\\lib\\ext" };
- int pathIndex = 0;
- for (; pathIndex < paths.length; pathIndex++) {
- if (new File(paths[pathIndex]).exists()) {
- return paths[pathIndex];
- }
- }
- return "c:\\JBuilder6\\lib\\ext";
- } else {
- return "/usr/JBuilder6/lib/ext";
- }
- }
-
- /**
- * Make sure that the old jar file gets removed.
- */
- public void verify() {
- File jbuilder = new File(location.getText() + "/../../lib/jbuilder.jar");
- if (!jbuilder.exists() && hasGui()) {
- int ret = JOptionPane.showConfirmDialog(frame, "The location you specified does not seem to be a "
- + "valid JBuilder install directory." + " Continue?", "Confirm Install", JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (ret != JOptionPane.YES_OPTION) {
- Main.exit(-1);
- } else {
- // do nothing
- }
- }
-
- File oldFile = new File(location.getText() + "/ajbuilder.jar");
- if (oldFile.exists() && hasGui()) {
- int ret = JOptionPane.showConfirmDialog(frame,
- "This old version of AJDE for JBuilder (\"ajbuilder.jar\") exists"
- + " and must be removed from the install directory." + " OK to delete?", "Confirm Delete",
- JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
- if (ret != JOptionPane.YES_OPTION) {
- Main.exit(-1);
- } else {
- oldFile.delete();
- }
- }
- }
- }, installPane, new FinishPane() };
- }
-}
-
-class AJDEForForteInstaller extends Installer {
- public String getTitle() {
- return "AspectJ(TM) Support for Forte 4J";
- }
-
- public String getPrefix() {
- return "ajdeForForte";
- }
-
- private String installLoc = "";
-
- public AJDEForForteInstaller() {
- InstallPane installPane = new InstallPane(false);
- setInstallPane(installPane);
- panes = new WizardPane[] { new IntroPane(), new LocationPane() {
- public String getDefaultLocation() {
- if (context.onWindows()) {
- // check some default locations
- String[] paths = { "c:\\forte4j\\modules", "c:\\apps\\forte4j\\modules", "c:\\Program Files\\forte4j\\modules" };
- int pathIndex = 0;
- for (; pathIndex < paths.length; pathIndex++) {
- if (new File(paths[pathIndex]).exists()) {
- return paths[pathIndex];
- }
- }
- return "c:\\forte4j\\modules";
- } else {
- return "/usr/forte4j/modules";
- }
- }
-
- public void verify() {
- File forte = new File(location.getText() + "/../lib/openide.jar");
- installLoc = location.getText();
- if (!forte.exists() && hasGui()) {
- int ret = JOptionPane.showConfirmDialog(frame, "The location you specified does not seem to be a "
- + "valid Forte install directory." + " Continue?", "Confirm Install", JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (ret != JOptionPane.YES_OPTION) {
- Main.exit(-1);
- } else {
- // do nothing
- }
- }
- }
- }, installPane, new FinishPane() {
- public void finalActions() { // todo verify dir ../lib/ext exists?
- // !!! this should be done with two install locations, not by moving a file
- new File(installLoc + "/../lib/ext/aspectjrt.jar").delete();
- new File(installLoc + "/aspectjrt.jar").renameTo(new File((installLoc + "/../lib/ext/aspectjrt.jar")));
- new File(installLoc + "/aspectjrt.jar").delete();
- }
- } };
- }
-}
-
-class SrcInstaller extends Installer {
- public String getTitle() {
- return "AspectJ(TM) Compiler and Core Tools Sources Installer";
- }
-
- public String getPrefix() {
- return "sources";
- }
-
- public SrcInstaller() {
- InstallPane installPane = new InstallPane(false);
- setInstallPane(installPane);
- panes = new WizardPane[] { new IntroPane(), new LocationPane(), installPane, new FinishPane() };
- }
-}
-
-abstract class Installer {
- static final String EXIT_MESSAGE = "Are you sure you want to cancel the installation?";
- static final String EXIT_TITLE = "Exiting installer";
- /**
- * relative directory in jar from package $installer$.org.aspectj for loading resources - todo must be tracked during build
- */
- public static final String RESOURCE_DIR = "resources";
-
- JFrame frame;
- InstallContext context;
- /** special pane that actually does the installation */
- InstallPane installPane;
-
- public Installer() {
- }
-
- protected void setInstallPane(InstallPane installPane) {
- this.installPane = installPane;
- }
-
- public InstallPane getInstallPane() {
- return installPane;
- }
-
- /** directly run the install pane, if any */
- public void run() {
- if (null != installPane) {
- installPane.run();
- }
- }
-
- public abstract String getPrefix();
-
- public String getReadmeFilename() {
- return "README-" + getPrefix().toUpperCase() + ".html";
- }
-
- public void setContext(InstallContext context) {
- this.context = context;
- context.installer = this;
- }
-
- public InstallContext getContext() {
- return context;
- }
-
- public String getTitle() {
- return "AspectJ(TM) Installer";
- }
-
- public int getWidth() {
- return 640;
- }
-
- public int getHeight() {
- return 460;
- }
-
- protected WizardPane[] panes = new WizardPane[0];
-
- public WizardPane[] getPanes() {
- return panes;
- }
-
- public int findPaneIndex(WizardPane pane) {
- for (int i = 0; i < panes.length; i++) {
- if (panes[i] == pane) {
- return i;
- }
- }
- return -1;
- }
-
- Component header, footer, body;
-
- public void runGUI() {
- frame = new JFrame(getTitle());
- WindowListener wl = new WindowAdapter() {
- public void windowClosing(WindowEvent arg0) {
- Main.exit(-1); // -1 unless exiting through done button
- }
- };
- frame.addWindowListener(wl);
-
- if (Options.forceError1) {
- throw new RuntimeException("forced error1 for testing purposes");
- }
-
- Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
-
- int x = (int) (size.getWidth() - getWidth()) / 2;
- int y = (int) (size.getHeight() - getHeight()) / 2;
-
- //include a few sanity checks on starting position
- if (x < 0) {
- x = 0;
- }
- if (x > 600) {
- x = 600;
- }
- if (y < 0) {
- y = 0;
- }
- if (y > 400) {
- y = 400;
- }
-
- frame.setLocation(x, y);
- frame.setSize(getWidth(), getHeight());
- moveToPane(getPanes()[0]);
- frame.setVisible(true);
- }
-
- public void moveToPane(WizardPane pane) {
- WizardPane.setContext(this.context);
-
- Dimension size = frame.getContentPane().getSize();
-
- JPanel contents = new JPanel();
- contents.setLayout(new BorderLayout());
- header = makeHeader();
- contents.add(header, BorderLayout.NORTH);
-
- body = pane.getPanel();
- contents.add(body, BorderLayout.CENTER);
-
- footer = pane.getButtons();
- contents.add(footer, BorderLayout.SOUTH);
-
- contents.revalidate();
- contents.setSize(size);
-
- frame.setContentPane(contents);
-
- //XXX deal with threading here?
- pane.run();
- }
-
- public Icon loadImage(String name) {
- return new javax.swing.ImageIcon(this.getClass().getResource(name));
- }
-
- public Component makeHeader() {
- return new JLabel(loadImage(Installer.RESOURCE_DIR + "/aspectjBanner.gif"));
- }
-
- public ActionListener makeNextAction(final WizardPane pane) {
- int nextPaneIndex = findPaneIndex(pane) + 1;
- if (nextPaneIndex >= getPanes().length) {
- return null;
- }
-
- final WizardPane nextPane = getPanes()[nextPaneIndex];
- return new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- pane.finish();
- moveToPane(nextPane);
- }
- };
- }
-
- public ActionListener makeBackAction(final WizardPane pane) {
- int nextPaneIndex = findPaneIndex(pane) - 1;
- if (nextPaneIndex < 0) {
- return null;
- }
-
- final WizardPane nextPane = getPanes()[nextPaneIndex];
- return new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- moveToPane(nextPane);
- }
- };
- }
-
- public ActionListener makeCancelAction(WizardPane pane) {
- return new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- int ret = JOptionPane.showConfirmDialog(frame, EXIT_MESSAGE, EXIT_TITLE, JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (ret == JOptionPane.YES_OPTION) {
- Main.exit(-1);
- }
- }
- };
- }
-
- public ActionListener makeFinishAction(WizardPane pane) {
- return new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Main.exit(0);
- }
- };
- }
-}
-
-// willing to go up to 3 levels deep to find either jre or jdk
-
-// jre\[*\]lib\ext
-// jdk*\lib\tools.jar
-
-/*****
- * final static int MAX_DEPTH = 4; public static void findPaths(String prefix, File currentDir, int currentDepth) { if (currentDepth
- * > MAX_DEPTH) return; if (!currentDir.exists() || !currentDir.isDirectory()) return; File [] files = currentDir.listFiles(); if
- * (files == null) return; for (int i=0; i");
- int stopIndex = text.indexOf("");
- if (startIndex == -1 || stopIndex == -1) {
- return text;
- }
- stopIndex += 7;
- return text.substring(0, startIndex) + text.substring(stopIndex);
- }
-
- static String styleHeader = "";/*
- * ");
+ }
+
+
+ private static boolean isStyleSheet(String line) throws IOException {
+ line = line.toLowerCase();
+ int len = line.length();
+ int i = 0;
+
+ while (true) {
+ if (i == len) return false;
+ if (! Character.isWhitespace(line.charAt(i))) break;
+ }
+
+ return line.startsWith(" This task can take the following arguments:
+ *
+ *
+ * srcdir
+ * destdir
+ * include
+ * exclude
+ *
+ *
+ * Of these arguments, only sourcedir is required.
+ *
+ * When this task executes, it will scan the srcdir based on the
+ * include and exclude properties.
+ */
+
+public class StripNonBodyHtml extends MatchingTask {
+
+ private File srcDir;
+ private File destDir = null;
+
+ public void setSrcdir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public void setDestdir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ public void execute() throws BuildException {
+ if (srcDir == null) {
+ throw new BuildException("srcdir attribute must be set!");
+ }
+ if (!srcDir.exists()) {
+ throw new BuildException("srcdir does not exist!");
+ }
+ if (!srcDir.isDirectory()) {
+ throw new BuildException("srcdir is not a directory!");
+ }
+ if (destDir != null) {
+ if (!destDir.exists()) {
+ throw new BuildException("destdir does not exist!");
+ }
+ if (!destDir.isDirectory()) {
+ throw new BuildException("destdir is not a directory!");
+ }
+ }
+
+ DirectoryScanner ds = super.getDirectoryScanner(srcDir);
+ String[] files = ds.getIncludedFiles();
+
+ log("stripping " + files.length + " files");
+ int stripped = 0;
+ for (int i = 0, len = files.length; i < len; i++) {
+ if (processFile(files[i])) {
+ stripped++;
+ } else {
+ log(files[i] + " not stripped");
+ }
+ }
+ log(stripped + " files successfully stripped");
+ }
+
+ boolean processFile(String filename) throws BuildException {
+ File srcFile = new File(srcDir, filename);
+ File destFile;
+ if (destDir == null) {
+ destFile = srcFile;
+ } else {
+ destFile = new File(destDir, filename);
+ destFile.getParentFile().mkdirs();
+ }
+ try {
+ return strip(srcFile, destFile);
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ private boolean strip(File f, File g) throws IOException {
+ BufferedInputStream in =
+ new BufferedInputStream(new FileInputStream(f));
+ String s = readToString(in);
+ in.close();
+ return writeBodyTo(s, g);
+ }
+
+ private ByteArrayOutputStream temp = new ByteArrayOutputStream();
+ private byte[] buf = new byte[2048];
+
+ private String readToString(InputStream in) throws IOException {
+ ByteArrayOutputStream temp = this.temp;
+ byte[] buf = this.buf;
+ String s = "";
+ try {
+ while (true) {
+ int i = in.read(buf, 0, 2048);
+ if (i == -1) break;
+ temp.write(buf, 0, i);
+
+ }
+ s = temp.toString();
+ } finally {
+ temp.reset();
+ }
+ return s;
+ }
+
+ private boolean writeBodyTo(String s, File f) throws IOException {
+ int start;//, end;
+ try {
+ start = findStart(s);
+ findEnd(s, start);
+ } catch (ParseException e) {
+ return false; // if we get confused, just don't write the file.
+ }
+ s = processBody(s,f);
+ BufferedOutputStream out =
+ new BufferedOutputStream(new FileOutputStream(f));
+
+ out.write(s.getBytes());
+ out.close();
+ return true;
+ }
+
+ /**
+ * Process body. This implemenation strips text
+ * between <!-- start strip -->
+ * and <!-- end strip -->
+ * inclusive.
+ */
+ private String processBody(String body, File file) {
+ if (null == body) return body;
+ final String START = "";
+ final String END = "";
+ return stripTags(body, file.toString(), START, END);
+ }
+
+ /**
+ * Strip 0..n substrings in input: "s/${START}.*${END}//g"
+ * @param input the String to strip
+ * @param source the name of the source for logging purposes
+ * @param start the starting tag (case sensitive)
+ * @param end the ending tag (case sensitive)
+ */
+ String stripTags(String input, final String SOURCE,
+ final String START, final String END) {
+ if (null == input) return input;
+ StringBuffer buffer = new StringBuffer(input.length());
+ String result = input;
+ int curLoc = 0;
+ while (true) {
+ int startLoc = input.indexOf(START, curLoc);
+ if (-1 == startLoc) {
+ buffer.append(input.substring(curLoc));
+ result = buffer.toString();
+ break; // <------------ valid exit
+ } else {
+ int endLoc = input.indexOf(END, startLoc);
+ if (-1 == endLoc) {
+ log(SOURCE + " stripTags - no end tag - startLoc=" + startLoc);
+ break; // <------------ invalid exit
+ } else if (endLoc < startLoc) {
+ log(SOURCE + " stripTags - impossible: startLoc="
+ + startLoc + " > endLoc=" + endLoc);
+ break; // <------------ invalid exit
+ } else {
+ buffer.append(input.substring(curLoc, startLoc));
+ curLoc = endLoc + END.length();
+ }
+ }
+ }
+ return result;
+ }
+
+ private int findStart(String s) throws ParseException {
+ int len = s.length();
+ int start = 0;
+ while (true) {
+ start = s.indexOf("= len) throw barf();
+ char ch = s.charAt(start);
+ if (ch == '>') return start + 1;
+ if (Character.isWhitespace(ch)) {
+ start = s.indexOf('>', start);
+ if (start == -1) return -1;
+ return start + 1;
+ }
+ }
+ }
+
+ private int findEnd(String s, int start) throws ParseException {
+ int end;
+ end = s.indexOf("", start);
+ if (end == -1) {
+ end = s.indexOf("