Re: svn commit: r696176 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/ide/IdeUtils.java test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java

2008-09-17 Thread Barrie Treloar
On Thu, Sep 18, 2008 at 5:51 AM, Barrie Treloar <[EMAIL PROTECTED]> wrote:
> On Wed, Sep 17, 2008 at 5:32 PM, Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
>> Barry,
>>
>> it seems to create an issue :
>> http://ci.sonatype.org/job/plugins-CI-with-maven-2.0.x/org.apache.maven.plugins$maven-eclipse-plugin/439/testReport/
>
> Ill have a look.
>

Right, the problem is that File.getCanonical() is operating system dependent.
So I'll have to re-think the tests.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svn commit: r696176 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/ide/IdeUtils.java test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java

2008-09-17 Thread Barrie Treloar
On Wed, Sep 17, 2008 at 5:32 PM, Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> Barry,
>
> it seems to create an issue :
> http://ci.sonatype.org/job/plugins-CI-with-maven-2.0.x/org.apache.maven.plugins$maven-eclipse-plugin/439/testReport/

Ill have a look.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svn commit: r696176 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/ide/IdeUtils.java test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java

2008-09-17 Thread Arnaud HERITIER
Barry,

it seems to create an issue :
http://ci.sonatype.org/job/plugins-CI-with-maven-2.0.x/org.apache.maven.plugins$maven-eclipse-plugin/439/testReport/

Cheers

arnaud

On Wed, Sep 17, 2008 at 8:46 AM, <[EMAIL PROTECTED]> wrote:

> Author: baerrach
> Date: Tue Sep 16 23:46:57 2008
> New Revision: 696176
>
> URL: http://svn.apache.org/viewvc?rev=696176&view=rev
> Log:
> [MECLIPSE-261] fixing IdeUtils.toRelativeAndFixSeparator to support Windows
> Root directories as basedir
>
> The the canonical form of a windows root dir ends in a slash.
> Whereas the canonical form of any other directory does not.
>
> Modified:
>
>  
> maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
>
>  
> maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java
>
> Modified:
> maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
> URL:
> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java?rev=696176&r1=696175&r2=696176&view=diff
>
> ==
> ---
> maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
> (original)
> +++
> maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
> Tue Sep 16 23:46:57 2008
> @@ -393,21 +393,29 @@
> fileToAdd = new File( basedir, fileToAdd.getPath() );
> }
>
> -String basedirpath;
> -String absolutePath;
> +String basedirPath = getCanonicalPath( basedir );
> +String absolutePath = getCanonicalPath( fileToAdd );
>
> -basedirpath = getCanonicalPath( basedir );
> -absolutePath = getCanonicalPath( fileToAdd );
> +String relative = null;
>
> -String relative;
> -
> -if ( absolutePath.equals( basedirpath ) )
> +if ( absolutePath.equals( basedirPath ) )
> {
> relative = "."; //$NON-NLS-1$
> }
> -else if ( absolutePath.startsWith( basedirpath ) )
> +else if ( absolutePath.startsWith( basedirPath ) )
> {
> -relative = absolutePath.substring( basedirpath.length() + 1 );
> +// MECLIPSE-261
> +// The canonical form of a windows root dir ends in a slash,
> whereas the canonical form of any other file
> +// does not.
> +// The absolutePath is assumed to be: basedirPath + Separator
> + fileToAdd
> +// In the case of a windows root directory the Separator is
> missing since it is contained within
> +// basedirPath.
> +int length = basedirPath.length();
> +if ( !basedirPath.endsWith( "\\" ) )
> +{
> +length++;
> +}
> +relative = absolutePath.substring( length );
> }
> else
> {
> @@ -426,8 +434,7 @@
> }
>
> /**
> - * Convert the provided filename from a Windows separator \\ to a
> unix/java
> - * separator /
> + * Convert the provided filename from a Windows separator \\ to a
> unix/java separator /
>  *
>  * @param filename file name to fix separator
>  * @return filename with all \\ replaced with /
>
> Modified:
> maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java
> URL:
> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java?rev=696176&r1=696175&r2=696176&view=diff
>
> ==
> ---
> maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java
> (original)
> +++
> maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java
> Tue Sep 16 23:46:57 2008
> @@ -51,10 +51,10 @@
> name = IdeUtils.getProjectName(
> IdeUtils.PROJECT_NAME_WITH_VERSION_TEMPLATE, dependency );
> assertEquals( dependency.getArtifactId() + "-" +
> dependency.getVersion(), name );
> }
> -
> +
> /**
> - * When the file to add is on a different drive and an absolute path
> expect
> - * that the returned value is the same as the file to add (but with
> /s)
> + * When the file to add is on a different drive and an absolute path
> expect that the returned value is the same as
> + * the file to add (but with /s)
>  *
>  * @throws Exception
>  */
> @@ -71,8 +71,8 @@
> }
>
> /**
> - * When the file to add is a relative file then expect the result to
> be
> - * relative to the basedir (not whatever the current processes basedir
> is set to)
> + * When the file to add is a relative file then expect the result to
> be relative to the basedir (not whatever the
> + * current processes basedir is