-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup publishing for Snapshot and Stable on Maven (#34967)
Summary: Pull Request resolved: #34967 This diff is a preparatory work for publishing artifacts on Maven Central. What it does is: 1. It sets up all the 3 modules (react-native, hermes-engine, external-artifacts) for publishg 2. Adds coordinates to publish on the Snapshot repository 3. Adds support for appendign -SNAPSHOT version if invoked with `-PisNightly=true` 4. Configures GPG signing of artifacts. I haven't touched the CircleCI and JS code yet. I'll do it in another diff. Changelog: [General] [Changed] - Setup publishing for Snapshot and Stable on Maven Reviewed By: mdvacca, cipolleschi Differential Revision: D40146212 fbshipit-source-id: 9321e16f6c18b35bc3ae785749d613085c56e7bc
- Loading branch information
1 parent
2934399
commit 0e2f090
Showing
8 changed files
with
198 additions
and
91 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,32 @@ | ||
/* | ||
* 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") | ||
} | ||
|
||
group = "com.facebook.react" | ||
version = parent.publishing_version | ||
configurations.maybeCreate("default") | ||
|
||
// The artifact should be placed inside the `artifacts/hermes-ios.tar.gz` location. | ||
def hermesiOSArtifactFile = layout.projectDirectory.file('artifacts/hermes-ios.tar.gz') | ||
def hermesiOSArtifact = artifacts.add('default', hermesiOSArtifactFile) { | ||
type 'tgz' | ||
extension 'tar.gz' | ||
classifier 'hermes-ios' | ||
} | ||
|
||
apply from: "../publish.gradle" | ||
|
||
publishing { | ||
publications { | ||
getByName("release") { | ||
artifact hermesiOSArtifact | ||
} | ||
} | ||
} |
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,102 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
def isNightly = findProperty("isNightly")?.toBoolean() | ||
def sonatypeUsername = findProperty("SONATYPE_USERNAME") | ||
def sonatypePassword = findProperty("SONATYPE_PASSWORD") | ||
def signingKey = findProperty("SIGNING_KEY") | ||
def signingPwd = findProperty("SIGNING_PWD") | ||
|
||
def reactAndroidProjectDir = project(':ReactAndroid').projectDir | ||
def androidOutputUrl = "file://${reactAndroidProjectDir}/../android" | ||
|
||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
afterEvaluate { | ||
// We do a multi variant release, so for Android libraries | ||
// we publish `components.release` | ||
if (plugins.hasPlugin("com.android.library")) { | ||
from components.default | ||
} | ||
} | ||
|
||
// We populate the publishing version using the project version, | ||
// appending -SNAPSHOT if on nightly. | ||
if (isNightly) { | ||
version = this.version + "-SNAPSHOT" | ||
} else { | ||
version = this.version | ||
} | ||
|
||
pom { | ||
name = "react-native" | ||
description = "A framework for building native apps with React" | ||
url = "https://github.com/facebook/react-native" | ||
|
||
developers { | ||
developer { | ||
id = "facebook" | ||
name = "Facebook" | ||
} | ||
} | ||
|
||
licenses { | ||
license { | ||
name = "MIT License" | ||
url = "https://github.com/facebook/react-native/blob/HEAD/LICENSE" | ||
distribution = "repo" | ||
} | ||
} | ||
|
||
scm { | ||
url = "https://github.com/facebook/react-native.git" | ||
connection = "scm:git:https://github.com/facebook/react-native.git" | ||
developerConnection = "scm:git:git@github.com:facebook/react-native.git" | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "npm" | ||
url = androidOutputUrl | ||
} | ||
if (sonatypeUsername && sonatypePassword) { | ||
maven { | ||
name = "mavenCentral" | ||
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
} | ||
} | ||
maven { | ||
name = "mavenSnapshots" | ||
url = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (signingKey && signingPwd) { | ||
logger.info("PGP Key found - Signing enabled") | ||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPwd) | ||
sign(publishing.publications.release) | ||
} | ||
} else { | ||
logger.info("Signing disabled as the PGP key was not found") | ||
} | ||
} |
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