1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Fix 'test' dependencies

The previously used approach of

project(':smack-core').sourceSets.test.runtimeClasspath

caused the 'eclipse' target to produce duplicate classpath entries in
.classpath when run with Gradle >= 2.6. It also relied on Gradle
internals.

Instead we now use

project(path: ":smack-core", configuration: "testRuntime")
project(path: ":smack-core", configuration: "archives")

to be able to use test classes from other subprojects (usually
smack-core) in e.g. smack-extensions. The 'archives' configuration
includes the test jar.

See also https://discuss.gradle.org/t/11784

Thanks to Lari Hotari for helping with this issue.
This commit is contained in:
Florian Schmaus 2016-02-10 12:39:18 +01:00
parent f571b6ef5b
commit 529e1eb058
11 changed files with 20 additions and 11 deletions

View file

@ -274,7 +274,7 @@ subprojects {
classifier = 'javadoc' classifier = 'javadoc'
from javadoc.destinationDir from javadoc.destinationDir
} }
task testJar(type: Jar) { task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests' classifier = 'tests'
from sourceSets.test.output from sourceSets.test.output
} }
@ -293,6 +293,10 @@ subprojects {
} }
} }
configurations {
archivesOutput.extendsFrom (testCompile)
}
artifacts { artifacts {
archives sourcesJar archives sourcesJar
archives javadocJar archives javadocJar

View file

@ -6,5 +6,5 @@ Connect your favourite slf4j backend of choice to get output inside of it"""
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
compile 'org.slf4j:slf4j-api:[1.7,1.8)' compile 'org.slf4j:slf4j-api:[1.7,1.8)'
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
} }

View file

@ -4,5 +4,5 @@ Inspect the exchanged XMPP stanzas."""
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
} }

View file

@ -7,5 +7,6 @@ between patch versions."""
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
compile project(':smack-extensions') compile project(':smack-extensions')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
testCompile project(path: ":smack-core", configuration: "archives")
} }

View file

@ -10,5 +10,6 @@ dependencies {
// Some implementations need APIs provided by smack-im, // Some implementations need APIs provided by smack-im,
// e.g. message delivery receipts the roster // e.g. message delivery receipts the roster
compile project(':smack-im') compile project(':smack-im')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
testCompile project(path: ":smack-core", configuration: "archives")
} }

View file

@ -7,5 +7,6 @@ Roster, Chat and other functionality."""
// sourceSet.test of the core subproject // sourceSet.test of the core subproject
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
testCompile project(path: ":smack-core", configuration: "archives")
} }

View file

@ -7,5 +7,5 @@ dependencies {
compile project(':smack-extensions') compile project(':smack-extensions')
compile 'javax.media:jmf:2.1.1e' compile 'javax.media:jmf:2.1.1e'
compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar') compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
} }

View file

@ -6,5 +6,5 @@ Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
compile project(':smack-extensions') compile project(':smack-extensions')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
} }

View file

@ -4,5 +4,6 @@ Use javax.security.sasl for SASL."""
dependencies { dependencies {
compile project(path: ':smack-core') compile project(path: ':smack-core')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
testCompile project(path: ":smack-core", configuration: "archives")
} }

View file

@ -4,5 +4,6 @@ Use Smack provided code for SASL."""
dependencies { dependencies {
compile project(path: ':smack-core') compile project(path: ':smack-core')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
testCompile project(path: ":smack-core", configuration: "archives")
} }

View file

@ -3,5 +3,5 @@ Smack for standard XMPP connections over TCP."""
dependencies { dependencies {
compile project(':smack-core') compile project(':smack-core')
testCompile project(':smack-core').sourceSets.test.runtimeClasspath testCompile project(path: ":smack-core", configuration: "testRuntime")
} }