-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from TouK/gradle_kts
Migrate build.gradle to Kotlin
- Loading branch information
Showing
19 changed files
with
396 additions
and
299 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pl.touk.krush.gradle.Versions | ||
|
||
plugins { | ||
id("kotlin") | ||
id("kotlin-kapt") | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") | ||
implementation("com.squareup:kotlinpoet:${Versions.kotlinpoet}") | ||
implementation("com.squareup:kotlinpoet-metadata:${Versions.kotlinpoet}") | ||
|
||
api("org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final") | ||
|
||
api(project(":runtime")) | ||
|
||
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.junit}") | ||
testImplementation("org.assertj:assertj-core:${Versions.assertj}") | ||
testRuntimeOnly("ch.qos.logback:logback-classic:${Versions.logback}") | ||
testImplementation("io.github.jbock-java:compile-testing:0.19.12") | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import pl.touk.krush.gradle.signPublicationIfKeyPresent | ||
|
||
plugins { | ||
kotlin("jvm") apply true | ||
kotlin("kapt") apply true | ||
kotlin("plugin.serialization") version "1.7.10" | ||
id("pl.allegro.tech.build.axion-release") version "1.13.14" | ||
`maven-publish` | ||
} | ||
|
||
scmVersion { | ||
useHighestVersion = true | ||
tag { | ||
prefix = "krush-" | ||
} | ||
} | ||
|
||
group = "pl.touk.krush" | ||
project.version = scmVersion.version | ||
val rootVersion = scmVersion.version | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
val snapshot = scmVersion.version.endsWith("SNAPSHOT") | ||
|
||
configure(listOf(project(":annotation-processor"), project(":runtime"), project(":runtime-postgresql"))) { | ||
apply(plugin = "java") | ||
apply(plugin = "maven-publish") | ||
apply(plugin = "signing") | ||
|
||
tasks.withType(Sign::class.java) { | ||
onlyIf { snapshot.not() } | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = "pl.touk.krush" | ||
artifactId = "krush-${project.name}" | ||
version = rootVersion | ||
|
||
from(components["java"]) | ||
|
||
pom { | ||
name.set("krush-${project.name}") | ||
description.set("Krush, idiomatic persistence layer for Kotlin") | ||
url.set("https://github.com/TouK/krush") | ||
scm { | ||
url.set("scm:[email protected]:TouK/krush.git") | ||
connection.set("scm:[email protected]:TouK/krush.git") | ||
developerConnection.set("scm:[email protected]:TouK/krush.git") | ||
} | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("mateusz_sledz") | ||
name.set("Mateusz Śledź") | ||
} | ||
developer { | ||
id.set("piotr_jagielski") | ||
name.set("Piotr Jagielski") | ||
} | ||
} | ||
} | ||
signPublicationIfKeyPresent(project) | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
credentials { | ||
username = System.getenv("SONATYPE_USERNAME") | ||
password = System.getenv("SONATYPE_PASSWORD") | ||
} | ||
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
url = uri(if (snapshot) snapshotsRepoUrl else releasesRepoUrl) | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
gradleApi() | ||
implementation("org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm.gradle.plugin", "1.7.10") | ||
implementation("io.github.gradle-nexus", "publish-plugin", "1.0.0") | ||
} | ||
|
||
plugins { | ||
`kotlin-dsl` apply true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pl.touk.krush.gradle | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.plugins.signing.SigningExtension | ||
|
||
fun MavenPublication.signPublicationIfKeyPresent(project: Project) { | ||
val signingKey = System.getenv("SIGNING_PRIVATE_KEY") | ||
val signingKeyPassphrase = System.getenv("SIGNING_PASSWORD") | ||
if (!signingKey.isNullOrBlank()) { | ||
project.extensions.configure<SigningExtension>("signing") { | ||
useInMemoryPgpKeys(signingKey.replace(" ", "\r\n"), signingKeyPassphrase) | ||
sign(this@signPublicationIfKeyPresent) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package pl.touk.krush.gradle | ||
|
||
object Versions { | ||
const val kotlin = "1.7.10" | ||
const val exposed = "0.38.2" | ||
const val kotlinpoet = "1.12.0" | ||
const val postgresDriver = "42.4.0" | ||
const val junit = "5.8.2" | ||
const val assertj = "3.23.1" | ||
const val logback = "1.2.11" | ||
const val testContainers = "1.17.2" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pl.touk.krush.gradle.Versions | ||
|
||
plugins { | ||
id("kotlin") | ||
id("kotlin-kapt") | ||
id("kotlinx-serialization") | ||
} | ||
|
||
dependencies { | ||
api("org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2") | ||
|
||
api(project(":runtime")) | ||
api(project(":runtime-postgresql")) | ||
api(project(":annotation-processor")) | ||
kapt(project(":annotation-processor")) | ||
|
||
implementation("com.h2database:h2:2.1.210") | ||
implementation("org.postgresql:postgresql:${Versions.postgresDriver}") | ||
implementation("org.flywaydb:flyway-core:8.5.13") | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0-RC") | ||
|
||
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.junit}") | ||
testImplementation("org.testcontainers:testcontainers:${Versions.testContainers}") | ||
testImplementation("org.testcontainers:junit-jupiter:${Versions.testContainers}") | ||
testImplementation("org.testcontainers:postgresql:${Versions.testContainers}") | ||
testImplementation("org.assertj:assertj-core:${Versions.assertj}") | ||
testRuntimeOnly("ch.qos.logback:logback-classic:${Versions.logback}") | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
kapt.verbose=true | ||
kotlin.incremental=true | ||
kapt.incremental.apt=true | ||
|
||
kotlin_version=1.7.0 | ||
exposed_version=0.38.2 | ||
kotlinpoet_version=1.12.0 |
Binary file not shown.
Oops, something went wrong.