Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: zulu
cache: gradle

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: zulu
cache: gradle

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
validation:
name: Validation
name: Gradle Wrapper Validation
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/increment-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: zulu
cache: gradle

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: zulu
cache: gradle

Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
#
# Therefore, instructions below are superset of instructions required for all the projects.

.DS_Store

# `jenv` file with the local version of Java.
.java-version

# Kotlin temp directories.
**/.kotlin/**

# IntelliJ IDEA modules and interim config files.
*.iml
.idea/*.xml
Expand Down
12 changes: 12 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .lift.toml

This file was deleted.

21 changes: 9 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

import io.spine.dependency.build.CheckerFramework
import io.spine.dependency.build.ErrorProne
import io.spine.dependency.lib.Coroutines
import io.spine.dependency.lib.Guava
import io.spine.dependency.lib.JavaX
import io.spine.dependency.lib.KotlinX
import io.spine.dependency.local.Logging
import io.spine.dependency.test.JUnit
import io.spine.dependency.test.Kotest
Expand All @@ -46,7 +46,7 @@ import io.spine.gradle.report.pom.PomGenerator
import io.spine.gradle.standardToSpineSdk
import io.spine.gradle.testing.configureLogging
import io.spine.gradle.testing.registerTestTasks
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
`java-library`
Expand Down Expand Up @@ -94,18 +94,15 @@ subprojects {
CheckStyleConfig.applyTo(project)
LicenseReporter.generateReportIn(project)

val javaVersion = JavaVersion.VERSION_11.toString()

kotlin {
applyJvmToolchain(javaVersion)
compilerOptions {
jvmTarget.set(BuildSettings.jvmTarget)
setFreeCompilerArgs()
}
applyJvmToolchain(BuildSettings.javaVersion.asInt())
explicitApi()
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = javaVersion
setFreeCompilerArgs()
}

tasks.withType<JavaCompile> {
configureJavac()
configureErrorProne()
Expand All @@ -131,8 +128,8 @@ subprojects {
resolutionStrategy {
force(
Logging.lib,
KotlinX.Coroutines.core,
KotlinX.Coroutines.jdk8,
Coroutines.core,
Coroutines.jdk8,
)
}
}
Expand Down
25 changes: 11 additions & 14 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

/**
* This script uses two declarations of the constant [licenseReportVersion] because
* currently there is no way to define a constant _before_ a build script of `buildSrc`.
Expand All @@ -37,9 +39,6 @@ plugins {

// https://github.com/jk1/Gradle-License-Report/releases
id("com.github.jk1.dependency-license-report").version("2.7")

// https://github.com/johnrengelman/shadow/releases
id("com.github.johnrengelman.shadow").version("7.1.2")
}

repositories {
Expand Down Expand Up @@ -71,12 +70,12 @@ val licenseReportVersion = "2.7"
val grGitVersion = "4.1.1"

/**
* The version of the Kotlin Gradle plugin and Kotlin binaries used by the build process.
* The version of the Kotlin Gradle plugin used by the build process.
*
* This version may change from the [version of Kotlin][io.spine.dependency.lib.Kotlin.version]
* used by the project.
*/
val kotlinVersion = "1.8.22"
val kotlinVersion = "2.1.20"

/**
* The version of Guava used in `buildSrc`.
Expand All @@ -94,7 +93,7 @@ val guavaVersion = "32.1.3-jre"
* @see <a href="https://github.com/tbroyer/gradle-errorprone-plugin/releases">
* Error Prone Gradle Plugin Releases</a>
*/
val errorPronePluginVersion = "3.1.0"
val errorPronePluginVersion = "4.1.0"

/**
* The version of Protobuf Gradle Plugin.
Expand All @@ -114,14 +113,14 @@ val protobufPluginVersion = "0.9.4"
* @see <a href="https://github.com/Kotlin/dokka/releases">
* Dokka Releases</a>
*/
val dokkaVersion = "1.9.20"
val dokkaVersion = "2.0.0"

/**
* The version of Detekt Gradle Plugin.
*
* @see <a href="https://github.com/detekt/detekt/releases">Detekt Releases</a>
*/
val detektVersion = "1.23.0"
val detektVersion = "1.23.8"

