forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple dependency_managements with multiple ivy resolves.
This is the second pass of implementing dependency management in pants. The first pass was reviewed here: https://rbcommons.com/s/twitter/r/3336/ The design document is available here: https://docs.google.com/document/d/1AM_0e1Az_NHtR150Zsuyaa6u7InzBQGLq8MrUT57Od8/edit# This change allows managed_jar_dependencies targets to be chained together; the set of pinned artifact is the union of all jar coordinates specified by the transitive closure of the target specified in a jar_library's managed_dependencies field. When there are conflicts between dependencies in the transitive closure, the default behavior is to raise an error. Optionally, if using --no-jar-dependency-management-require-disjoint-sets, the most direct version (the first version encountered in a BFS) will be used, and a warning will be logged. The change to make ivy do multiple resolves is fairly simple; see ivy_task_mixin.py's resolve() method. Testing Done: Added integration tests for running multiple resolves, and for the new managed_jar_libraries factory. Added unit tests for transitive artifact set calculation. CI went green here: https://travis-ci.org/pantsbuild/pants/builds/104711840 CI went green here: https://travis-ci.org/pantsbuild/pants/builds/104947421 CI went green here: https://travis-ci.org/pantsbuild/pants/builds/104985770 Bugs closed: 2830 Reviewed at https://rbcommons.com/s/twitter/r/3367/
- Loading branch information
1 parent
6ea125a
commit 39223ab
Showing
12 changed files
with
414 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
testprojects/tests/java/org/pantsbuild/testproject/depman/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Tests for dependency management integration. | ||
|
||
managed_jar_dependencies(name='new-manager', | ||
artifacts=[ | ||
jar('jersey', 'jersey', '0.7-ea'), | ||
], | ||
) | ||
|
||
managed_jar_dependencies(name='old-manager', | ||
artifacts=[ | ||
jar('jersey', 'jersey', '0.4-ea'), | ||
], | ||
) | ||
|
||
jar_library(name='common-lib', | ||
jars=[ | ||
jar('javax.annotation', 'jsr250-api', '1.0'), | ||
jar('javax.persistence', 'persistence-api', '1.0.2'), | ||
jar('javax.servlet', 'servlet-api', '2.5'), | ||
jar('com.sun.xml.txw2', 'txw2', '20110809'), | ||
], | ||
) | ||
|
||
jar_library(name='old-jersey', | ||
jars=[ | ||
jar('jersey', 'jersey'), | ||
], | ||
managed_dependencies=':old-manager', | ||
) | ||
|
||
jar_library(name='new-jersey', | ||
jars=[ | ||
jar('jersey', 'jersey'), | ||
], | ||
managed_dependencies=':new-manager', | ||
) | ||
|
||
junit_tests(name='old-tests', | ||
sources=['OldTest.java'], | ||
dependencies=[ | ||
'3rdparty:junit', | ||
':common-lib', | ||
':old-jersey', | ||
], | ||
) | ||
|
||
junit_tests(name='new-tests', | ||
sources=['NewTest.java'], | ||
dependencies=[ | ||
'3rdparty:junit', | ||
':common-lib', | ||
':new-jersey', | ||
], | ||
) |
21 changes: 21 additions & 0 deletions
21
testprojects/tests/java/org/pantsbuild/testproject/depman/NewTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.pantsbuild.testproject.depman.NewTest; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** Tests that should have jersey-0.7-ea on the classpath. */ | ||
public class NewTest { | ||
|
||
@Test | ||
public void testNewIsPresent() { | ||
assertEquals("WadlFactory", com.sun.ws.rest.impl.wadl.WadlFactory.class.getSimpleName()); | ||
} | ||
|
||
@Test(expected=ClassNotFoundException.class) | ||
public void testOldNotPresent() throws ClassNotFoundException { | ||
String notInNew = "com.sun.ws.rest.tools.webapp.writer.WebApp"; | ||
getClass().getClassLoader().loadClass(notInNew); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
testprojects/tests/java/org/pantsbuild/testproject/depman/OldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.pantsbuild.testproject.depman.OldTest; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** Tests that should have jersey-0.4-ea on the classpath. */ | ||
public class OldTest { | ||
|
||
@Test | ||
public void testOldIsPresent() { | ||
assertEquals("WebApp", com.sun.ws.rest.tools.webapp.writer.WebApp.class.getSimpleName()); | ||
} | ||
|
||
@Test(expected=ClassNotFoundException.class) | ||
public void testNewNotPresent() throws ClassNotFoundException { | ||
String notInOld = "com.sun.ws.rest.impl.wadl.WadlFactory"; | ||
getClass().getClassLoader().loadClass(notInOld); | ||
} | ||
|
||
} |
Oops, something went wrong.