Last active
October 16, 2015 20:13
-
-
Save bigdaz/7ef46583ce262e30f1da to your computer and use it in GitHub Desktop.
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
class JavaLanguageExternalDependencyResolutionIntegrationTest extends AbstractIntegrationSpec { | |
def "resolved classpath includes transitive api-scoped dependencies of local components"() { | |
given: | |
mavenRepo.module("org.gradle", "compileDep").publish() | |
mavenRepo.module("org.gradle", "apiDep").publish() | |
buildFile << """ | |
plugins { | |
id 'jvm-component' | |
id 'java-lang' | |
} | |
repositories { | |
maven { url '${mavenRepo.uri}' } | |
} | |
model { | |
components { | |
main(JvmLibrarySpec) { | |
sources { | |
java { | |
dependencies { | |
library 'other' | |
} | |
} | |
} | |
} | |
other(JvmLibrarySpec) { | |
sources { | |
java { | |
dependencies { | |
library 'org.gradle:apiDep:1.0' exported(true) | |
library 'org.gradle:compileDep:1.0' | |
library 'apiLib' exported(true) | |
library 'compileLib' | |
} | |
} | |
} | |
} | |
apiLib(JvmLibrarySpec) { | |
} | |
compileLib(JvmLibrarySpec) { | |
} | |
} | |
tasks { | |
create('copyDeps', Copy) { | |
into 'mainLibs' | |
from compileMainJarMainJava.classpath | |
} | |
} | |
} | |
""" | |
// Needed to ensure the 'compileMainJarMainJava' task exists | |
file('src/main/java/TestApp.java') << '''public class TestApp {}''' | |
when: | |
succeeds ':copyDeps' | |
then: | |
file('mainLibs').assertHasDescendants('other.jar', 'apiLib.jar', 'apiDep-1.0.jar') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment