Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSP #62

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

KSP #62

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
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
repositories {
google()
mavenCentral()
maven { setUrl("http://repo1.maven.org/maven2") }
maven { setUrl("https://repo1.maven.org/maven2") }
maven { setUrl("https://plugins.gradle.org/m2/") }
maven { setUrl("https://dl.bintray.com/kotlin/dokka") }
}
Expand Down Expand Up @@ -45,7 +45,6 @@ if (localPropertiesFile.exists()) {
nexusPublishing {
this.repositories {
sonatype {
// nexusUrl.set(URI("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"))
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
val sonatypeUsername = project.properties["ossrhUsername"]?.toString()
val sonatypePassword = project.properties["ossrhPassword"]?.toString()
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.8.10"
`kotlin-dsl`
}

buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
}
repositories {
mavenCentral()
Expand Down Expand Up @@ -42,4 +43,4 @@ gradlePlugin {
implementationClass = "fr.xgouchet.buildsrc.plugin.GithubWikiPlugin"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package fr.xgouchet.buildsrc.settings

import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun Project.kotlinConfig() {

tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
tasks.withType(KotlinCompile::class.java).forEach {
it.compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

extensions.findByType(KotlinProjectExtension::class.java)?.apply {
jvmToolchain(17)
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
kotlin = "1.8.10"
kotlinSP = "1.8.10-1.0.9"

junitJupiter = "5.9.3"
junitPlatform = "1.9.3"
Expand All @@ -21,6 +22,7 @@ nexusPublish = "1.1.0"
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlinGP = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinSP = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "kotlinSP" }

junitPlatform = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junitPlatform" }
junitVintage = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junitVintage" }
Expand Down
2 changes: 1 addition & 1 deletion inject/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fr.xgouchet.buildsrc.settings.commonConfig

plugins {
id("org.jetbrains.kotlin.jvm")
kotlin("jvm")
id("com.github.ben-manes.versions")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
Expand Down
2 changes: 1 addition & 1 deletion junit4/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fr.xgouchet.buildsrc.settings.commonConfig

plugins {
id("org.jetbrains.kotlin.jvm")
kotlin("jvm")
id("com.github.ben-manes.versions")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
Expand Down
2 changes: 1 addition & 1 deletion junit5/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fr.xgouchet.buildsrc.settings.commonConfig

plugins {
id("org.jetbrains.kotlin.jvm")
kotlin("jvm")
id("com.github.ben-manes.versions")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ class ForgeExtension :
if (it.value.java == ForgeConfigurator.NoOp.javaClass) {
ForgeConfigurator.NoOp
} else {
it.value.java.newInstance()
val constructor = it.value.java.constructors.firstOrNull {
it.parameterCount == 0
}
constructor?.newInstance() as? ForgeConfigurator ?: ForgeConfigurator.NoOp
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion jvm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fr.xgouchet.buildsrc.settings.commonConfig

plugins {
id("org.jetbrains.kotlin.jvm")
kotlin("jvm")
id("com.github.ben-manes.versions")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
Expand All @@ -13,6 +13,7 @@ plugins {
dependencies {

implementation(project(":core"))
implementation(libs.kotlin)

testImplementation(project(":inject"))
testImplementation(project(":junit5"))
Expand Down
34 changes: 34 additions & 0 deletions ksp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import fr.xgouchet.buildsrc.settings.commonConfig

plugins {
kotlin("jvm")
id("com.github.ben-manes.versions")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
id("org.jetbrains.dokka")
`maven-publish`
signing
}

dependencies {

implementation(project(":core"))
implementation(libs.kotlin)
implementation(libs.kotlinSP)

implementation("com.squareup:kotlinpoet:1.14.2") {
exclude(module = "kotlin-reflect")
}
implementation("com.squareup:kotlinpoet-ksp:1.14.2")

testImplementation(project(":inject"))
testImplementation(project(":junit5"))

testImplementation(libs.bundles.junit5)
testImplementation(libs.assertJ)
testImplementation(libs.mockitoJunit5)
testImplementation(libs.mockitoKotlin)
testImplementation("com.github.tschuchortdev:kotlin-compile-testing-ksp:1.5.0")
}

commonConfig("KSP project")
Loading