forked from facebook/yoga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup publishing of snapshots using `io.github.gradle-nexus.publish-p…
…lugin` Summary: This sets up publishing of -SNAPSHOT verison of Yoga using the Gradle plugin `io.github.gradle-nexus.publish-plugin` This plugin will take care of setting up the credentials for Sonatype and hitting the Maven repository. I've cleaned up the setup and centralized it inside a script plugin in the `build-logic` folder so we can easily add more module and just use `id("publish")` to publish them as well. Reviewed By: mdvacca Differential Revision: D46330013 fbshipit-source-id: 7221b296b9955a257fc290a2d1ac1d9fedfb787d
- Loading branch information
1 parent
186f4d3
commit 9a0ba05
Showing
9 changed files
with
118 additions
and
41 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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
plugins { | ||
id("com.android.library") | ||
id("publish") | ||
} | ||
|
||
android { | ||
|
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,13 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
plugins { `kotlin-dsl` } | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} |
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,75 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
plugins { | ||
id("maven-publish") | ||
id("signing") | ||
} | ||
|
||
group = "com.facebook.yoga" | ||
|
||
if ("USE_SNAPSHOT".byProperty.toBoolean()) { | ||
version = "${"VERSION_NAME".byProperty}-SNAPSHOT" | ||
} else { | ||
version = "VERSION_NAME".byProperty.toString() | ||
} | ||
|
||
publishing { | ||
publications { | ||
register<MavenPublication>("default") { | ||
groupId = project.group.toString() | ||
artifactId = project.name | ||
version = project.version.toString() | ||
afterEvaluate { from(components["default"]) } | ||
pom { | ||
description.set("A cross-platform layout engine which implements Flexbox.") | ||
name.set(project.name) | ||
url.set("https://github.com/facebook/yoga.git") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://github.com/facebook/yoga/blob/main/LICENSE") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("Meta Open Source") | ||
name.set("Meta Open Source") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { url.set("scm:git:[email protected]:facebook/yoga.git") } | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingKey = "SIGNING_KEY".byProperty | ||
val signingPwd = "SIGNING_PWD".byProperty | ||
|
||
if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) { | ||
logger.info("Signing disabled as the GPG key was not found") | ||
} else { | ||
logger.info("GPG Key found - Signing enabled") | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPwd) | ||
sign(publishing.publications) | ||
isRequired = !(signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) | ||
} | ||
|
||
// Fix for https://youtrack.jetbrains.com/issue/KT-46466/ | ||
// On Gradle 8+, the signing task is not correctly wired to the publishing tasks. | ||
// This requires a fix on KGP that is currently pending. | ||
val signingTasks = tasks.withType<Sign>() | ||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(signingTasks) } | ||
|
||
val String.byProperty: String? | ||
get() = providers.gradleProperty(this).orNull |
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 |
---|---|---|
|
@@ -11,16 +11,4 @@ android.useAndroidX=true | |
|
||
org.gradle.jvmargs=-Xmx1536M | ||
|
||
VERSION_NAME=1.19.0 | ||
POM_URL=https://github.com/facebook/yoga | ||
POM_SCM_URL=https://github.com/facebook/yoga.git | ||
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git | ||
POM_SCM_DEV_CONNECTION=scm:git:[email protected]:facebook/yoga.git | ||
POM_LICENSE_NAME=MIT License | ||
POM_LICENSE_URL=https://github.com/facebook/yoga/blob/main/LICENSE | ||
POM_LICENSE_DIST=repo | ||
POM_LICENCE_NAME=MIT License | ||
POM_LICENCE_URL=https://github.com/facebook/yoga/blob/main/LICENSE | ||
POM_LICENCE_DIST=repo | ||
POM_DEVELOPER_ID=facebook | ||
POM_DEVELOPER_NAME=facebook | ||
VERSION_NAME=1.19.0 |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
plugins { | ||
id("com.android.library") | ||
id("publish") | ||
} | ||
|
||
android { | ||
|
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