diff --git a/proposal/mutant/bootstrap.bat b/proposal/mutant/bootstrap.bat new file mode 100755 index 000000000..50a3f73f6 --- /dev/null +++ b/proposal/mutant/bootstrap.bat @@ -0,0 +1,29 @@ +@echo off +REM Copyright (c) 2000-2001 The Apache Software Foundation. All rights +REM reserved. + +REM cleanup curretn boot area +if exist bin rmdir /s/q bin +if exist bootstrap rmdir /s/q bootstrap +if exist dist rmdir /s/q dist + +REM compile init jar +mkdir bin\init +javac -d bin\init src\java\init\org\apache\ant\init\*.java + +REM compile bootstrap classes +mkdir bin\bootstrap +javac -classpath bin\init -d bin\bootstrap src\java\bootstrap\org\apache\ant\bootstrap\*.java + +REM compiler builder classes +mkdir bin\builder +javac -classpath bin\init;bin\bootstrap -d bin\builder src\java\bootstrap\org\apache\ant\builder\*.java + +REM run bootstrap +java -classpath bin\init;bin\bootstrap org.apache.ant.bootstrap.Bootstrap + +REM run full build using bootstrapped version +java -classpath bootstrap\lib\start.jar;bootstrap\lib\init.jar org.apache.ant.start.Main %* + +REM Use the full build as the build used by the build script +xcopy /s dist bootstrap diff --git a/proposal/mutant/bootstrap.sh b/proposal/mutant/bootstrap.sh index 082f850a7..eb418e850 100755 --- a/proposal/mutant/bootstrap.sh +++ b/proposal/mutant/bootstrap.sh @@ -4,7 +4,7 @@ # reserved. # cleanup curretn boot area -rm -rf bin bootstrap +rm -rf bin bootstrap dist # compile init jar mkdir -p bin/init diff --git a/proposal/mutant/build.bat b/proposal/mutant/build.bat new file mode 100755 index 000000000..8360aabd1 --- /dev/null +++ b/proposal/mutant/build.bat @@ -0,0 +1,5 @@ +@echo off +REM Copyright (c) 2000-2001 The Apache Software Foundation. All rights +REM reserved. + +java -classpath bootstrap\lib\start.jar;bootstrap\lib\init.jar org.apache.ant.start.Main %* diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java index e884917d1..16793a863 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java @@ -122,9 +122,12 @@ public class AntLibManager { if (antLibrarySpec != null) { String libraryId = antLibrarySpec.getLibraryId(); if (librarySpecs.containsKey(libraryId)) { + AntLibrarySpec currentSpec + = (AntLibrarySpec)librarySpecs.get(libraryId); throw new ExecutionException("Found more than one " - + "copy of library with id = " + libraryId + - " (" + libURLs[i] + ")"); + + "copy of library with id = " + libraryId + + " (" + libURLs[i] + ") + existing library at (" + + currentSpec.getLibraryURL() + ")"); } antLibrarySpec.setLibraryURL(libURLs[i]); librarySpecs.put(libraryId, antLibrarySpec); @@ -180,6 +183,28 @@ public class AntLibManager { } } + /** + * Load either a set of libraries or a single library. + * + * @param libLocationURL URL where libraries can be found + * @param librarySpecs A collection of library specs which will be + * populated with the libraries found + * @exception ExecutionException if the libraries cannot be loaded + * @exception MalformedURLException if the library's location cannot be + * formed + */ + public void loadLibs(Map librarySpecs, URL libLocationURL) + throws ExecutionException, MalformedURLException { + if (!libLocationURL.getProtocol().equals("file") + && !remoteAllowed) { + throw new ExecutionException("The config library " + + "location \"" + libLocationURL + + "\" cannot be used because config does " + + "not allow remote libraries"); + } + addAntLibraries(librarySpecs, libLocationURL); + } + /** * Load either a set of libraries or a single library. * @@ -196,15 +221,7 @@ public class AntLibManager { File libLocation = new File(libLocationString); if (!libLocation.exists()) { try { - URL libLocationURL = new URL(libLocationString); - if (!libLocationURL.getProtocol().equals("file") - && !remoteAllowed) { - throw new ExecutionException("The config library " - + "location \"" + libLocationString - + "\" cannot be used because config does " - + "not allow remote libraries"); - } - addAntLibraries(librarySpecs, libLocationURL); + loadLibs(librarySpecs, new URL(libLocationString)); } catch (MalformedURLException e) { // XXX } diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java index 401ccaebe..71f5c6a23 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java @@ -129,7 +129,7 @@ public class ExecutionManager { AntLibManager libManager = new AntLibManager(config.isRemoteLibAllowed()); - libManager.addAntLibraries(librarySpecs, standardLibsURL); + libManager.loadLibs(librarySpecs, standardLibsURL); libManager.configLibraries(initConfig, librarySpecs, antLibraries, config.getLibraryPathsMap()); @@ -161,6 +161,8 @@ public class ExecutionManager { throws AntException { Throwable buildFailureCause = null; try { + init(); + // start by validating the project we have been given. project.validate(); diff --git a/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java b/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java index 0f079d163..530c7fdb8 100644 --- a/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java +++ b/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java @@ -142,6 +142,7 @@ public class Builder { files.add(new File(TASKDEFS_ROOT, "Available.java")); files.add(new File(TASKDEFS_ROOT, "Mkdir.java")); files.add(new File(TASKDEFS_ROOT, "Copy.java")); + files.add(new File(TASKDEFS_ROOT, "Echo.java")); files.add(new File(TASKDEFS_ROOT, "MatchingTask.java")); files.add(new File(DEPEND_ROOT, "Depend.java")); files.add(new File(DEPEND_ROOT, "ClassFile.java")); diff --git a/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java b/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java index 4f171d0a9..f6381e8af 100755 --- a/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java +++ b/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java @@ -311,7 +311,6 @@ public class Commandline { } try { - executionManager.init(); executionManager.runBuild(project, targets, definedProperties); System.exit(0); } catch (Throwable t) {