brett 2003/08/18 03:25:12 Modified: src/java/org/apache/maven Tag: MAVEN_RC1_STABLE DependencyClasspathBuilder.java MavenUtils.java src/java/org/apache/maven/jelly/tags/maven Tag: MAVEN_RC1_STABLE MavenTagLibrary.java src/java/org/apache/maven/project Tag: MAVEN_RC1_STABLE Build.java Dependency.java Project.java Resource.java src/java/org/apache/maven/repository Tag: MAVEN_RC1_STABLE DefaultArtifactFactory.java src/plugins-build/ant/src/plugin-resources/templates Tag: MAVEN_RC1_STABLE build.jelly src/plugins-build/eclipse/src/plugin-resources/templates Tag: MAVEN_RC1_STABLE classpath.jelly src/plugins-build/jalopy Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/jbuilder Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/jdee Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/jdiff Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/jellydoc/xdocs Tag: MAVEN_RC1_STABLE changes.xml src/plugins-build/junitdoclet Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/jxr Tag: MAVEN_RC1_STABLE plugin.jelly src/plugins-build/simian Tag: MAVEN_RC1_STABLE plugin.jelly src/test/extend/child_project Tag: MAVEN_RC1_STABLE project-child2.xml src/test/java/org/apache/maven Tag: MAVEN_RC1_STABLE MavenUtilsTest.java src/test/java/org/apache/maven/project Tag: MAVEN_RC1_STABLE BuildTest.java ProjectInheritanceTest.java src/test/touchstone-build Tag: MAVEN_RC1_STABLE maven.xml Added: src/java/org/apache/maven/jelly/tags/maven Tag: MAVEN_RC1_STABLE MakeAbsolutePathTag.java MakeRelativePathTag.java src/test/basedir Tag: MAVEN_RC1_STABLE project.xml src/test/basedir/extend-1 Tag: MAVEN_RC1_STABLE project.xml src/test/basedir/extend-2 Tag: MAVEN_RC1_STABLE project.xml src/test/java/org/apache/maven/project Tag: MAVEN_RC1_STABLE BasedirTest.java Log: PR: MAVEN-522 clarification of POM elements that use paths. Revision Changes Path No revision No revision 1.11.2.1 +2 -2 maven/src/java/org/apache/maven/Attic/DependencyClasspathBuilder.java Index: DependencyClasspathBuilder.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/Attic/DependencyClasspathBuilder.java,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -r1.11 -r1.11.2.1 --- DependencyClasspathBuilder.java 29 Jun 2003 17:25:34 -0000 1.11 +++ DependencyClasspathBuilder.java 18 Aug 2003 10:25:10 -0000 1.11.2.1 @@ -98,7 +98,7 @@ Dependency d = artifact.getDependency(); // Only add jar or ejb (MAVEN-512) dependencies to the classpath - if ( d.getType().equals("jar") || d.getType().equals("ejb") ) + if ( d.isAddedToClasspath() ) { classpath.append( artifact.getPath() ).append( cps ); project.setDependencyPath( d.getId(), artifact.getPath() ); 1.94.2.4 +45 -3 maven/src/java/org/apache/maven/MavenUtils.java Index: MavenUtils.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/MavenUtils.java,v retrieving revision 1.94.2.3 retrieving revision 1.94.2.4 diff -u -r1.94.2.3 -r1.94.2.4 --- MavenUtils.java 13 Aug 2003 06:37:43 -0000 1.94.2.3 +++ MavenUtils.java 18 Aug 2003 10:25:10 -0000 1.94.2.4 @@ -210,6 +210,7 @@ // <extend>${basedir}/../project.xml</extend> Expression e = JellyUtils.decomposeExpression( pomToExtend, mavenExpressionFactory, context ); pomToExtend = e.evaluateAsString( context ); + pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend ); File parentPom = new File( pomToExtend ); @@ -568,7 +569,7 @@ * * @return Betwixt XMLIntrospector */ - public static XMLIntrospector createXMLIntrospector() + private static XMLIntrospector createXMLIntrospector() { XMLIntrospector introspector = new XMLIntrospector(); @@ -945,7 +946,9 @@ /** * Process the body of this element. * - * @param value body + * @param namespace the namespace + * @param name the tag name + * @param text the body text * @throws Exception when any errors occur */ public void body(String namespace, String name, String text) @@ -1027,5 +1030,44 @@ "${1}", variable.toString() ); } + } + + /** + * Resolve directory against a base directory if it is not already absolute. + * @param basedir the base directory for relative paths + * @param dir the directory to resolve + * @throws IOException if canonical path fails + */ + public static String makeAbsolutePath( File basedir, String dir ) throws IOException + { + if ( new File( dir ).isAbsolute() == false ) + { + return new File( basedir, dir ).getCanonicalPath(); + } + return dir; + } + + /** + * Convert an absolute path to a relative path if it is under a given base directory. + * @param basedir the base directory for relative paths + * @param path the directory to resolve + * @throws IOException if canonical path fails + */ + public static String makeRelativePath( File basedir, String path ) throws IOException + { + String canonicalBasedir = basedir.getCanonicalPath(); + String canonicalPath = new File( path ).getCanonicalPath(); + if ( canonicalPath.startsWith( canonicalBasedir ) ) + { + if ( canonicalPath.charAt( canonicalBasedir.length() ) == File.separatorChar ) + { + canonicalPath = canonicalPath.substring( canonicalBasedir.length() + 1 ); + } + else + { + canonicalPath = canonicalPath.substring( canonicalBasedir.length() ); + } + } + return canonicalPath; } } No revision No revision 1.4.2.2 +3 -1 maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java Index: MavenTagLibrary.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- MavenTagLibrary.java 7 Aug 2003 16:56:38 -0000 1.4.2.1 +++ MavenTagLibrary.java 18 Aug 2003 10:25:10 -0000 1.4.2.2 @@ -75,6 +75,8 @@ { registerTag( "snapshot", SnapshotSignature.class ); registerTag( "addPath", AddPathTag.class ); + registerTag( "make-absolute-path", MakeAbsolutePathTag.class ); + registerTag( "make-relative-path", MakeRelativePathTag.class ); registerTag( "maven", MavenTag.class ); registerTag( "pom", PomTag.class ); registerTag( "reactor", ReactorTag.class ); No revision Index: MavenTagLibrary.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- MavenTagLibrary.java 7 Aug 2003 16:56:38 -0000 1.4.2.1 +++ MavenTagLibrary.java 18 Aug 2003 10:25:10 -0000 1.4.2.2 @@ -75,6 +75,8 @@ { registerTag( "snapshot", SnapshotSignature.class ); registerTag( "addPath", AddPathTag.class ); + registerTag( "make-absolute-path", MakeAbsolutePathTag.class ); + registerTag( "make-relative-path", MakeRelativePathTag.class ); registerTag( "maven", MavenTag.class ); registerTag( "pom", PomTag.class ); registerTag( "reactor", ReactorTag.class ); No revision Index: MavenTagLibrary.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/MavenTagLibrary.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- MavenTagLibrary.java 7 Aug 2003 16:56:38 -0000 1.4.2.1 +++ MavenTagLibrary.java 18 Aug 2003 10:25:10 -0000 1.4.2.2 @@ -75,6 +75,8 @@ { registerTag( "snapshot", SnapshotSignature.class ); registerTag( "addPath", AddPathTag.class ); + registerTag( "make-absolute-path", MakeAbsolutePathTag.class ); + registerTag( "make-relative-path", MakeRelativePathTag.class ); registerTag( "maven", MavenTag.class ); registerTag( "pom", PomTag.class ); registerTag( "reactor", ReactorTag.class ); 1.1.2.1 +130 -0 maven/src/java/org/apache/maven/jelly/tags/maven/Attic/MakeAbsolutePathTag.java 1.1.2.1 +131 -0 maven/src/java/org/apache/maven/jelly/tags/maven/Attic/MakeRelativePathTag.java No revision No revision 1.21.2.2 +51 -1 maven/src/java/org/apache/maven/project/Build.java Index: Build.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Build.java,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -u -r1.21.2.1 -r1.21.2.2 --- Build.java 7 Aug 2003 16:56:39 -0000 1.21.2.1 +++ Build.java 18 Aug 2003 10:25:10 -0000 1.21.2.2 @@ -56,8 +56,13 @@ * ==================================================================== */ +import org.apache.maven.MavenUtils; + import java.util.ArrayList; import java.util.List; +import java.util.Iterator; +import java.io.File; +import java.io.IOException; /** * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> @@ -297,5 +302,50 @@ { return "[ sourceDirectory = " + getSourceDirectory() + ", unitTestSourceDirectory = " + getUnitTestSourceDirectory() + " ]"; + } + + /** + * Resolve relative directories against a base directory. + * @param basedir the base directory + * @todo *sourceDirectory + * @throws IOException file resolution error + */ + public void resolveDirectories( File basedir ) throws IOException + { + for ( Iterator i = resources.iterator(); i.hasNext(); ) + { + Resource r = ( Resource ) i.next(); + r.resolveDirectory( basedir ); + } + + if ( unitTest != null ) + { + for ( Iterator i = unitTest.getResources().iterator(); i.hasNext(); ) + { + Resource r = ( Resource ) i.next(); + r.resolveDirectory( basedir ); + } + } + + if ( sourceDirectory != null && sourceDirectory.length() > 0 ) + { + sourceDirectory = MavenUtils.makeAbsolutePath( basedir, sourceDirectory ); + } + + if ( aspectSourceDirectory != null && aspectSourceDirectory.length() > 0 ) + { + aspectSourceDirectory = MavenUtils.makeAbsolutePath( basedir, aspectSourceDirectory ); + } + + if ( unitTestSourceDirectory != null && unitTestSourceDirectory.length() > 0 ) + { + unitTestSourceDirectory = MavenUtils.makeAbsolutePath( basedir, unitTestSourceDirectory ); + } + + if ( integrationUnitTestSourceDirectory != null && integrationUnitTestSourceDirectory.length() > 0 ) + { + integrationUnitTestSourceDirectory = + MavenUtils.makeAbsolutePath( basedir, integrationUnitTestSourceDirectory ); + } } } 1.34.2.2 +1 -2 maven/src/java/org/apache/maven/project/Dependency.java Index: Dependency.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Dependency.java,v retrieving revision 1.34.2.1 retrieving revision 1.34.2.2 diff -u -r1.34.2.1 -r1.34.2.2 --- Dependency.java 14 Aug 2003 00:51:12 -0000 1.34.2.1 +++ Dependency.java 18 Aug 2003 10:25:10 -0000 1.34.2.2 @@ -350,7 +350,6 @@ /** * Usually only jars and ejbs are added to the classpath * - * @param d * @return true if the given dependency belongs on the classpath */ public boolean isAddedToClasspath() 1.83.2.5 +5 -7 maven/src/java/org/apache/maven/project/Project.java Index: Project.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Project.java,v retrieving revision 1.83.2.4 retrieving revision 1.83.2.5 diff -u -r1.83.2.4 -r1.83.2.5 --- Project.java 14 Aug 2003 09:54:05 -0000 1.83.2.4 +++ Project.java 18 Aug 2003 10:25:11 -0000 1.83.2.5 @@ -214,9 +214,6 @@ /** Artifact list. */ private List artifactList; - - /** maven.xml file */ - private File mavenXml; /** * Reports to be generated for a project for a project. This is a list of the @@ -1305,7 +1302,10 @@ setDependencyVerifier( new DependencyVerifier( this ) ); getDependencyVerifier().setIgnoreErrors(false); initializeDriver(); - + if ( build != null ) + { + build.resolveDirectories( file.getParentFile() ); + } initialized = true; } @@ -1575,8 +1575,6 @@ * Process the dependencies of the project, adding dependencies to the * appropriate classloader etc * - * @param project The project to process - * @param cl The classloader to add dependencies * @throws MalformedURLException */ public void processDependencies() throws MalformedURLException, Exception 1.9.2.2 +17 -1 maven/src/java/org/apache/maven/project/Resource.java Index: Resource.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Resource.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- Resource.java 7 Aug 2003 16:56:39 -0000 1.9.2.1 +++ Resource.java 18 Aug 2003 10:25:11 -0000 1.9.2.2 @@ -56,8 +56,12 @@ * ==================================================================== */ +import org.apache.maven.MavenUtils; + import java.util.ArrayList; import java.util.List; +import java.io.File; +import java.io.IOException; /** * Represents a set of files in a single directory. @@ -170,7 +174,7 @@ } /** - * @param filtering specifies whether filtering is active or not + * @param isFiltering specifies whether filtering is active or not */ public void setFiltering( boolean isFiltering ) { @@ -184,4 +188,16 @@ { return this.isFiltering; } + + /** + * Resolve directory against a base directory if it is not already absolute. + * @todo proper project marshaller should construct as such + * @param basedir the base directory for relative paths + * @throws IOException if canonical path fails + */ + public void resolveDirectory( File basedir ) throws IOException + { + dir = MavenUtils.makeAbsolutePath( basedir, dir ); + } + } No revision No revision 1.13.4.1 +2 -1 maven/src/java/org/apache/maven/repository/DefaultArtifactFactory.java Index: DefaultArtifactFactory.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/repository/DefaultArtifactFactory.java,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -u -r1.13 -r1.13.4.1 --- DefaultArtifactFactory.java 11 Apr 2003 23:45:33 -0000 1.13 +++ DefaultArtifactFactory.java 18 Aug 2003 10:25:11 -0000 1.13.4.1 @@ -76,6 +76,7 @@ * type. * * @param dependency The base dependency. + * @todo not the intended usage of test type * @return The appropriate artifact based on the dependency type. */ public static Artifact createArtifact( Dependency dependency ) No revision No revision 1.1.4.1 +1 -1 maven/src/plugins-build/ant/src/plugin-resources/templates/build.jelly Index: build.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/ant/src/plugin-resources/templates/build.jelly,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -r1.1 -r1.1.4.1 --- build.jelly 17 Jul 2003 01:48:56 -0000 1.1 +++ build.jelly 18 Aug 2003 10:25:11 -0000 1.1.4.1 @@ -353,4 +353,4 @@ </target> </project> -</j:jelly> \ No newline at end of file +</j:jelly> No revision No revision 1.2.4.3 +8 -37 maven/src/plugins-build/eclipse/src/plugin-resources/templates/classpath.jelly Index: classpath.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/eclipse/src/plugin-resources/templates/classpath.jelly,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -u -r1.2.4.2 -r1.2.4.3 --- classpath.jelly 14 Aug 2003 09:52:41 -0000 1.2.4.2 +++ classpath.jelly 18 Aug 2003 10:25:11 -0000 1.2.4.3 @@ -3,33 +3,19 @@ xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:ant="jelly:ant" + xmlns:maven="jelly:maven" xmlns="dummy" trim="true"> <classpath> <j:if test="${sourcesPresent}"> - <j:set var="srcDir" value="${pom.build.sourceDirectory}"/> - <j:if test="${ srcDir.startsWith( basedir ) }"> - <!--ant:echo>Cutting off basedir from sourceDirectory</ant:echo--> - <j:set var="srcDir" value="${srcDir.substring(basedir.length())}"/> - <!-- - cut off also slash or backslash from basedir. - Is there a way to make it in one step in Jelly? - --> - <j:set var="srcDir" value="${srcDir.substring(1)}"/> - </j:if> + <maven:make-relative-path var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}"/> <classpathentry kind="src" path="${srcDir}"/> </j:if> <j:if test="${unitTestSourcesPresent}"> <ant:echo>Contains JUnit tests</ant:echo> - <j:set var="testSrcDir" value="${pom.build.unitTestSourceDirectory}"/> - <j:if test="${ testSrcDir.startsWith( basedir ) }"> - <!--ant:echo>Cutting off basedir from testSourceDirectory</ant:echo--> - <j:set var="testSrcDir" value="${testSrcDir.substring(basedir.length())}"/> - <!-- Cut off slash or backslash from basedir --> - <j:set var="testSrcDir" value="${testSrcDir.substring(1)}"/> - </j:if> + <maven:make-relative-path var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}"/> <!-- Eclipse supports an output directory per input directory --> <j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/> @@ -37,12 +23,8 @@ <j:set var="testOutputDir" value="${pom.getPluginContext('maven-test-plugin').getVariable('maven.test.dest')}"/> </j:if> - <j:if test="${ testOutputDir.startsWith( basedir ) }"> - <!--ant:echo>Cutting off basedir from testOutputDir</ant:echo--> - <j:set var="testOutputDir" value="${testOutputDir.substring(basedir.length())}"/> - <!-- Cut off slash or backslash from basedir --> - <j:set var="testOutputDir" value="${testOutputDir.substring(1)}"/> - </j:if> + + <maven:make-relative-path var="testOutputDir" basedir="${basedir}" path="${testOutputDir}" /> <ant:echo>Setting compile of ${testSrcDir} to ${testOutputDir}</ant:echo> <classpathentry kind="src" path="${testSrcDir}" output="${testOutputDir}"/> @@ -83,13 +65,7 @@ <j:if test="${cactusSourcePresent == 'true'}"> <ant:echo>Contains Cactus Tests!</ant:echo> - <j:set var="testSrcDir" value="${cactusSrcDir}"/> - <j:if test="${ testSrcDir.startsWith( basedir ) }"> - <ant:echo>Cutting off basedir from Cactus source directory</ant:echo> - <j:set var="testSrcDir" value="${testSrcDir.substring(basedir.length())}"/> - <!-- cut off also slash or backslash --> - <j:set var="testSrcDir" value="${testSrcDir.substring(1)}"/> - </j:if> + <maven:make-relative-path var="testSrcDir" basedir="${basedir}" path="${cactusSrcDir}" /> <classpathentry kind="src" path="${testSrcDir}"/> <j:set var="depVersion">${pom.getPluginContext('maven-cactus-plugin').getVariable('plugin').getDependency('cactus').getVersion()}</j:set> @@ -119,14 +95,9 @@ <j:if test="${empty outputDir}"> <j:set var="outputDir" value="${maven.build.dest}"/> </j:if> - <j:if test="${ outputDir.startsWith( basedir ) }"> - <!-- Cutting off basedir from outputDir --> - <j:set var="outputDir" value="${outputDir.substring(basedir.length())}"/> - <!-- Cut off slash or backslash from basedir --> - <j:set var="outputDir" value="${outputDir.substring(1)}"/> - </j:if> + <maven:make-relative-path var="outputDir" basedir="${basedir}" path="${outputDir}" /> <classpathentry kind="output" path="${outputDir}"/> <ant:echo>Setting default output directory to ${outputDir}</ant:echo> </classpath> -</j:whitespace> \ No newline at end of file +</j:whitespace> No revision No revision 1.2.4.1 +2 -0 maven/src/plugins-build/jalopy/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jalopy/plugin.jelly,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- plugin.jelly 29 Mar 2003 12:40:46 -0000 1.2 +++ plugin.jelly 18 Aug 2003 10:25:11 -0000 1.2.4.1 @@ -1,3 +1,5 @@ +<?xml version="1.0"?> + <project xmlns:ant="jelly:ant"> No revision No revision 1.10.2.2 +3 -1 maven/src/plugins-build/jbuilder/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jbuilder/plugin.jelly,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -u -r1.10.2.1 -r1.10.2.2 --- plugin.jelly 7 Aug 2003 16:59:40 -0000 1.10.2.1 +++ plugin.jelly 18 Aug 2003 10:25:11 -0000 1.10.2.2 @@ -1,3 +1,5 @@ +<?xml version="1.0"?> + <project xmlns:j="jelly:core" xmlns:u="jelly:util" @@ -195,7 +197,7 @@ </class> <source> <j:if test="${sourcesPresent}" > - <path><j:expr value="${basedir}/${project.build.sourceDirectory}" /></path> + <path><j:expr value="${project.build.sourceDirectory}" /></path> </j:if> </source> <j:forEach var="lib" items="${project.dependencies}"> No revision No revision 1.2.4.1 +5 -2 maven/src/plugins-build/jdee/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jdee/plugin.jelly,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- plugin.jelly 22 Apr 2003 09:32:49 -0000 1.2 +++ plugin.jelly 18 Aug 2003 10:25:11 -0000 1.2.4.1 @@ -2,6 +2,7 @@ <project xmlns:j="jelly:core" + xmlns:maven="jelly:maven" xmlns:ant="jelly:ant"> <goal name="jdee" @@ -28,7 +29,8 @@ (quote (jde-project-name "${pom.artifactId}")) (quote (jde-project-file-name "${maven.jdee.project.file}")) <j:if test="${sourcesPresent}"> - (quote (jde-sourcepath (quote ("./${pom.build.sourceDirectory}")))) + <maven:make-relative-path var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" /> + (quote (jde-sourcepath (quote ("./${srcDir}")))) <j:whitespace /> </j:if> (quote (jde-compile-option-directory "./target/classes")) @@ -45,7 +47,8 @@ </j:if> (quote (jde-global-classpath (quote ("./target/classes" <j:if test="${unitTestSourcesPresent}"> -"./${pom.build.unitTestSourceDirectory}" <j:whitespace /> + <maven:make-relative-path var="srcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}" /> +"./${srcDir}" <j:whitespace /> </j:if> <!-- now iterate through all dependencies --> <j:forEach var="lib" items="${pom.artifacts}"> No revision No revision 1.5.4.1 +10 -6 maven/src/plugins-build/jdiff/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jdiff/plugin.jelly,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -u -r1.5 -r1.5.4.1 --- plugin.jelly 30 Mar 2003 23:25:01 -0000 1.5 +++ plugin.jelly 18 Aug 2003 10:25:11 -0000 1.5.4.1 @@ -2,6 +2,7 @@ <project xmlns:j="jelly:core" + xmlns:maven="jelly:maven" xmlns:ant="jelly:ant"> <!-- ================================================================== --> @@ -30,24 +31,26 @@ <ant:equals arg1="${maven.jdiff.old.tag}" arg2="CURRENT"/> </ant:condition> + <maven:make-relative-path var="relativeSrcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" /> <j:choose> <j:when test="${maven.jdiff.new.current}"> - <ant:property name="maven.jdiff.new.src" value="${pom.build.SourceDirectory}"/> + <ant:property name="maven.jdiff.new.src" value="${relativeSrcDir}"/> </j:when> <j:otherwise> <ant:property name="maven.jdiff.new.dir" value="${maven.jdiff.dir}/${maven.jdiff.new.tag}"/> <ant:mkdir dir="${maven.jdiff.new.dir}"/> + <maven:make-relative-path var="mavenRelativeSrcDir" basedir="${basedir}" path="${maven.build.sourceDirectory}" /> <ant:cvs cvsRoot="${pom.repository.cvsRoot}" - package="${pom.repository.cvsModule}/${maven.build.sourceDirectory}" + package="${pom.repository.cvsModule}/${mavenRelativeSrcDir}" dest="${maven.jdiff.new.dir}" tag="${maven.jdiff.new.tag}" /> <ant:property name="maven.jdiff.new.src" - value="${maven.jdiff.new.dir}/${pom.repository.cvsModule}/${pom.build.SourceDirectory}"/> + value="${maven.jdiff.new.dir}/${pom.repository.cvsModule}/${relativeSrcDir}"/> </j:otherwise> </j:choose> @@ -55,7 +58,7 @@ <j:choose> <j:when test="${maven.jdiff.old.current}"> - <ant:property name="maven.jdiff.old.src" value="${pom.build.SourceDirectory}"/> + <ant:property name="maven.jdiff.old.src" value="${relativeSrcDir}"/> </j:when> <j:otherwise> @@ -63,15 +66,16 @@ value="${maven.jdiff.dir}/${maven.jdiff.old.tag}"/> <ant:mkdir dir="${maven.jdiff.old.dir}"/> + <maven:make-relative-path var="mavenRelativeSrcDir" basedir="${basedir}" path="${maven.build.sourceDirectory}" /> <ant:cvs cvsRoot="${pom.repository.cvsRoot}" - package="${pom.repository.cvsModule}/${maven.build.sourceDirectory}" + package="${pom.repository.cvsModule}/${mavenRelativeSrcDir}" dest="${maven.jdiff.old.dir}" tag="${maven.jdiff.old.tag}" /> <ant:property name="maven.jdiff.old.src" - value="${maven.jdiff.old.dir}/${pom.repository.cvsModule}/${pom.build.SourceDirectory}"/> + value="${maven.jdiff.old.dir}/${pom.repository.cvsModule}/${relativeSrcDir}"/> </j:otherwise> </j:choose> No revision No revision 1.2.4.1 +1 -1 maven/src/plugins-build/jellydoc/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jellydoc/xdocs/changes.xml,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- changes.xml 25 Jul 2003 06:21:15 -0000 1.2 +++ changes.xml 18 Aug 2003 10:25:11 -0000 1.2.4.1 @@ -21,4 +21,4 @@ </release> </body> -</document> \ No newline at end of file +</document> No revision No revision 1.2.4.1 +2 -0 maven/src/plugins-build/junitdoclet/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/junitdoclet/plugin.jelly,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- plugin.jelly 1 Apr 2003 00:50:11 -0000 1.2 +++ plugin.jelly 18 Aug 2003 10:25:11 -0000 1.2.4.1 @@ -1,3 +1,5 @@ +<?xml version="1.0"?> + <project xmlns:ant="jelly:ant" xmlns:j="jelly:core"> No revision No revision 1.14.4.1 +3 -17 maven/src/plugins-build/jxr/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/jxr/plugin.jelly,v retrieving revision 1.14 retrieving revision 1.14.4.1 diff -u -r1.14 -r1.14.4.1 --- plugin.jelly 1 Apr 2003 00:50:11 -0000 1.14 +++ plugin.jelly 18 Aug 2003 10:25:12 -0000 1.14.4.1 @@ -72,16 +72,8 @@ <ant:copy file="${maven.jxr.stylesheet}" tofile="${maven.jxr.destdir}/stylesheet.css"/> - <!-- XXX This is a dirty hack until the semantics of pom.build.sourceDirectory are cleared up --> - <j:set var="sourceDir" value="${pom.build.sourceDirectory}"/> - <util:file var="sourceDirFile" name="${sourceDir}"/> - - <j:if test="${!sourceDirFile.isAbsolute()}"> - <j:set var="sourceDir" value="${basedir}/${sourceDir}"/> - </j:if> - <jxr:jxr - sourceDir="${sourceDir}" + sourceDir="${pom.build.sourceDirectory}" destDir="${maven.jxr.destdir}" templateDir="${maven.jxr.templateDir}" javadocDir="${javadocDestdir}" @@ -92,15 +84,9 @@ <j:if test="${unitTestSourcesPresent == 'true'}"> <ant:mkdir dir="${maven.jxr.destdir.test}"/> - <j:set var="testSourceDir" value="${pom.build.unitTestSourceDirectory}"/> - <util:file var="testSourceDirFile" name="${testSourceDir}"/> - - <j:if test="${!testSourceDirFile.isAbsolute()}"> - <j:set var="testSourceDir" value="${basedir}/${testSourceDir}"/> - </j:if> - + <jxr:jxr - sourceDir="${testSourceDir}" + sourceDir="${pom.build.unitTestSourceDirectory}" destDir="${maven.jxr.destdir.test}" templateDir="${maven.jxr.templateDir}" javadocDir="${null}" No revision No revision 1.3.4.1 +1 -1 maven/src/plugins-build/simian/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven/src/plugins-build/simian/plugin.jelly,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -r1.3 -r1.3.4.1 --- plugin.jelly 21 Jul 2003 22:20:58 -0000 1.3 +++ plugin.jelly 18 Aug 2003 10:25:12 -0000 1.3.4.1 @@ -170,4 +170,4 @@ </j:whitespace> </j:file> </goal> -</project> \ No newline at end of file +</project> No revision No revision 1.1.2.1 +24 -0 maven/src/test/basedir/Attic/project.xml No revision No revision 1.1.2.1 +25 -0 maven/src/test/basedir/extend-1/Attic/project.xml No revision No revision 1.1.2.1 +25 -0 maven/src/test/basedir/extend-2/Attic/project.xml No revision No revision 1.2.4.2 +0 -1 maven/src/test/extend/child_project/project-child2.xml Index: project-child2.xml =================================================================== RCS file: /home/cvs/maven/src/test/extend/child_project/project-child2.xml,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -u -r1.2.4.1 -r1.2.4.2 --- project-child2.xml 18 Aug 2003 06:06:13 -0000 1.2.4.1 +++ project-child2.xml 18 Aug 2003 10:25:12 -0000 1.2.4.2 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <project> - <!-- XXX ../project-child.xml should work, but doesn't --> <extend>${basedir}/../project-child.xml</extend> <id>child</id> No revision No revision 1.9.2.2 +64 -13 maven/src/test/java/org/apache/maven/MavenUtilsTest.java Index: MavenUtilsTest.java =================================================================== RCS file: /home/cvs/maven/src/test/java/org/apache/maven/MavenUtilsTest.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- MavenUtilsTest.java 7 Aug 2003 16:54:25 -0000 1.9.2.1 +++ MavenUtilsTest.java 18 Aug 2003 10:25:12 -0000 1.9.2.2 @@ -58,14 +58,22 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; +import java.io.File; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.maven.jelly.MavenJellyContext; +/** + * Test cases for various MavenUtils methods. + * + * @author Brett Porter <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> + * @author others + * @version $Id$ + */ public class MavenUtilsTest - extends TestCase + extends TestCase { public MavenUtilsTest( String testName ) { @@ -213,7 +221,7 @@ projectProperties.setProperty( "maven.repo.remote", mavenRepoRemote ); String basedir = "/home/jvanzyl/projects/maven"; - + // Driver properties driverProperties.setProperty( "basedir", basedir ); driverProperties.setProperty( "maven.build.src", "${basedir}/src" ); @@ -223,7 +231,7 @@ driverProperties.setProperty( "maven.final.name", "maven-1.0" ); driverProperties.setProperty( "maven.repo.remote.enabled", "true" ); driverProperties.setProperty( "maven.repo.local", "${maven.home}/repository" ); - + Map result = MavenUtils.mergeMaps( new Map[] { systemProperties, @@ -237,27 +245,70 @@ MavenUtils.integrateMapInContext( result, context ); // Values that should be taken from systemProperties. - assertEquals( "/projects/maven", (String) context.getVariable( "maven.home" ) ); + assertEquals( "/projects/maven", ( String ) context.getVariable( "maven.home" ) ); // Values that should be taken from userBuildProperties. - assertEquals( "/opt/maven/repository", (String) context.getVariable( "maven.repo.local" ) ); - assertEquals( "false", (String) context.getVariable( "maven.repo.remote.enabled" ) ); - assertEquals( "jvanzyl", (String) context.getVariable( "maven.username" ) ); - + assertEquals( "/opt/maven/repository", ( String ) context.getVariable( "maven.repo.local" ) ); + assertEquals( "false", ( String ) context.getVariable( "maven.repo.remote.enabled" ) ); + assertEquals( "jvanzyl", ( String ) context.getVariable( "maven.username" ) ); + // Values take from projectBuildProperties. - assertEquals( "maven", (String) context.getVariable( "maven.final.name" ) ); + assertEquals( "maven", ( String ) context.getVariable( "maven.final.name" ) ); // Values take from projectProperties. - assertEquals( mavenRepoRemote, (String) context.getVariable( "maven.repo.remote" ) ); + assertEquals( mavenRepoRemote, ( String ) context.getVariable( "maven.repo.remote" ) ); // Values taken from driver properties. - assertEquals( basedir + "/target", (String) context.getVariable( "maven.build.dir" ) ); - assertEquals( basedir + "/src", (String) context.getVariable( "maven.build.src" ) ); - assertEquals( basedir + "/target/classes", (String) context.getVariable( "maven.build.dest" ) ); + assertEquals( basedir + "/target", ( String ) context.getVariable( "maven.build.dir" ) ); + assertEquals( basedir + "/src", ( String ) context.getVariable( "maven.build.src" ) ); + assertEquals( basedir + "/target/classes", ( String ) context.getVariable( "maven.build.dest" ) ); } public void testLocalSelector() { System.out.println( Locale.getDefault() ); + } + + /** + * Test makeAbsolutePath. + * @throws Exception if there was a problem + */ + public void testMakeAbsolutePath() throws Exception + { + String basedir = System.getProperty( "basedir" ); + File basedirFile = new File( basedir ).getCanonicalFile(); + assertEquals( "Check relative path", new File( basedir + "/project.xml" ).getCanonicalPath(), + MavenUtils.makeAbsolutePath( basedirFile, "project.xml" ) ); + assertEquals( "Check unix relative path", new File( basedir + "/src/test/basedir/project.xml" ).getCanonicalPath(), + MavenUtils.makeAbsolutePath( basedirFile, "src/test/basedir/project.xml" ) ); + assertEquals( "Check windows relative path", new File( basedir + "\\src\\test\\basedir\\project.xml" ).getCanonicalPath(), + MavenUtils.makeAbsolutePath( basedirFile, "src/test/basedir/project.xml" ) ); + assertEquals( "Check absolute path outside basedir", new File( "/www/docs/index.html" ).getCanonicalPath(), + MavenUtils.makeAbsolutePath( basedirFile, new File( "/www/docs/index.html" ).getCanonicalPath() ) ); + } + + /** + * Test makeRelativePath. + * @throws Exception if there was a problem + */ + public void testMakeRelativePath() throws Exception + { + String basedir = new File( System.getProperty( "basedir" ) ).getCanonicalPath(); + File basedirFile = new File( basedir ).getCanonicalFile(); + assertEquals( "Check relative path", "project.xml", + MavenUtils.makeRelativePath( basedirFile, + new File( basedir + "/project.xml" ).getCanonicalPath() ) ); + assertEquals( "Check unix relative path", + "src" + File.separatorChar + "test" + File.separatorChar + "basedir" + File.separatorChar + + "project.xml", + MavenUtils.makeRelativePath( basedirFile, + new File( basedir + "/src/test/basedir/project.xml" ).getCanonicalPath() ) ); + assertEquals( "Check windows relative path", + "src" + File.separatorChar + "test" + File.separatorChar + "basedir" + File.separatorChar + + "project.xml", + MavenUtils.makeRelativePath( basedirFile, + new File( basedir + "\\src\\test\\basedir\\project.xml" ).getCanonicalPath() ) ); + assertEquals( "Check absolute path outside basedir", new File( "/www/docs/index.html" ).getCanonicalPath(), + MavenUtils.makeRelativePath( basedirFile, new File( "/www/docs/index.html" ).getCanonicalPath() ) ); } } No revision No revision 1.2.4.1 +0 -52 maven/src/test/java/org/apache/maven/project/BuildTest.java Index: BuildTest.java =================================================================== RCS file: /home/cvs/maven/src/test/java/org/apache/maven/project/BuildTest.java,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -u -r1.2 -r1.2.4.1 --- BuildTest.java 7 Dec 2002 02:19:08 -0000 1.2 +++ BuildTest.java 18 Aug 2003 10:25:12 -0000 1.2.4.1 @@ -52,32 +52,6 @@ // JUnitDoclet end method testcase.tearDown } - public void testSetGetIntegrationUnitTestSourceDirectory() throws Exception - { - // JUnitDoclet begin method setIntegrationUnitTestSourceDirectory getIntegrationUnitTestSourceDirectory - java.lang.String[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null}; - - for ( int i = 0; i < tests.length; i++ ) - { - build.setIntegrationUnitTestSourceDirectory( tests[i] ); - assertEquals( tests[i], build.getIntegrationUnitTestSourceDirectory() ); - } - // JUnitDoclet end method setIntegrationUnitTestSourceDirectory getIntegrationUnitTestSourceDirectory - } - - public void testSetGetUnitTestSourceDirectory() throws Exception - { - // JUnitDoclet begin method setUnitTestSourceDirectory getUnitTestSourceDirectory - java.lang.String[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null}; - - for ( int i = 0; i < tests.length; i++ ) - { - build.setUnitTestSourceDirectory( tests[i] ); - assertEquals( tests[i], build.getUnitTestSourceDirectory() ); - } - // JUnitDoclet end method setUnitTestSourceDirectory getUnitTestSourceDirectory - } - public void testAddJarResource() throws Exception { // JUnitDoclet begin method addJarResource @@ -106,32 +80,6 @@ { // JUnitDoclet begin method getSourceModifications // JUnitDoclet end method getSourceModifications - } - - public void testSetGetSourceDirectory() throws Exception - { - // JUnitDoclet begin method setSourceDirectory getSourceDirectory - java.lang.String[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null}; - - for ( int i = 0; i < tests.length; i++ ) - { - build.setSourceDirectory( tests[i] ); - assertEquals( tests[i], build.getSourceDirectory() ); - } - // JUnitDoclet end method setSourceDirectory getSourceDirectory - } - - public void testSetGetAspectSourceDirectory() throws Exception - { - // JUnitDoclet begin method setAspectSourceDirectory getAspectSourceDirectory - java.lang.String[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null}; - - for ( int i = 0; i < tests.length; i++ ) - { - build.setAspectSourceDirectory( tests[i] ); - assertEquals( tests[i], build.getAspectSourceDirectory() ); - } - // JUnitDoclet end method setAspectSourceDirectory getAspectSourceDirectory } public void testSetGetNagEmailAddress() throws Exception 1.34.2.2 +0 -4 maven/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java Index: ProjectInheritanceTest.java =================================================================== RCS file: /home/cvs/maven/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java,v retrieving revision 1.34.2.1 retrieving revision 1.34.2.2 diff -u -r1.34.2.1 -r1.34.2.2 --- ProjectInheritanceTest.java 7 Aug 2003 16:54:25 -0000 1.34.2.1 +++ ProjectInheritanceTest.java 18 Aug 2003 10:25:12 -0000 1.34.2.2 @@ -78,11 +78,7 @@ public static Test suite() { - // Disabled: - return new TestSuite( ProjectInheritanceTest.class ); - - // return new TestSuite(ProjectInheritanceTest.class); } protected void setUp() throws Exception No revision Index: ProjectInheritanceTest.java =================================================================== RCS file: /home/cvs/maven/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java,v retrieving revision 1.34.2.1 retrieving revision 1.34.2.2 diff -u -r1.34.2.1 -r1.34.2.2 --- ProjectInheritanceTest.java 7 Aug 2003 16:54:25 -0000 1.34.2.1 +++ ProjectInheritanceTest.java 18 Aug 2003 10:25:12 -0000 1.34.2.2 @@ -78,11 +78,7 @@ public static Test suite() { - // Disabled: - return new TestSuite( ProjectInheritanceTest.class ); - - // return new TestSuite(ProjectInheritanceTest.class); } protected void setUp() throws Exception No revision Index: ProjectInheritanceTest.java =================================================================== RCS file: /home/cvs/maven/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java,v retrieving revision 1.34.2.1 retrieving revision 1.34.2.2 diff -u -r1.34.2.1 -r1.34.2.2 --- ProjectInheritanceTest.java 7 Aug 2003 16:54:25 -0000 1.34.2.1 +++ ProjectInheritanceTest.java 18 Aug 2003 10:25:12 -0000 1.34.2.2 @@ -78,11 +78,7 @@ public static Test suite() { - // Disabled: - return new TestSuite( ProjectInheritanceTest.class ); - - // return new TestSuite(ProjectInheritanceTest.class); } protected void setUp() throws Exception 1.1.2.1 +151 -0 maven/src/test/java/org/apache/maven/project/Attic/BasedirTest.java No revision No revision 1.36.2.1 +48 -0 maven/src/test/touchstone-build/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/maven/src/test/touchstone-build/maven.xml,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -u -r1.36 -r1.36.2.1 --- maven.xml 16 Jun 2003 08:04:20 -0000 1.36 +++ maven.xml 18 Aug 2003 10:25:12 -0000 1.36.2.1 @@ -1,6 +1,7 @@ <project default="jar:jar" xmlns:j="jelly:core" + xmlns:ant="jelly:ant" xmlns:u="jelly:util" xmlns:i="jelly:interaction" xmlns:maven="jelly:maven" @@ -95,6 +96,8 @@ </fail> </j:if> + <attainGoal name="test-make-absolute-path" /> + <attainGoal name="test-make-relative-path" /> <attainGoal name="test-plugin-property-override"/> <j:set var="mavenTouchstoneA" value="${maven.touchstone.A}"/> @@ -346,6 +349,51 @@ A defined property with dots in the name is wrongly treated as null even though the value is ${dot.property} </fail> + </j:if> + </goal> + + <!-- + | Test the make-absolute-path tag + |--> + <goal name="test-make-absolute-path"> + <maven:make-absolute-path var="testVar" basedir="${basedir}" path="project.xml" /> + <u:file var="testVar2" name="${basedir}/project.xml" /> + <j:if test="${testVar != testVar2.canonicalPath}"> + <ant:fail> + make-absolute-path: + testVar = '${testVar}'; should be: '${testVar2}' + </ant:fail> + </j:if> + + <maven:make-absolute-path var="testVar" basedir="${basedir}" path="src/main" /> + <u:file var="testVar2" name="${basedir}/src/main"/> + <j:if test="${testVar != testVar2.canonicalPath}"> + <ant:fail> + make-absolute-path: + testVar = '${testVar}'; should be: '${testVar2}' + </ant:fail> + </j:if> + </goal> + + <!-- + | Test the make-relative-path tag + |--> + <goal name="test-make-relative-path"> + <maven:make-relative-path var="testVar" basedir="${basedir}" path="${basedir}/project.xml" /> + <j:if test="${testVar != 'project.xml'}"> + <ant:fail> + make-relative-path: + testVar = '${testVar}'; should be: 'project.xml' + </ant:fail> + </j:if> + + <maven:make-relative-path var="testVar" basedir="${basedir}" path="${basedir}/src/main" /> + <j:set var="testVar2" value="src${file.separator}main"/> + <j:if test="${testVar != testVar2}"> + <ant:fail> + make-relative-path: + testVar = '${testVar}'; should be: '${testVar2}' + </ant:fail> </j:if> </goal>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]