-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add convention plugin for publishing (#20)
- Loading branch information
Showing
17 changed files
with
281 additions
and
218 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
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,12 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() // so that external plugins can be resolved in dependencies section | ||
} | ||
|
||
dependencies { | ||
// note: this `libs` is from build-logic/settings.gradle.kts, technically different from the 'main' project | ||
implementation(libs.gradle.plugin.publish) | ||
} |
110 changes: 110 additions & 0 deletions
110
build-logic/build-conventions/src/main/kotlin/com.figure.publishing.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,110 @@ | ||
import org.gradle.kotlin.dsl.`java-gradle-plugin` | ||
|
||
plugins { | ||
`maven-publish` | ||
`java-gradle-plugin` | ||
id("com.gradle.plugin-publish") | ||
} | ||
|
||
/* | ||
* Project information | ||
*/ | ||
group = "com.figure.gradle" | ||
description = "Gradle Plugin for Automated Semantic Versioning" | ||
|
||
inner class ProjectInfo { | ||
val longName = "Gradle Semver Plugin" | ||
val description = "Gradle Plugin for Automated Semantic Versioning" | ||
val pluginImplementationClass = "$group.semver.SemverPlugin" | ||
val tags = listOf("semver", "gradle", "gitflow", "gitubflow") | ||
val website = "https://github.com/FigureTechnologies/gradle-semver-plugin" | ||
val vcsURL = "https://github.com/FigureTechnologies/gradle-semver-plugin.git" | ||
} | ||
val info = ProjectInfo() | ||
|
||
/** | ||
* Eventually we will be able to merge the pluginBundle and gradlePlugin section. | ||
* Unfortunately, we can't do that gradle 7.6 is out, so we wait. | ||
* | ||
* Gradle 8+ will remove the pluginBundle | ||
* Link: https://plugins.gradle.org/docs/publish-plugin-new | ||
*/ | ||
|
||
// I think this is specifically for the gradle portal | ||
pluginBundle { | ||
website = info.website | ||
vcsUrl = info.vcsURL | ||
tags = info.tags | ||
|
||
// shared description | ||
// description = info.description | ||
} | ||
|
||
gradlePlugin { | ||
|
||
plugins { | ||
create(project.name) { | ||
id = "$group.${project.name}" | ||
displayName = info.longName | ||
description = info.description | ||
implementationClass = info.pluginImplementationClass | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
url = uri("https://nexus.figure.com/repository/figure") | ||
credentials { | ||
username = System.getenv("NEXUS_USER") | ||
password = System.getenv("NEXUS_PASS") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
pom { | ||
// This line is what includes the java{} block, aka javadocs and sources | ||
from(components["java"]) | ||
|
||
name.set(info.longName) | ||
description.set(info.description) | ||
url.set(info.website) | ||
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("ahatzz11") | ||
name.set("Alex Hatzenbuhler") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("happyphan") | ||
name.set("Emily Harris") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("luinstra") | ||
name.set("Jeremy Luinstra") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("jonasg13") | ||
name.set("Jonas Gorauskas") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/FigureTechnologies/gradle-semver-plugin.git") | ||
developerConnection.set("scm:git:ssh://github.com/FigureTechnologies/gradle-semver-plugin.git") | ||
url.set(info.website) | ||
} | ||
} | ||
} | ||
} | ||
} |
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,26 @@ | ||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") | ||
enableFeaturePreview("VERSION_CATALOGS") | ||
|
||
// This is for the kotlin-dsl | ||
dependencyResolutionManagement { | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
|
||
gradlePluginPortal() // so that external plugins can be resolved in dependencies section | ||
} | ||
|
||
// kinda hacky way to make a catalog from our own catalog, but it works! | ||
// Link: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
plugins { | ||
|
||
} | ||
|
||
include("build-conventions") |
Oops, something went wrong.