@@ -820,8 +820,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
return; | return; | ||||
} | } | ||||
// set explicitly before starting ? | // set explicitly before starting ? | ||||
if (project.getProperty("basedir") != null) { | |||||
project.setBasedir(project.getProperty("basedir")); | |||||
if (project.getProperty(MagicNames.PROJECT_BASEDIR) != null) { | |||||
project.setBasedir(project.getProperty(MagicNames.PROJECT_BASEDIR)); | |||||
} else { | } else { | ||||
// Default for baseDir is the location of the build file. | // Default for baseDir is the location of the build file. | ||||
if (baseDir == null) { | if (baseDir == null) { | ||||
@@ -28,6 +28,7 @@ import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.IntrospectionHelper; | import org.apache.tools.ant.IntrospectionHelper; | ||||
import org.apache.tools.ant.Location; | import org.apache.tools.ant.Location; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.ProjectHelper; | import org.apache.tools.ant.ProjectHelper; | ||||
import org.apache.tools.ant.RuntimeConfigurable; | import org.apache.tools.ant.RuntimeConfigurable; | ||||
@@ -423,8 +424,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
helperImpl.project.addReference(id, helperImpl.project); | helperImpl.project.addReference(id, helperImpl.project); | ||||
} | } | ||||
if (helperImpl.project.getProperty("basedir") != null) { | |||||
helperImpl.project.setBasedir(helperImpl.project.getProperty("basedir")); | |||||
if (helperImpl.project.getProperty(MagicNames.PROJECT_BASEDIR) != null) { | |||||
helperImpl.project.setBasedir(helperImpl.project.getProperty(MagicNames.PROJECT_BASEDIR)); | |||||
} else { | } else { | ||||
if (baseDir == null) { | if (baseDir == null) { | ||||
helperImpl.project.setBasedir(helperImpl.buildFileParent.getAbsolutePath()); | helperImpl.project.setBasedir(helperImpl.buildFileParent.getAbsolutePath()); | ||||
@@ -595,7 +595,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
if (JavaEnvUtils.isKaffe()) { | if (JavaEnvUtils.isKaffe()) { | ||||
// newer versions of Kaffe (1.1.1+) won't have this, | // newer versions of Kaffe (1.1.1+) won't have this, | ||||
// but this will be sorted by FileSet anyway. | // but this will be sorted by FileSet anyway. | ||||
File kaffeShare = new File(System.getProperty("java.home") | |||||
File kaffeShare = new File(JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "share" | + File.separator + "share" | ||||
+ File.separator + "kaffe"); | + File.separator + "kaffe"); | ||||
if (kaffeShare.isDirectory()) { | if (kaffeShare.isDirectory()) { | ||||
@@ -612,57 +612,44 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
// TODO is this code still necessary? is there any 1.2+ port? | // TODO is this code still necessary? is there any 1.2+ port? | ||||
// Pull in *.zip from packages directory | // Pull in *.zip from packages directory | ||||
FileSet msZipFiles = new FileSet(); | FileSet msZipFiles = new FileSet(); | ||||
msZipFiles.setDir(new File(System.getProperty("java.home") | |||||
+ File.separator + "Packages")); | |||||
msZipFiles.setDir(new File(JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "Packages")); | |||||
msZipFiles.setIncludes("*.ZIP"); | msZipFiles.setIncludes("*.ZIP"); | ||||
addFileset(msZipFiles); | addFileset(msZipFiles); | ||||
} else { | } else { | ||||
// JDK 1.2+ seems to set java.home to the JRE directory. | // JDK 1.2+ seems to set java.home to the JRE directory. | ||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "lib" + File.separator + "rt.jar")); | |||||
// Just keep the old version as well and let addExisting | // Just keep the old version as well and let addExisting | ||||
// sort it out. | // sort it out. | ||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "jre" | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "jre" + File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Sun's and Apple's 1.4 have JCE and JSSE in separate jars. | // Sun's and Apple's 1.4 have JCE and JSSE in separate jars. | ||||
for (String secJar : Arrays.asList("jce", "jsse")) { | for (String secJar : Arrays.asList("jce", "jsse")) { | ||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + secJar + ".jar")); | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + secJar + ".jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "lib" | |||||
+ File.separator + secJar + ".jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + ".." + File.separator + "Classes" | |||||
+ File.separator + secJar + ".jar")); | |||||
} | } | ||||
// IBM's 1.4 has rt.jar split into 4 smaller jars and a combined | // IBM's 1.4 has rt.jar split into 4 smaller jars and a combined | ||||
// JCE/JSSE in security.jar. | // JCE/JSSE in security.jar. | ||||
for (String ibmJar : Arrays.asList("core", "graphics", "security", "server", "xml")) { | for (String ibmJar : Arrays.asList("core", "graphics", "security", "server", "xml")) { | ||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + ibmJar + ".jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + "lib" + File.separator + ibmJar + ".jar")); | |||||
} | } | ||||
// Added for MacOS X | // Added for MacOS X | ||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "classes.jar")); | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "ui.jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + ".." + File.separator + "Classes" | |||||
+ File.separator + "classes.jar")); | |||||
addExisting(new Path(null, JavaEnvUtils.getJavaHome() | |||||
+ File.separator + ".." + File.separator + "Classes" | |||||
+ File.separator + "ui.jar")); | |||||
} | } | ||||
} | } | ||||
@@ -23,6 +23,7 @@ import static org.junit.Assume.assumeFalse; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Rule; | import org.junit.Rule; | ||||
@@ -78,7 +79,8 @@ public class DirnameTest { | |||||
@Test | @Test | ||||
public void test5() { | public void test5() { | ||||
buildRule.executeTarget("test5"); | buildRule.executeTarget("test5"); | ||||
assertEquals("dirname failed", buildRule.getProject().getProperty("basedir"), | |||||
assertEquals("dirname failed", | |||||
buildRule.getProject().getProperty(MagicNames.PROJECT_BASEDIR), | |||||
buildRule.getProject().getProperty("base.dir")); | buildRule.getProject().getProperty("base.dir")); | ||||
} | } | ||||
@@ -26,6 +26,7 @@ import static org.junit.Assume.assumeNoException; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Rule; | import org.junit.Rule; | ||||
@@ -83,7 +84,7 @@ public class PropertyTest { | |||||
@Test | @Test | ||||
public void test5() { | public void test5() { | ||||
String baseDir = buildRule.getProject().getProperty("basedir"); | |||||
String baseDir = buildRule.getProject().getProperty(MagicNames.PROJECT_BASEDIR); | |||||
String uri = FILE_UTILS.toURI(baseDir + "/property3.properties"); | String uri = FILE_UTILS.toURI(baseDir + "/property3.properties"); | ||||
buildRule.getProject().setNewProperty("test5.url", uri); | buildRule.getProject().setNewProperty("test5.url", uri); | ||||
@@ -51,7 +51,7 @@ public class JavaEnvUtilsTest { | |||||
@Test | @Test | ||||
public void testGetExecutableWindows() { | public void testGetExecutableWindows() { | ||||
assumeTrue("Test only runs on windows", Os.isFamily("windows")); | assumeTrue("Test only runs on windows", Os.isFamily("windows")); | ||||
String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")) | |||||
String javaHome = FILE_UTILS.normalize(JavaEnvUtils.getJavaHome()) | |||||
.getAbsolutePath(); | .getAbsolutePath(); | ||||
String j = JavaEnvUtils.getJreExecutable("java"); | String j = JavaEnvUtils.getJreExecutable("java"); | ||||
@@ -89,7 +89,7 @@ public class JavaEnvUtilsTest { | |||||
public void testGetExecutableMostPlatforms() { | public void testGetExecutableMostPlatforms() { | ||||
assumeFalse("Test only runs on non Netware and non Windows systems", | assumeFalse("Test only runs on non Netware and non Windows systems", | ||||
Os.isName("netware") || Os.isFamily("windows")); | Os.isName("netware") || Os.isFamily("windows")); | ||||
String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")).getAbsolutePath(); | |||||
String javaHome = FILE_UTILS.normalize(JavaEnvUtils.getJavaHome()).getAbsolutePath(); | |||||
// could still be OS/2 | // could still be OS/2 | ||||
String extension = Os.isFamily("dos") ? ".exe" : ""; | String extension = Os.isFamily("dos") ? ".exe" : ""; | ||||