-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove most logic from root build.gradle file (#247)
- Loading branch information
Showing
22 changed files
with
383 additions
and
294 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,10 @@ | ||
import gradle.kotlin.dsl.accessors._617ff5292df7551646490c1442241820.assemble | ||
import gradle.kotlin.dsl.accessors._617ff5292df7551646490c1442241820.jar | ||
import gradle.kotlin.dsl.accessors._617ff5292df7551646490c1442241820.sourceSets | ||
import gradle.kotlin.dsl.accessors._617ff5292df7551646490c1442241820.test | ||
import org.gradle.api.tasks.SourceSetContainer | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.creating | ||
import org.gradle.kotlin.dsl.get | ||
import org.gradle.kotlin.dsl.getValue | ||
import org.gradle.kotlin.dsl.invoke | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
|
||
/** | ||
* Plugin for base build setup of faker modules with kotlin | ||
*/ | ||
|
||
plugins { | ||
base | ||
kotlin("jvm") | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
configurations { | ||
create("integrationImplementation") { extendsFrom(configurations.getByName("testImplementation")) } | ||
create("integrationRuntimeOnly") { | ||
if (isShadow) { | ||
extendsFrom( | ||
configurations.getByName("testRuntimeOnly"), | ||
configurations.getByName("shadow"), | ||
) | ||
} else { | ||
extendsFrom(configurations.getByName("testRuntimeOnly")) | ||
} | ||
} | ||
} | ||
|
||
// configure sourceSets as extension since it's not available here as `sourceSets` is an extension on `Project` | ||
// https://docs.gradle.org/current/userguide/kotlin_dsl.html#project_extensions_and_conventions | ||
configure<SourceSetContainer> { | ||
create("integration") { | ||
resources.srcDir("src/integration/resources") | ||
compileClasspath += main.get().compileClasspath + test.get().compileClasspath | ||
runtimeClasspath += main.get().runtimeClasspath + test.get().runtimeClasspath | ||
} | ||
main { | ||
resources { | ||
this.srcDir("build/generated/src/main/resources") | ||
} | ||
} | ||
} | ||
|
||
val integrationTest: Test by tasks.creating(Test::class) { | ||
testClassesDirs = sourceSets["integration"].output.classesDirs | ||
classpath = sourceSets["integration"].runtimeClasspath | ||
} | ||
|
||
tasks.withType<Jar> { | ||
archiveBaseName.set(fullName) | ||
|
||
manifest { | ||
attributes( | ||
mapOf( | ||
"Implementation-Title" to fullName, | ||
"Implementation-Version" to project.version, | ||
/* | ||
* We can't add this here because this resolves the configuration, | ||
* after which it effectively becomes read-only and we'll get an error | ||
* Cannot change dependencies of dependency configuration ':core:implementation' after it has been included in dependency resolution | ||
* if we try to add more dependencies in the module's build.gradle file directly | ||
*/ | ||
// "Class-Path" to project.configurations.compileClasspath.get().joinToString(" ") { it.name } | ||
) | ||
) | ||
} | ||
} | ||
|
||
tasks { | ||
getByName(integrationTest.name).dependsOn(test) | ||
jar { dependsOn(integrationTest) } | ||
} | ||
group = rootProject.group.toString() | ||
|
||
tasks.withType<DokkaTask>().configureEach { | ||
onlyIf("Not dev") { !isDev.get() } | ||
onlyIf("Release or snapshot") { isRelease.get() || isSnapshot.get() } | ||
} |
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
Oops, something went wrong.