@@ -2,40 +2,18 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
22import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
33import org.jetbrains.dokka.gradle.DokkaTask
44
5+ /* *
6+ * Plugin for "faker libraries"
7+ */
8+
59plugins {
6- base
710 `java- library`
8- kotlin(" jvm" )
911 id(" org.jetbrains.dokka" )
1012 id(" com.github.johnrengelman.shadow" )
13+ id(" faker-base-conventions" )
1114 id(" faker-pub-conventions" )
1215}
1316
14- configurations {
15- create(" integrationImplementation" ) { extendsFrom(configurations.getByName(" testImplementation" )) }
16- create(" integrationRuntimeOnly" ) {
17- extendsFrom(
18- configurations.getByName(" testRuntimeOnly" ),
19- configurations.getByName(" shadow" )
20- )
21- }
22- }
23-
24- // configure sourceSets as extension since it's not available here as `sourceSets` is an extension on `Project`
25- // https://docs.gradle.org/current/userguide/kotlin_dsl.html#project_extensions_and_conventions
26- configure<SourceSetContainer > {
27- create(" integration" ) {
28- resources.srcDir(" src/integration/resources" )
29- compileClasspath + = main.get().compileClasspath + test.get().compileClasspath
30- runtimeClasspath + = main.get().runtimeClasspath + test.get().runtimeClasspath
31- }
32- main {
33- resources {
34- this .srcDir(" build/generated/src/main/resources" )
35- }
36- }
37- }
38-
3917dependencies {
4018 val shadow by configurations
4119 val implementation by configurations
@@ -59,32 +37,6 @@ dependencies {
5937 testRuntimeOnly(libs.bundles.jackson)
6038}
6139
62- val integrationTest by tasks.creating(Test ::class ) {
63- testClassesDirs = sourceSets[" integration" ].output.classesDirs
64- classpath = sourceSets[" integration" ].runtimeClasspath
65- dependsOn(tasks.test)
66- }
67-
68- tasks.withType<Jar > {
69- archiveBaseName.set(fullName)
70-
71- manifest {
72- attributes(
73- mapOf (
74- " Implementation-Title" to fullName,
75- " Implementation-Version" to project.version,
76- /*
77- * We can't add this here because this resolves the configuration,
78- * after which it effectively becomes read-only and we'll get an error
79- * Cannot change dependencies of dependency configuration ':core:implementation' after it has been included in dependency resolution
80- * if we try to add more dependencies in the module's build.gradle file directly
81- */
82- // "Class-Path" to project.configurations.compileClasspath.get().joinToString(" ") { it.name }
83- )
84- )
85- }
86- }
87-
8840val shadowJar by tasks.getting(ShadowJar ::class ) {
8941 minimize()
9042 archiveBaseName.set(fullName)
@@ -116,15 +68,10 @@ val shadowJar by tasks.getting(ShadowJar::class) {
11668 from(" ${rootProject.rootDir.resolve(" LICENSE.adoc" )} " ) {
11769 into(" META-INF" )
11870 }
119- dependsOn(integrationTest)
71+ dependsOn(tasks[ " integrationTest" ] )
12072 dependsOn(tasks.jar)
12173}
12274
123- artifacts {
124- archives(sourcesJar)
125- archives(dokkaJavadocJar)
126- }
127-
12875publishing {
12976 publications.withType<MavenPublication >().all {
13077 // For whatever reason I'm not able to use this in the faker-pub-conventions plugin
@@ -140,8 +87,3 @@ tasks {
14087 dependsOn(shadowJar)
14188 }
14289}
143-
144- tasks.withType<DokkaTask >().configureEach {
145- onlyIf(" Not dev" ) { ! isDev.get() }
146- onlyIf(" Release or snapshot" ) { isRelease.get() || isSnapshot.get() }
147- }
0 commit comments