Skip to content

Commit

Permalink
Setup publishing for the ReactAndroid/hermes-engine to the top leve…
Browse files Browse the repository at this point in the history
…l `/android` folder.

Summary:
This sets up the publishing of the `hermes-engine` to end up in the Maven Local repository
we have set up inside the ./android folder of the NPM package of `react-native`.
Artifacts from there will be picked up similarly to what it's happening for React Android

Changelog:
[Internal] [Changed] - Setup publishing for the `ReactAndroid/hermes-engine` to the top level `/android` folder.

Reviewed By: hramos

Differential Revision: D34213638

fbshipit-source-id: adbc0d1559ee815f9d7a711c9c77489ec92b76ff
  • Loading branch information
cortinico authored and facebook-github-bot committed Mar 4, 2022
1 parent a211089 commit 350f8c5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
43 changes: 37 additions & 6 deletions ReactAndroid/hermes-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id("de.undercouch.download")
id("com.android.library")
id("maven-publish")
}

def customDownloadDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
Expand All @@ -25,6 +26,10 @@ def ndkBuildJobs = Runtime.runtime.availableProcessors().toString()
// We inject the JSI directory used inside the Hermes build with the -DJSI_DIR config.
def jsiDir = rootProject.file("ReactCommon/jsi")

// The .aar is placed inside the ./android folder at the top level.
// There it will be placed alongside the React Android .aar
def AAR_OUTPUT_URL = "file://${rootDir}/android"

task downloadHermes(type: Download) {
src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
onlyIfNewer(true)
Expand Down Expand Up @@ -168,11 +173,37 @@ android {
exclude "**/libfbjni.so"
}

afterEvaluate {
preBuild.dependsOn(buildNinjaForHermes)
// Needed as some of the native sources needs to be downloaded
// before configureCMakeRelease/configureCMakeMinSizeRel could be executed.
configureCMakeRelease.dependsOn(preBuild)
configureCMakeMinSizeRel.dependsOn(preBuild)
publishing {
multipleVariants {
withSourcesJar()
withJavadocJar()
allVariants()
}
}
}

afterEvaluate {
preBuild.dependsOn(buildNinjaForHermes)
// Needed as some of the native sources needs to be downloaded
// before configureCMakeRelease/configureCMakeMinSizeRel could be executed.
configureCMakeRelease.dependsOn(preBuild)
configureCMakeMinSizeRel.dependsOn(preBuild)

publishing {
publications {
release(MavenPublication) {
from components.default
artifactId = "hermes-engine"
}
}
repositories {
maven {
name = "npm"
url = AAR_OUTPUT_URL
}
}
}
}

group = "com.facebook.react"
version = VERSION_NAME
2 changes: 2 additions & 0 deletions ReactAndroid/hermes-engine/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VERSION_NAME=1000.0.0-main
android.disableAutomaticComponentCreation=true

0 comments on commit 350f8c5

Please sign in to comment.