Use buildSrc to deduplicate build logic (#262)

This commit is contained in:
Vechro
2022-08-25 12:52:24 +03:00
committed by GitHub
parent 2479f9fe9a
commit f9130d9108
98 changed files with 1091 additions and 1683 deletions

View File

@@ -2,31 +2,31 @@ plugins {
`kotlin-dsl`
}
sourceSets {
val preload by creating {
this.java {
srcDir("src/preload/kotlin")
}
}
val main by getting
}
val preload: SourceSet by sourceSets.creating
repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()
}
val openrndrVersion =
(findProperty("OPENRNDR.version")?.toString() ?: System.getenv("OPENRNDR_VERSION"))?.replace("v", "")
val openrndrVersion: String =
(extra.properties["OPENRNDR.version"] as String? ?: System.getenv("OPENRNDR_VERSION"))?.removePrefix("v")
?: "0.5.1-SNAPSHOT"
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.openrndr") useVersion(openrndrVersion)
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20")
implementation("org.jetbrains.kotlin:kotlin-serialization:1.6.20")
val preloadImplementation by configurations.getting
preloadImplementation("org.openrndr:openrndr-application:$openrndrVersion")
preloadImplementation("org.openrndr:openrndr-extensions:$openrndrVersion")
implementation(libs.kotlin.gradle.plugin)
implementation(libs.dokka.gradle.plugin)
implementation(libs.kotlin.serialization.gradle.plugin)
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
"preloadImplementation"(libs.openrndr.application)
"preloadImplementation"(libs.openrndr.extensions)
}
tasks.getByName("compileKotlin").dependsOn("compilePreloadKotlin")