-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes a bunch of other updates, and buildSrc was replaced with convention-plugins in hope for quicker Gradle sync and configuration time.
- Loading branch information
Showing
55 changed files
with
452 additions
and
410 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,5 +1,5 @@ | ||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
plugins { | ||
// Defined in convention-plugins (includedBuild). | ||
// Added here to see updates in versions.properties. | ||
id("com.gradle.plugin-publish") apply false | ||
} |
This file was deleted.
Oops, something went wrong.
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
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,9 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
fun plugin(id: String, version: String) = "$id:$id.gradle.plugin:$version" | ||
|
||
dependencies { | ||
implementation(plugin(id = "com.gradle.plugin-publish", version = "_")) | ||
} |
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,15 @@ | ||
plugins { | ||
id("de.fayard.refreshVersions") version "0.60.3" | ||
} | ||
|
||
dependencyResolutionManagement { | ||
@Suppress("UnstableApiUsage") | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
refreshVersions { | ||
versionsPropertiesFile = rootDir.parentFile.resolve("versions.properties") | ||
} |
4 changes: 2 additions & 2 deletions
4
...buildSrc/src/main/kotlin/PropertyOrEnv.kt → ...-plugins/src/main/kotlin/PropertyOrEnv.kt
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,11 +1,11 @@ | ||
import org.gradle.api.Project | ||
|
||
fun Project.propertyOrEnv(key: String): String { | ||
internal fun Project.propertyOrEnv(key: String): String { | ||
return findProperty(key) as String? | ||
?: System.getenv(key) | ||
?: error("Didn't find any value for the key \"$key\" in Project properties or environment variables.") | ||
} | ||
|
||
fun Project.propertyOrEnvOrNull(key: String): String? { | ||
internal fun Project.propertyOrEnvOrNull(key: String): String? { | ||
return findProperty(key) as String? ?: System.getenv(key) | ||
} |
22 changes: 22 additions & 0 deletions
22
plugins/convention-plugins/src/main/kotlin/gradle-plugin.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,22 @@ | ||
plugins { | ||
id("com.gradle.plugin-publish") | ||
signing | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
propertyOrEnvOrNull("GPG_key_id"), | ||
propertyOrEnvOrNull("GPG_private_key") ?: return@signing, | ||
propertyOrEnv("GPG_private_password") | ||
) | ||
sign(publishing.publications) | ||
} | ||
|
||
gradlePlugin { | ||
website = Publishing.siteUrl | ||
vcsUrl = Publishing.repoUrl | ||
} | ||
|
||
publishing { | ||
setupAllPublications(project) | ||
} |
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,28 +1,20 @@ | ||
@file:Suppress("PackageDirectoryMismatch") | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.UnknownTaskException | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.api.tasks.TaskContainer | ||
import org.gradle.api.tasks.TaskProvider | ||
import org.gradle.jvm.tasks.Jar | ||
import org.gradle.kotlin.dsl.named | ||
import org.gradle.kotlin.dsl.register | ||
import org.gradle.kotlin.dsl.assign | ||
import org.gradle.kotlin.dsl.withType | ||
|
||
object Publishing { | ||
internal object Publishing { | ||
const val gitUrl = "https://github.com/Splitties/refreshVersions.git" | ||
const val siteUrl = "https://github.com/Splitties/refreshVersions" | ||
const val siteUrl = "https://splitties.github.io/refreshVersions/" | ||
const val repoUrl = "https://github.com/Splitties/refreshVersions" | ||
const val libraryDesc = "Life is too short to Google for dependencies and versions." | ||
} | ||
|
||
fun PublishingExtension.setupAllPublications(project: Project) { | ||
val mavenPublications = publications.withType<MavenPublication>() | ||
mavenPublications.configureEach { | ||
artifact(project.tasks.emptyJavadocJar()) | ||
setupPom() | ||
} | ||
internal fun PublishingExtension.setupAllPublications(project: Project) { | ||
publications.withType<MavenPublication>().configureEach { setupPom() } | ||
if (project.isSnapshot) { | ||
sonatypeSnapshotsPublishing(project = project) | ||
} | ||
|
@@ -39,16 +31,6 @@ fun PublishingExtension.setupAllPublications(project: Project) { | |
} | ||
} | ||
|
||
fun TaskContainer.emptyJavadocJar(): TaskProvider<Jar> { | ||
val taskName = "javadocJar" | ||
return try { | ||
named(name = taskName) | ||
} catch (e: UnknownTaskException) { | ||
register(name = taskName) { archiveClassifier by "javadoc" } | ||
} | ||
} | ||
|
||
|
||
private fun Project.registerPublishingTask() { | ||
require(project != rootProject) | ||
|
||
|
@@ -71,32 +53,31 @@ private fun Project.registerPublishingTask() { | |
private val Project.isDevVersion get() = version.let { it is String && it.contains("-dev-") } | ||
private val Project.isSnapshot get() = version.let { it is String && it.endsWith("-SNAPSHOT") } | ||
|
||
@Suppress("UnstableApiUsage") | ||
private fun MavenPublication.setupPom() = pom { | ||
name.set("refreshVersions") | ||
description.set(Publishing.libraryDesc) | ||
url.set(Publishing.siteUrl) | ||
name = "refreshVersions" | ||
description = Publishing.libraryDesc | ||
url = Publishing.siteUrl | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://opensource.org/licenses/MIT") | ||
name = "MIT License" | ||
url = "https://opensource.org/licenses/MIT" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("jmfayard") | ||
name.set("Jean-Michel Fayard") | ||
email.set("[email protected]") | ||
id = "jmfayard" | ||
name = "Jean-Michel Fayard" | ||
email = "[email protected]" | ||
} | ||
developer { | ||
id.set("louiscad") | ||
name.set("Louis CAD") | ||
email.set("[email protected]") | ||
id = "louiscad" | ||
name = "Louis CAD" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
connection.set(Publishing.gitUrl) | ||
developerConnection.set(Publishing.gitUrl) | ||
url.set(Publishing.siteUrl) | ||
connection = Publishing.gitUrl | ||
developerConnection = Publishing.gitUrl | ||
url = Publishing.repoUrl | ||
} | ||
} |
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
Oops, something went wrong.