| 1 |
import junitbuild.java.ModuleCompileOptions |
| 2 |
|
| 3 |
plugins { |
| 4 |
id("junitbuild.java-library-conventions") |
| 5 |
id("com.github.johnrengelman.shadow") |
| 6 |
} |
| 7 |
|
| 8 |
val shadowed by configurations.creatingResolvable |
| 9 |
|
| 10 |
configurations { |
| 11 |
listOf(apiElements, runtimeElements).forEach { |
| 12 |
it.configure { |
| 13 |
outgoing { |
| 14 |
artifacts.clear() |
| 15 |
artifact(tasks.shadowJar) { |
| 16 |
classifier = "" |
| 17 |
} |
| 18 |
} |
| 19 |
} |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
sourceSets { |
| 24 |
main { |
| 25 |
compileClasspath += shadowed |
| 26 |
} |
| 27 |
test { |
| 28 |
runtimeClasspath += shadowed |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
eclipse { |
| 33 |
classpath { |
| 34 |
plusConfigurations.add(shadowed) |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
idea { |
| 39 |
module { |
| 40 |
scopes["PROVIDED"]!!["plus"]!!.add(shadowed) |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
tasks { |
| 45 |
javadoc { |
| 46 |
classpath += shadowed |
| 47 |
} |
| 48 |
checkstyleMain { |
| 49 |
classpath += shadowed |
| 50 |
} |
| 51 |
shadowJar { |
| 52 |
configurations = listOf(shadowed) |
| 53 |
exclude("META-INF/maven/**") |
| 54 |
excludes.remove("module-info.class") |
| 55 |
archiveClassifier = "" |
| 56 |
} |
| 57 |
jar { |
| 58 |
dependsOn(shadowJar) |
| 59 |
enabled = false |
| 60 |
} |
| 61 |
named<Jar>("codeCoverageClassesJar") { |
| 62 |
from(shadowJar.map { zipTree(it.archiveFile) }) |
| 63 |
exclude("**/shadow/**") |
| 64 |
} |
| 65 |
test { |
| 66 |
dependsOn(shadowJar) |
| 67 |
// in order to run the test against the shadowJar |
| 68 |
classpath -= sourceSets.main.get().output |
| 69 |
classpath += files(shadowJar.map { it.archiveFile }) |
| 70 |
} |
| 71 |
named<JavaCompile>("compileModule") { |
| 72 |
the<ModuleCompileOptions>().modulePath.from(shadowed) |
| 73 |
} |
| 74 |
} |