-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate Gradle config to use to buildSrc convention plugins (#39)
* migrate Gradle config to use to buildSrc convention plugins * jdk11
- Loading branch information
Showing
13 changed files
with
191 additions
and
90 deletions.
There are no files selected for viewing
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,49 +1,6 @@ | ||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
group = "com.github.serras.kopykat" | ||
version = "0.1" | ||
plugins { | ||
buildsrc.conventions.`kopykat-base` | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "java-library") | ||
apply(plugin = "maven-publish") | ||
|
||
configure<PublishingExtension> { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = project.group as String | ||
artifactId = project.name | ||
version = project.version as String | ||
from(components["java"]) | ||
|
||
pom { | ||
description.set("Little utilities for more pleasant immutable data in Kotlin") | ||
url.set("https://github.com/serras/kopykat") | ||
licenses { | ||
|
||
} | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("kopykat-authors") | ||
name.set("The KopyKat authors") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/serras/kopykat.git") | ||
developerConnection.set("scm:git:ssh://[email protected]/serras/kopykat.git") | ||
url.set("https://github.com/serras/kopykat") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
group = "com.github.serras.kopykat" | ||
version = "0.1" |
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,41 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
kotlin("jvm") version embeddedKotlinVersion | ||
} | ||
|
||
val gradleJvmTarget = "11" | ||
val gradleKotlinTarget = "1.6" | ||
|
||
val kotlinVersion = "1.7.10" | ||
|
||
dependencies { | ||
implementation(platform(libs.kotlin.bom)) | ||
|
||
// Set the *Maven coordinates* of Gradle plugins here. | ||
// This should be the only place where Gradle plugins versions are defined. | ||
|
||
implementation(libs.gradlePlugin.kotlinJvm) | ||
} | ||
|
||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = gradleJvmTarget | ||
apiVersion = gradleKotlinTarget | ||
languageVersion = gradleKotlinTarget | ||
} | ||
} | ||
|
||
|
||
kotlin { | ||
jvmToolchain { | ||
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(gradleJvmTarget)) | ||
} | ||
} | ||
|
||
|
||
kotlinDslPluginOptions { | ||
jvmTarget.set(gradleJvmTarget) | ||
} |
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,24 @@ | ||
// shared repository definitions for both the main project and buildSrc | ||
|
||
@Suppress("UnstableApiUsage") // Central declaration of repositories is an incubating feature | ||
dependencyResolutionManagement { | ||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) | ||
|
||
repositories { | ||
mavenCentral() | ||
jitpack() | ||
gradlePluginPortal() | ||
} | ||
|
||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
jitpack() | ||
} | ||
} | ||
} | ||
|
||
fun RepositoryHandler.jitpack() { | ||
maven("https://jitpack.io") | ||
} |
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 @@ | ||
rootProject.name = "buildSrc" | ||
|
||
apply(from = "./repositories.settings.gradle.kts") | ||
|
||
@Suppress("UnstableApiUsage") // Central declaration of repositories is an incubating feature | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
buildSrc/src/main/kotlin/buildsrc/conventions/kopykat-base.gradle.kts
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 buildsrc.conventions | ||
|
||
plugins { | ||
base | ||
} | ||
|
||
description = "Common config that can be used in all projects" | ||
|
||
if (project != rootProject) { | ||
project.group = rootProject.group | ||
project.version = rootProject.version | ||
} |
28 changes: 28 additions & 0 deletions
28
buildSrc/src/main/kotlin/buildsrc/conventions/kotlin-jvm.gradle.kts
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 @@ | ||
package buildsrc.conventions | ||
|
||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("buildsrc.conventions.kopykat-base") | ||
kotlin("jvm") | ||
`java-library` | ||
} | ||
|
||
dependencies { | ||
implementation(platform(kotlin("bom"))) | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
jvmToolchain { | ||
languageVersion.set(JavaLanguageVersion.of("11")) | ||
} | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} |
43 changes: 43 additions & 0 deletions
43
buildSrc/src/main/kotlin/buildsrc/conventions/maven-publish.gradle.kts
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,43 @@ | ||
package buildsrc.conventions | ||
|
||
plugins { | ||
`maven-publish` | ||
} | ||
|
||
publishing { | ||
// configure all publications to have the same POM | ||
publications.withType<MavenPublication>().configureEach { | ||
pom { | ||
description.set("Little utilities for more pleasant immutable data in Kotlin") | ||
url.set("https://github.com/serras/kopykat") | ||
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("kopykat-authors") | ||
name.set("The KopyKat authors") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/serras/kopykat.git") | ||
developerConnection.set("scm:git:ssh://[email protected]/serras/kopykat.git") | ||
url.set("https://github.com/serras/kopykat") | ||
} | ||
} | ||
} | ||
} | ||
|
||
plugins.withType<JavaPlugin>().configureEach { | ||
// only create a 'java' publication when the JavaPlugin is present | ||
publishing { | ||
publications { | ||
register<MavenPublication>("maven") { | ||
from(components["java"]) | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# https://jitpack.io/docs/BUILDING/ | ||
|
||
# https://jitpack.io/docs/BUILDING/#java-version | ||
jdk: | ||
- openjdk11 |
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
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,20 +1,10 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
@Suppress("DSL_SCOPE_VIOLATION") | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
buildsrc.conventions.`kotlin-jvm` | ||
buildsrc.conventions.`maven-publish` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.ksp) | ||
api(libs.kotlinPoet) | ||
api(libs.kotlinPoet.ksp) | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} |