diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 0000000..bd9f9c7 --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + `kotlin-dsl` +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22") + implementation("com.alecstrong:grammar-kit-composer:0.1.10") + implementation("io.github.gradle-nexus:publish-plugin:1.1.0") + implementation("org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin:0.12.1") + implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") + implementation("app.cash.sqldelight:gradle-plugin:2.0.0-alpha04") + implementation("app.cash.licensee:licensee-gradle-plugin:1.6.0") +} + +gradlePlugin { + plugins { + create("MyRepos") { + id = "MyRepos" + implementationClass = "MyRepos" + } + create("repos") { + id = "repos" + implementationClass = "Repos" + } + } +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 0000000..76a0431 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,9 @@ +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +rootProject.name = "build-logic" diff --git a/build-logic/src/main/kotlin/MyRepos.kt b/build-logic/src/main/kotlin/MyRepos.kt new file mode 100644 index 0000000..10a7108 --- /dev/null +++ b/build-logic/src/main/kotlin/MyRepos.kt @@ -0,0 +1,24 @@ +import org.gradle.api.* +import org.gradle.api.artifacts.dsl.* +import org.gradle.api.initialization.* +import org.gradle.kotlin.dsl.* + +class MyRepos : Plugin { + override fun apply(settings: Settings) { + settings.dependencyResolutionManagement { + repositories { + repos() + } + } + } +} + +fun RepositoryHandler.repos() { + maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") + mavenCentral() + + maven(url = "https://www.jetbrains.com/intellij-repository/releases") + maven(url = "https://cache-redirector.jetbrains.com/intellij-dependencies") + maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies/") + maven(url = "https://maven.pkg.jetbrains.space/public/p/ktor/eap") +} diff --git a/build-logic/src/main/kotlin/Repos.kt b/build-logic/src/main/kotlin/Repos.kt new file mode 100644 index 0000000..1413cb0 --- /dev/null +++ b/build-logic/src/main/kotlin/Repos.kt @@ -0,0 +1,9 @@ +import org.gradle.api.* + +class Repos: Plugin { + override fun apply(project: Project) { + project.repositories.apply { + repos() + } + } +} diff --git a/build-logic/src/main/kotlin/exclude.gradle.kts b/build-logic/src/main/kotlin/exclude.gradle.kts new file mode 100644 index 0000000..b3592a6 --- /dev/null +++ b/build-logic/src/main/kotlin/exclude.gradle.kts @@ -0,0 +1,12 @@ +configurations.configureEach { + exclude(group = "com.jetbrains.rd") + exclude(group = "com.github.jetbrains", module = "jetCheck") + exclude(group = "com.jetbrains.infra") + + exclude(group = "org.roaringbitmap") + + exclude(group = "ai.grazie.spell") + exclude(group = "ai.grazie.model") + exclude(group = "ai.grazie.utils") + exclude(group = "ai.grazie.nlp") +} diff --git a/build-logic/src/main/kotlin/publish.gradle.kts b/build-logic/src/main/kotlin/publish.gradle.kts new file mode 100644 index 0000000..c4ec1d2 --- /dev/null +++ b/build-logic/src/main/kotlin/publish.gradle.kts @@ -0,0 +1,61 @@ +import org.gradle.api.artifacts.repositories.* +import org.gradle.api.publish.maven.* +import org.gradle.api.tasks.bundling.* +import org.gradle.kotlin.dsl.* +import java.util.* + +plugins { + `maven-publish` + signing +} + +val emptyJar by tasks.registering(Jar::class) { } + +publishing { + repositories { + maven(url = "https://maven.pkg.github.com/hfhbd/kobol") { + name = "GitHubPackages" + credentials(PasswordCredentials::class) + } + } + publications.all { + this as MavenPublication + artifact(emptyJar) { + classifier = "javadoc" + } + pom { + name.set("app.softwork Postgres Native Driver and SqlDelight Dialect") + description.set("A Postgres native driver including support for SqlDelight") + url.set("https://github.com/hfhbd/SqlDelightNativePostgres") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("hfhbd") + name.set("Philip Wedemann") + email.set("mybztg+mavencentral@icloud.com") + } + } + scm { + connection.set("scm:git://github.com/hfhbd/SqlDelightNativePostgres.git") + developerConnection.set("scm:git://github.com/hfhbd/SqlDelightNativePostgres.git") + url.set("https://github.com/hfhbd/SqlDelightNativePostgres") + } + } + } +} + +(System.getProperty("signing.privateKey") ?: System.getenv("SIGNING_PRIVATE_KEY"))?.let { + String(Base64.getDecoder().decode(it)).trim() +}?.let { key -> + println("found key, config signing") + signing { + val signingPassword = System.getProperty("signing.password") ?: System.getenv("SIGNING_PASSWORD") + useInMemoryPgpKeys(key, signingPassword) + sign(publishing.publications) + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 906184a..af6fadf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,96 +1,5 @@ -import app.cash.licensee.* -import org.jetbrains.kotlin.gradle.dsl.* -import java.util.* - plugins { - kotlin("multiplatform") version "1.7.22" apply false - `maven-publish` - signing - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" - id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.1" - id("com.github.johnrengelman.shadow") version "7.1.2" apply false - id("com.alecstrong.grammar.kit.composer") version "0.1.10" apply false - id("app.cash.sqldelight") version "2.0.0-alpha04" apply false - id("app.cash.licensee") version "1.6.0" apply false -} - -repositories { - mavenCentral() -} - -group = "app.softwork" - -subprojects { - if (this.name == "testing") { - return@subprojects - } - - plugins.apply("app.cash.licensee") - configure { - allow("Apache-2.0") - allow("MIT") - allowUrl("https://jdbc.postgresql.org/about/license.html") - } - - afterEvaluate { - configure { - explicitApi() - sourceSets { - all { - languageSettings.progressiveMode = true - } - } - } - } - - plugins.apply("org.gradle.maven-publish") - plugins.apply("org.gradle.signing") - val emptyJar by tasks.creating(Jar::class) { } - - group = "app.softwork" - - publishing { - publications.all { - this as MavenPublication - artifact(emptyJar) { - classifier = "javadoc" - } - pom { - name.set("app.softwork Postgres Native Driver and SqlDelight Dialect") - description.set("A Postgres native driver including support for SqlDelight") - url.set("https://github.com/hfhbd/kotlinx-serialization-csv") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("hfhbd") - name.set("Philip Wedemann") - email.set("mybztg+mavencentral@icloud.com") - } - } - scm { - connection.set("scm:git://github.com/hfhbd/SqlDelightNativePostgres.git") - developerConnection.set("scm:git://github.com/hfhbd/SqlDelightNativePostgres.git") - url.set("https://github.com/hfhbd/SqlDelightNativePostgres") - } - } - } - } - - (System.getProperty("signing.privateKey") ?: System.getenv("SIGNING_PRIVATE_KEY"))?.let { - String(Base64.getDecoder().decode(it)).trim() - }?.let { key -> - println("found key, config signing") - signing { - val signingPassword = System.getProperty("signing.password") ?: System.getenv("SIGNING_PASSWORD") - useInMemoryPgpKeys(key, signingPassword) - sign(publishing.publications) - } - } + id("io.github.gradle-nexus.publish-plugin") } nexusPublishing { diff --git a/gradle.properties b/gradle.properties index f683daf..ad7aba6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,5 @@ kotlin.native.cacheKind.linuxX64=none org.gradle.parallel=true org.gradle.jvmargs=-Xmx2048m + +group=app.softwork diff --git a/postgres-native-sqldelight-dialect/build.gradle.kts b/postgres-native-sqldelight-dialect/build.gradle.kts index 14fbcd2..4cb305a 100644 --- a/postgres-native-sqldelight-dialect/build.gradle.kts +++ b/postgres-native-sqldelight-dialect/build.gradle.kts @@ -3,9 +3,13 @@ import org.jetbrains.grammarkit.tasks.* plugins { kotlin("jvm") - `maven-publish` - id("com.github.johnrengelman.shadow") - id("com.alecstrong.grammar.kit.composer") + com.alecstrong.grammar.kit.composer + com.github.johnrengelman.shadow + org.jetbrains.kotlinx.`binary-compatibility-validator` + app.cash.licensee + repos + publish + exclude } java { @@ -13,14 +17,6 @@ java { withSourcesJar() } -repositories { - mavenCentral() - maven(url = "https://www.jetbrains.com/intellij-repository/releases") - maven(url = "https://cache-redirector.jetbrains.com/intellij-dependencies") - maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies/") - maven(url = "https://maven.pkg.jetbrains.space/public/p/ktor/eap") -} - val idea = "222.4459.24" grammarKit { @@ -55,14 +51,12 @@ kotlin { target.compilations.all { kotlinOptions.allWarningsAsErrors = true } -} - -configurations.all { - exclude(group = "com.jetbrains.rd") - exclude(group = "com.github.jetbrains", module = "jetCheck") - exclude(group = "org.roaringbitmap") - exclude(group = "com.jetbrains.intellij.remoteDev") - exclude(group = "com.jetbrains.intellij.spellchecker") + explicitApi() + sourceSets { + all { + languageSettings.progressiveMode = true + } + } } tasks { @@ -131,3 +125,9 @@ publishing { } } } + +licensee { + allow("Apache-2.0") + allow("MIT") + allowUrl("https://jdbc.postgresql.org/about/license.html") +} diff --git a/postgres-native-sqldelight-driver/build.gradle.kts b/postgres-native-sqldelight-driver/build.gradle.kts index 807bbf3..b24cb61 100644 --- a/postgres-native-sqldelight-driver/build.gradle.kts +++ b/postgres-native-sqldelight-driver/build.gradle.kts @@ -2,13 +2,18 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.* plugins { kotlin("multiplatform") -} - -repositories { - mavenCentral() + app.cash.licensee + repos } kotlin { + explicitApi() + sourceSets { + all { + languageSettings.progressiveMode = true + } + } + fun KotlinNativeTarget.config() { compilations.getByName("main") { cinterops { @@ -48,3 +53,7 @@ kotlin { } } } + +licensee { + allow("Apache-2.0") +} diff --git a/settings.gradle.kts b/settings.gradle.kts index f3adc06..6405533 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,15 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } + includeBuild("build-logic") +} + +plugins { + id("MyRepos") +} + rootProject.name = "postgres-native-sqldelight" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") diff --git a/testing/build.gradle.kts b/testing/build.gradle.kts index cd1c78a..a3f123d 100644 --- a/testing/build.gradle.kts +++ b/testing/build.gradle.kts @@ -1,10 +1,7 @@ plugins { kotlin("multiplatform") - id("app.cash.sqldelight") -} - -repositories { - mavenCentral() + app.cash.sqldelight + repos } kotlin {