Skip to content

Commit

Permalink
cleanup build:
Browse files Browse the repository at this point in the history
* move kotlin version to VC
* move plugins to root
* remove build-parameters
  • Loading branch information
whyoleg committed Nov 12, 2023
1 parent e3c3724 commit 12cd4fc
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 151 deletions.
16 changes: 8 additions & 8 deletions .github/actions/setup-gradle/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: "Setup Gradle"
description: "Setup konan relocation and gradle caching specific to kotlin MPP"
inputs:
os:
required: true
description: "OS"
default: ${{ matrix.os }}
cache-disabled:
description: When 'true', all caching is disabled. No entries will be written to or read from the cache.
required: false
Expand All @@ -16,28 +12,32 @@ inputs:
required: false
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
runs:
# noinspection YAMLSchemaValidation
using: "composite"
steps:
- if: inputs.os != 'windows-latest'
- if: runner.os != 'Windows'
run: echo "KONAN_DATA_DIR=${HOME}/.gradle/konan" >> $GITHUB_ENV
shell: bash
- if: inputs.os == 'windows-latest'
- if: runner.os == 'Windows'
run: echo "KONAN_DATA_DIR=${USERPROFILE}\.gradle\konan" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
# the latest listed version will be used for executions of gradle
java-version: |
8
11
21
17
20
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup gradle
uses: gradle/gradle-build-action@v2
with:
cache-disabled: ${{ inputs.cache-disabled }}
cache-read-only: ${{ inputs.cache-read-only }}
# disabled on windows because of issue with long paths
gradle-home-cache-cleanup: true
gradle-home-cache-includes: |
caches
notifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ plugins {
`kotlin-dsl`
}

kotlin {
jvmToolchain(8)
}

dependencies {
implementation(kotlinLibs.gradle.plugin)
implementation("rsocket.build:build-parameters")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,19 @@
*/

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
includeBuild("../kotlin-version-catalog")
includeBuild("../build-settings")
}

dependencyResolutionManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
plugins {
id("rsocketbuild.settings.default")
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../../libs.versions.toml"))
from(files("../gradle/libs.versions.toml"))
}
}
}

plugins {
id("kotlin-version-catalog")
}

rootProject.name = "build-logic"

includeBuild("../build-parameters")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

plugins {
kotlin("multiplatform")
id("build-parameters")
}

kotlin {
Expand All @@ -37,8 +36,3 @@ kotlin {
}
}
}

val buildParameters = the<buildparameters.BuildParametersExtension>()

if (buildParameters.skip.test) tasks.matching { it.name.endsWith("test", ignoreCase = true) }.configureEach { onlyIf { false } }
if (buildParameters.skip.link) tasks.matching { it.name.startsWith("link", ignoreCase = true) }.configureEach { onlyIf { false } }
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
plugins {
`maven-publish`
signing
id("build-parameters")
}

val buildParameters = the<buildparameters.BuildParametersExtension>()

val versionSuffix = buildParameters.versionSuffix.orNull
if (versionSuffix != null) {
val versionString = project.version.toString()
require(versionString.endsWith("-SNAPSHOT"))
project.version = versionString.replace("-", "-${versionSuffix}-")
println("Current version: ${project.version}")
}

//empty javadoc for maven central
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@

plugins {
`kotlin-dsl`
alias(libs.plugins.buildconfig)
}

kotlin {
jvmToolchain(8)
dependencies {
implementation(libs.build.gradle.enterprise)
implementation(libs.build.gradle.foojay)
}

dependencies {
implementation("rsocket.build:build-parameters")
buildConfig {
packageName("rsocketbuild.settings")
useKotlinOutput {
topLevelConstants = true
internalVisibility = true
}
buildConfigField("String", "kotlinVersion", libs.versions.kotlin.map { "\"$it\"" })
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositories {
gradlePluginPortal()
mavenCentral()
gradlePluginPortal()
}
}

rootProject.name = "kotlin-version-catalog"
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

includeBuild("../build-parameters")
rootProject.name = "build-settings"
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,34 @@
* limitations under the License.
*/

plugins {
id("rsocketbuild.settings.kotlin-version-catalog")
id("com.gradle.enterprise")
id("org.gradle.toolchains.foojay-resolver-convention")
}

pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

gradleEnterprise {
buildScan {
publishAlwaysIf(System.getenv("CI").toBoolean())
termsOfServiceUrl = "https://gradle.com/terms-of-service"
if (System.getenv("GITHUB_REPOSITORY") == "rsocket/rsocket-kotlin") {
termsOfServiceAgree = "yes"
}
}
}

rootProject.name = "build-parameters"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,29 @@
* limitations under the License.
*/

plugins {
id("build-parameters")
}
import rsocketbuild.settings.*

val kotlinVersion = "1.9.20"
val kotlinVersionOverride = the<buildparameters.BuildParametersExtension>().useKotlin.orNull?.takeIf(String::isNotBlank)
val kotlinVersionOverride = providers.gradleProperty("rsocketbuild.kotlinVersionOverride").orNull?.takeIf(String::isNotBlank)

if (kotlinVersionOverride != null) logger.lifecycle("Kotlin version override: $kotlinVersionOverride")

pluginManagement {
if (kotlinVersionOverride != null) repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") {
content {
includeGroupAndSubgroups("org.jetbrains.kotlin")
}
}
}
}

