Skip to content

Commit

Permalink
Prototype - Storing the Hermes iOS tarballs on Maven.
Browse files Browse the repository at this point in the history
Summary:
I'm not going to merge this as it is, this is mostly for discussions with the community for the sake of
RFC facebook#508 react-native-community/discussions-and-proposals#508

Here I'm setting up a :ReactAndroid:external-artifacts Gradle module which is responsible of
uploading arbitrary artifacts to Maven (Central or any other repo).

In this specific example I'm uploading the Hermes iOS tarball which is 500+ Mb.
In this module I've configured the auth with Sonatype for publishing and the GPG signing of the artifacts.

Changelog:
[Internal] [Changed] - Store the iOS Hermes tarball on Maven

Differential Revision: D39886167

fbshipit-source-id: 66edae7f83df35525dc8cccd68bb5bb3a5e02a12
  • Loading branch information
cortinico authored and facebook-github-bot committed Sep 28, 2022
1 parent 7f061f8 commit 64e9b24
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ project.xcworkspace
/ReactAndroid/gradle/
/ReactAndroid/gradlew
/ReactAndroid/gradlew.bat
/ReactAndroid/external-artifacts/build/
/ReactAndroid/external-artifacts/artifacts/
/ReactAndroid/hermes-engine/build/
/ReactAndroid/hermes-engine/.cxx/
/template/android/app/build/
Expand Down
90 changes: 90 additions & 0 deletions ReactAndroid/external-artifacts/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* 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")
}

//version = parent.publishing_version
version = "0.0.1" // To avoid to accidentally publish a 1000.0.0-main

def REPO_URL = "file://${projectDir}/../../android"
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'
}

publishing {
publications {
artifacts(MavenPublication) {
artifactId = "react-native-artifacts"
groupId = GROUP
artifact hermesiOSArtifact

pom {
name = POM_NAME
description = "Supporting artifacts to for the React Native framework"
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:[email protected]:facebook/react-native.git"
}
}
}
}

repositories {
maven {
name = "npm"
url = REPO_URL
}
if (project.hasProperty("SONATYPE_USERNAME") && project.hasProperty("SONATYPE_PASSWORD")) {
maven {
name = "mavenCentral"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = SONATYPE_USERNAME
password = SONATYPE_PASSWORD
}
}
}
}

if (!project.hasProperty("SIGNING_KEY")) {
logger.info("Signing Disable as the PGP key was not found")
} else {
logger.info("PGP Key found - Signing enabled")
signing {
useInMemoryPgpKeys(SIGNING_KEY, SIGNING_PWD)
sign(publishing.publications.artifacts)
}
}
}

6 changes: 5 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ pluginManagement {
}
}

include(":ReactAndroid", ":ReactAndroid:hermes-engine", ":packages:rn-tester:android:app")
include(
":ReactAndroid",
":ReactAndroid:hermes-engine",
":ReactAndroid:external-artifacts",
":packages:rn-tester:android:app")

// Include this to enable codegen Gradle plugin.
includeBuild("packages/react-native-gradle-plugin/")
Expand Down

0 comments on commit 64e9b24

Please sign in to comment.