Skip to content

Commit

Permalink
Refactor build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg-Melnik committed Apr 17, 2024
1 parent bad4066 commit 70f084f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
7 changes: 0 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ subprojects {
ErrorProne.apply {
errorprone(core)
}

// Force versions for compilation/runtime as well.
//
// Maybe, not all of them are required in this scope.
// This is to investigate later.
//
doForceVersions(configurations)
}

protobuf {
Expand Down
32 changes: 20 additions & 12 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ val errorPronePluginVersion = "3.1.0"
*/
val protobufPluginVersion = "0.9.4"

/**
* The version of Dokka Gradle Plugins.
*
* Please keep in sync with [io.spine.internal.dependency.Dokka.version].
*
* @see <a href="https://github.com/Kotlin/dokka/releases">
* Dokka Releases</a>
*/
val dokkaVersion = "1.8.20"

/**
* The version of Detekt Gradle Plugin.
*
Expand Down Expand Up @@ -161,12 +151,30 @@ dependencies {

implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion")
implementation("com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}")
implementation("org.jetbrains.dokka:dokka-base:${dokkaVersion}")

// https://github.com/srikanth-lingala/zip4j
implementation("net.lingala.zip4j:zip4j:2.10.0")

implementation("io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion")
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion")
}

dependOnBuildSrcJar()

/**
* Adds a dependency on a `buildSrc.jar`, iff:
* 1) the `src` folder is missing, and
* 2) `buildSrc.jar` is present in `buildSrc/` folder instead.
*
* This approach is used in the scope of integration testing.
*/
fun Project.dependOnBuildSrcJar() {
val srcFolder = this.rootDir.resolve("src")
val buildSrcJar = rootDir.resolve("buildSrc.jar")
if (!srcFolder.exists() && buildSrcJar.exists()) {
logger.info("Adding the pre-compiled 'buildSrc.jar' to 'implementation' dependencies.")
dependencies {
implementation(files("buildSrc.jar"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ class `ApplySizeOptionPlugin should` {

val project = GradleProject.setupAt(projectDir)
.fromResources(TEST_PROJECT_DIR)
// `buildSrc` is not copied at all if caching is enabled.
.copyBuildSrc(false)
.copyBuildSrc()
.create()

val stderr = StringWriter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ subprojects {
api(Spine.base)

Protobuf.libs.forEach { implementation(it) }

// Force versions for compilation/runtime as well.
//
// Maybe, not all of them are required in this scope.
// This is to investigate later.
//
doForceVersions(configurations)
}

protobuf {
Expand Down

0 comments on commit 70f084f

Please sign in to comment.