dependencyResolutionManagement {
if (kotlinVersionOverride != null) repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") {
content {
includeGroupAndSubgroups("org.jetbrains.kotlin")
}
}
}
versionCatalogs {
create("kotlinLibs") {
Expand All @@ -41,8 +46,6 @@ dependencyResolutionManagement {

plugin("multiplatform", "org.jetbrains.kotlin.multiplatform").versionRef(kotlin)
plugin("jvm", "org.jetbrains.kotlin.jvm").versionRef(kotlin)
plugin("plugin.serialization", "org.jetbrains.kotlin.plugin.serialization").versionRef(kotlin)
plugin("plugin.allopen", "org.jetbrains.kotlin.plugin.allopen").versionRef(kotlin)
}
}
}
13 changes: 8 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
import org.jetbrains.kotlin.gradle.targets.js.yarn.*

buildscript {
repositories {
mavenCentral()
}

dependencies {
// kotlinx.atomicfu should be on classpath
// it's an implementation detail of kotlinx.atomicfu gradle plugin
Expand All @@ -30,7 +26,6 @@ buildscript {
}

plugins {
id("build-parameters")
// for now BCV uses `allProjects` internally, so we can't apply it just to specific subprojects
alias(libs.plugins.kotlinx.bcv)
}
Expand All @@ -50,3 +45,11 @@ plugins.withType<YarnPlugin> {
yarnLockMismatchReport = YarnLockMismatchReport.WARNING
}
}

val skipTest = providers.gradleProperty("skip.test").map(String::toBoolean).getOrElse(false)
val skipLink = providers.gradleProperty("skip.link").map(String::toBoolean).getOrElse(false)

subprojects {
if (skipTest) tasks.matching { it.name.endsWith("test", ignoreCase = true) }.configureEach { onlyIf { false } }
if (skipLink) tasks.matching { it.name.startsWith("link", ignoreCase = true) }.configureEach { onlyIf { false } }
}
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
group=io.rsocket.kotlin
version=0.16.0-SNAPSHOT
#Kotlin
kotlin.js.compiler=ir
kotlin.native.ignoreIncorrectDependencies=true
kotlinx.atomicfu.enableJvmIrTransformation=true
kotlinx.atomicfu.enableJsIrTransformation=true
#Gradle
org.gradle.jvmargs=-Xmx2g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx2g
org.gradle.vfs.watch=true
org.gradle.configuration-cache=true
12 changes: 12 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[versions]

kotlin = "1.9.20"

kotlinx-atomicfu = "0.22.0"
kotlinx-coroutines = "1.7.3"
kotlinx-benchmark = "0.4.8"
Expand All @@ -10,6 +13,11 @@ turbine = "1.0.0"

rsocket-java = "1.1.3"

gradle-enterprise = "3.14.1"
gradle-foojay = "0.7.0"

buildconfig = "4.1.2"

jmh = "1.36"

[libraries]
Expand Down Expand Up @@ -43,6 +51,10 @@ rsocket-java-transport-local = { module = 'io.rsocket:rsocket-transport-local',

build-kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "kotlinx-atomicfu" }

build-gradle-enterprise = { module = "com.gradle:gradle-enterprise-gradle-plugin", version.ref = "gradle-enterprise" }
build-gradle-foojay = { module = "org.gradle.toolchains:foojay-resolver", version.ref = "gradle-foojay" }

[plugins]
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
kotlinx-bcv = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-bcv" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
48 changes: 0 additions & 48 deletions gradle/plugins/build-parameters/build.gradle.kts

This file was deleted.

Loading

0 comments on commit 12cd4fc

Please sign in to comment.