brett       2005/04/15 00:31:40

  Modified:    maven-core/src/test/java/org/apache/maven/project
                        ProjectClasspathTest.java
               
maven-artifact/src/main/java/org/apache/maven/artifact/construction
                        ArtifactConstructionSupport.java
  Log:
  resolve outstanding issues with scoping regarding tests. Algorithm to be 
documented in user's guide.
  
  Revision  Changes    Path
  1.8       +4 -7      
maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
  
  Index: ProjectClasspathTest.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProjectClasspathTest.java 5 Apr 2005 08:43:32 -0000       1.7
  +++ ProjectClasspathTest.java 15 Apr 2005 07:31:40 -0000      1.8
  @@ -66,14 +66,11 @@
           artifact = getArtifact( project, "maven-test-test", "scope-test" );
           assertNull( "Check no test dependencies are transitive", artifact );
           artifact = getArtifact( project, "maven-test-test", "scope-compile" 
);
  -//        assertEquals( "Check scope", "test", artifact.getScope() );
  -        assertNull( "Check no test dependencies are transitive", artifact );
  +        assertEquals( "Check scope", "test", artifact.getScope() );
           artifact = getArtifact( project, "maven-test-test", "scope-default" 
);
  -//        assertEquals( "Check scope", "test", artifact.getScope() );
  -        assertNull( "Check no test dependencies are transitive", artifact );
  +        assertEquals( "Check scope", "test", artifact.getScope() );
           artifact = getArtifact( project, "maven-test-test", "scope-runtime" 
);
  -//        assertEquals( "Check scope", "test", artifact.getScope() );
  -        assertNull( "Check no test dependencies are transitive", artifact );
  +        assertEquals( "Check scope", "test", artifact.getScope() );
   
           // check all transitive deps of a runtime dependency are runtime 
scope, except for test
           checkGroupIdScope( project, "runtime", "runtime" );
  @@ -92,7 +89,7 @@
           artifact = getArtifact( project, groupId, "scope-compile" );
           assertEquals( "Check scope", scopeValue, artifact.getScope() );
           artifact = getArtifact( project, groupId, "scope-test" );
  -        assertEquals( "Check scope", "test", artifact.getScope() );
  +        assertNull( "Check test dependency is not transitive", artifact );
           artifact = getArtifact( project, groupId, "scope-default" );
           assertEquals( "Check scope", scopeValue, artifact.getScope() );
           artifact = getArtifact( project, groupId, "scope-runtime" );
  
  
  
  1.7       +6 -11     
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java
  
  Index: ArtifactConstructionSupport.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ArtifactConstructionSupport.java  5 Apr 2005 08:43:32 -0000       1.6
  +++ ArtifactConstructionSupport.java  15 Apr 2005 07:31:40 -0000      1.7
  @@ -47,17 +47,14 @@
       {
           // TODO: can refactor, use scope handler
   
  -        // re-instate this if test deps are propogated
  -//        if ( Artifact.SCOPE_TEST.equals( inheritedScope ) && 
Artifact.SCOPE_TEST.equals( scope ) )
  -        if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
  +        String desiredScope = Artifact.SCOPE_RUNTIME;
  +        if ( inheritedScope == null )
           {
  -            return null;
  +            desiredScope = scope;
           }
  -
  -        String desiredScope = Artifact.SCOPE_RUNTIME;
  -        if ( Artifact.SCOPE_COMPILE.equals( scope ) && inheritedScope == 
null )
  +        else if ( Artifact.SCOPE_TEST.equals( scope ) )
           {
  -            desiredScope = Artifact.SCOPE_COMPILE;
  +            return null;
           }
   
           // vvv added to retain compile scope. Remove if you want compile 
inherited as runtime
  @@ -67,9 +64,7 @@
           }
           // ^^^ added to retain compile scope. Remove if you want compile 
inherited as runtime
   
  -        // re-instate this if test deps are propogated
  -//        if ( Artifact.SCOPE_TEST.equals( scope ) || 
Artifact.SCOPE_TEST.equals( inheritedScope ) )
  -        if ( Artifact.SCOPE_TEST.equals( scope ) )
  +        if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
           {
               desiredScope = Artifact.SCOPE_TEST;
           }
  
  
  

Reply via email to