more prep for included-build Gradle plugins

This commit is contained in:
Adam 2022-09-18 13:56:02 +02:00
parent bb973c7b9b
commit cc6e559843
8 changed files with 77 additions and 63 deletions

View file

@ -101,10 +101,10 @@ kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(gradleJvmTarget))
}
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
idea {

View file

@ -0,0 +1,24 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
kotlin("jvm") version embeddedKotlinVersion
}
val gradleJvmTarget = "11"
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(gradleJvmTarget))
}
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = gradleJvmTarget
}
}

View file

@ -1,31 +1,10 @@
@file:Suppress("UnstableApiUsage")
rootProject.name = "builder-plugins"
pluginManagement {
@Suppress("UnstableApiUsage")
includeBuild("../settings-plugins/")
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
mavenCentral()
gradlePluginPortal()
}
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
versionCatalogs {
create("libs") {
from(files("../../gradle/libs.versions.toml"))
}
}
plugins {
id("kafkatorio.convention.settings.repositories")
}

View file

@ -0,0 +1,24 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
kotlin("jvm") version embeddedKotlinVersion
}
val gradleJvmTarget = "11"
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(gradleJvmTarget))
}
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = gradleJvmTarget
}
}

View file

@ -2,30 +2,11 @@
rootProject.name = "factorio-mod-manager"
pluginManagement {
@Suppress("UnstableApiUsage")
includeBuild("../settings-plugins/")
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
mavenCentral()
gradlePluginPortal()
}
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
versionCatalogs {
create("libs") {
from(files("../../gradle/libs.versions.toml"))
}
}
plugins {
id("kafkatorio.convention.settings.repositories")
}

View file

@ -7,14 +7,20 @@ plugins {
val gradleJvmTarget = "11"
dependencies {
// This project should only be providing simple plugins for configuring Gradle without
// dependencies. Try to avoid setting dependencies here, else the Gradle script classpath might
// get polluted and messy.
}
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(gradleJvmTarget))
}
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
kotlinDslPluginOptions {
jvmTarget.set(gradleJvmTarget)
}
tasks.withType<KotlinCompile>().configureEach {

View file

@ -75,3 +75,12 @@ fun RepositoryHandler.gitHub() {
}
}
}
fun RepositoryHandler.kotlinxHtml() {
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") {
mavenContent {
includeGroup("org.jetbrains.kotlinx")
}
}
}

View file

@ -2,14 +2,7 @@ package kafkatorio.convention.settings
@Suppress("UnstableApiUsage") // Central declaration of repositories is an incubating feature
dependencyResolutionManagement {
// https://github.com/gradle/gradle/issues/15754#issuecomment-763614651
// https://github.com/gradle/gradle/blob/09fcaacc9848f09aa584b4119be9271bee6916e6/build-logic/build-logic-base/settings-plugin/src/main/kotlin/gradlebuild.repositories.settings.gradle.kts#L68
// Cannot use 'FAIL_ON_PROJECT_REPOS' because
// - the 'gradle-guides-plugin' adds a repo (which it should not do)
// - the 'kotlin-gradle-plugin' adds a repo (and removes it afterwards) to download NodeJS
// repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
myMavenLocal()
@ -25,9 +18,7 @@ dependencyResolutionManagement {
content { includeGroup("dev.adamko.kotka") }
}
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") {
content { includeGroup("org.jetbrains.kotlinx") }
}
kotlinxHtml()
sonatypeSnapshot()
}