/**
* @see [io.spine.dependency.test.Kotest]
Expand Down Expand Up @@ -156,15 +155,13 @@ configurations.all {
}
}

val jvmVersion = JavaLanguageVersion.of(11)

java {
toolchain.languageVersion.set(jvmVersion)
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = jvmVersion.toString()
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
90 changes: 69 additions & 21 deletions buildSrc/src/main/kotlin/BuildExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ val ScriptHandlerScope.protoData: ProtoData
* This plugin is published at Gradle Plugin Portal.
* But when used in a pair with [mcJava], it cannot be applied directly to a project.
* It is so, because [mcJava] uses [protoData] as its dependency.
* And buildscript's classpath ends up with both of them.
* And the buildscript's classpath ends up with both of them.
*/
val PluginDependenciesSpec.protoData: ProtoData
get() = ProtoData
Expand All @@ -111,8 +111,8 @@ val PluginDependenciesSpec.protoData: ProtoData
* declared in auto-generated `org.gradle.kotlin.dsl.PluginAccessors.kt` file.
* It conflicts with our own declarations.
*
* Declaring of top-level shortcuts eliminates the need in applying plugins
* using fully qualified name of dependency objects.
* Declaring of top-level shortcuts eliminates the need to apply plugins
* using a fully qualified name of dependency objects.
*
* It is still possible to apply a plugin with a custom version, if needed.
* Just declare a version again on the returned [PluginDependencySpec].
Expand Down Expand Up @@ -184,18 +184,39 @@ fun Project.configureTaskDependencies() {
val launchTestProtoData = "launchTestProtoData"
val generateProto = "generateProto"
val createVersionFile = "createVersionFile"
"compileKotlin".dependOn(launchProtoData)
"compileTestKotlin".dependOn(launchTestProtoData)
val compileKotlin = "compileKotlin"
compileKotlin.run {
dependOn(generateProto)
dependOn(launchProtoData)
}
val compileTestKotlin = "compileTestKotlin"
compileTestKotlin.dependOn(launchTestProtoData)
val sourcesJar = "sourcesJar"
sourcesJar.dependOn(generateProto)
sourcesJar.dependOn(launchProtoData)
sourcesJar.dependOn(createVersionFile)
sourcesJar.dependOn("prepareProtocConfigVersions")
val kspKotlin = "kspKotlin"
sourcesJar.run {
dependOn(generateProto)
dependOn(launchProtoData)
dependOn(kspKotlin)
dependOn(createVersionFile)
dependOn("prepareProtocConfigVersions")
}
val dokkaHtml = "dokkaHtml"
dokkaHtml.dependOn(generateProto)
dokkaHtml.dependOn(launchProtoData)
"dokkaJavadoc".dependOn(launchProtoData)
dokkaHtml.run {
dependOn(generateProto)
dependOn(launchProtoData)
dependOn(kspKotlin)
}
val dokkaJavadoc = "dokkaJavadoc"
dokkaJavadoc.run {
dependOn(launchProtoData)
dependOn(kspKotlin)
}
"publishPluginJar".dependOn(createVersionFile)
compileKotlin.dependOn(kspKotlin)
compileTestKotlin.dependOn("kspTestKotlin")
"compileTestFixturesKotlin".dependOn("kspTestFixturesKotlin")
"javadocJar".dependOn(dokkaHtml)
"dokkaKotlinJar".dependOn(dokkaJavadoc)
}
}

Expand All @@ -207,15 +228,14 @@ fun Project.configureTaskDependencies() {
val Project.productionModules: Iterable<Project>
get() = rootProject.subprojects.filter { !it.name.contains("-tests") }


/**
* Sets the remote debug option for this task.
* Sets the remote debug option for this [JavaExec] task.
*
* The port number is [5566][BuildSettings.REMOTE_DEBUG_PORT].
*
* @param enabled If `true` the task will be suspended.
*/
fun Task.remoteDebug(enabled: Boolean = true) { this as JavaExec
fun JavaExec.remoteDebug(enabled: Boolean = true) {
debugOptions {
this@debugOptions.enabled.set(enabled)
port.set(BuildSettings.REMOTE_DEBUG_PORT)
Expand All @@ -224,16 +244,35 @@ fun Task.remoteDebug(enabled: Boolean = true) { this as JavaExec
}
}

/**
* Sets the remote debug option for the task of [JavaExec] type with the given name.
*
* The port number is [5566][BuildSettings.REMOTE_DEBUG_PORT].
*
* @param enabled If `true` the task will be suspended.
* @throws IllegalStateException if the task with the given name is not found, or,
* if the taks is not of [JavaExec] type.
*/
fun Project.setRemoteDebug(taskName: String, enabled: Boolean = true) {
val task = tasks.findByName(taskName)
check(task != null) {
"Could not find a task named `$taskName` in the project `$name`."
}
check(task is JavaExec) {
"The task `$taskName` is not of type `JavaExec`."
}
task.remoteDebug(enabled)
}

/**
* Sets remote debug options for the `launchProtoData` task.
*
* @param enabled if `true` the task will be suspended.
*
* @see remoteDebug
*/
fun Project.protoDataRemoteDebug(enabled: Boolean = true) {
tasks.findByName("launchProtoData")?.remoteDebug(enabled)
}
fun Project.protoDataRemoteDebug(enabled: Boolean = true) =
setRemoteDebug("launchProtoData", enabled)

/**
* Sets remote debug options for the `launchTestProtoData` task.
Expand All @@ -242,6 +281,15 @@ fun Project.protoDataRemoteDebug(enabled: Boolean = true) {
*
* @see remoteDebug
*/
fun Project.testProtoDataRemoteDebug(enabled: Boolean = true) {
tasks.findByName("launchTestProtoData")?.remoteDebug(enabled)
}
fun Project.testProtoDataRemoteDebug(enabled: Boolean = true) =
setRemoteDebug("launchTestProtoData", enabled)

/**
* Sets remote debug options for the `launchTestFixturesProtoData` task.
*
* @param enabled if `true` the task will be suspended.
*
* @see remoteDebug
*/
fun Project.testFixturesProtoDataRemoteDebug(enabled: Boolean = true) =
setRemoteDebug("launchTestFixturesProtoData", enabled)
7 changes: 6 additions & 1 deletion buildSrc/src/main/kotlin/BuildSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import org.gradle.api.JavaVersion
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

/**
* This object provides high-level constants, like the version of JVM, to be used
* throughout the project.
*/
@Suppress("unused")
object BuildSettings {
private const val JVM_VERSION = 11
private const val JVM_VERSION = 17
val javaVersion: JavaLanguageVersion = JavaLanguageVersion.of(JVM_VERSION)
val javaVersionCompat: JavaVersion = JavaVersion.toVersion(JVM_VERSION)
val jvmTarget = JvmTarget.JVM_17
const val REMOTE_DEBUG_PORT = 5566
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/DependencyResolution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ fun Project.forceSpineBase() {
@Suppress("unused")
fun Project.forceBaseInProtoTasks() {
configurations.configureEach {
if (name.lowercased().contains("proto")) {
if (name.lowercase().contains("proto")) {
resolutionStrategy {
force(Base.libForBuildScript)
}
Expand Down
Loading
Loading