Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 0 additions & 231 deletions .github/workflows/publish-release.yml

This file was deleted.

119 changes: 100 additions & 19 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ import de.undercouch.gradle.tasks.download.Download
import java.nio.file.Paths
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

import org.gradle.api.tasks.bundling.Jar

plugins {
alias(libs.plugins.android.library)
id("maven-publish")
id("com.facebook.react")
alias(libs.plugins.android.library)
alias(libs.plugins.download)
alias(libs.plugins.kotlin.android)
}

version = project.findProperty("VERSION_NAME")?.toString()!!

group = "com.facebook.react"

// We download various C++ open-source dependencies into downloads.
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
Expand All @@ -40,7 +38,8 @@ val reactNativeRootDir = projectDir.parent

// We put the publishing version from gradle.properties inside ext. so other
// subprojects can access it as well.
extra["publishing_version"] = project.findProperty("VERSION_NAME")?.toString()!!
// Use the determined project version
extra["publishing_version"] = project.version

// This is the version of CMake we're requesting to the Android SDK to use.
// If missing it will be downloaded automatically. Only CMake versions shipped with the
Expand Down Expand Up @@ -489,15 +488,29 @@ android {
// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for Apple Silicon
// support)
if (rootProject.hasProperty("ndkPath") && rootProject.properties["ndkPath"] != null) {
ndkPath = rootProject.properties["ndkPath"].toString()
val rootProjectNdkPath = rootProject.findProperty("ndkPath")?.toString()
val rootProjectNdkVersion = rootProject.findProperty("ndkVersion")?.toString()

project.logger.lifecycle("[ReactAndroid] NDK Config: rootProjectNdkPath = '$rootProjectNdkPath'")
project.logger.lifecycle("[ReactAndroid] NDK Config: rootProjectNdkVersion = '$rootProjectNdkVersion'")
project.logger.lifecycle("[ReactAndroid] NDK Config: libs.versions.ndkVersion.get() = '${libs.versions.ndkVersion.get()}'")

// Rely on root project properties (influenced by ANDROID_NDK and libs.versions.toml via root build.gradle)
// Ensure your ANDROID_NDK env var points to NDK 27.0.12077973
// Ensure libs.versions.toml has ndkVersion = "27.0.12077973"
if (!rootProjectNdkPath.isNullOrBlank()) {
project.logger.lifecycle("[ReactAndroid] NDK Config: Setting ndkPath from rootProject: '$rootProjectNdkPath'")
ndkPath = rootProjectNdkPath
}
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
ndkVersion = rootProject.properties["ndkVersion"].toString()

if (!rootProjectNdkVersion.isNullOrBlank()) {
project.logger.lifecycle("[ReactAndroid] NDK Config: Setting ndkVersion from rootProject: '$rootProjectNdkVersion'")
ndkVersion = libs.versions.ndkVersion.get()
} else {
project.logger.lifecycle("[ReactAndroid] NDK Config: Fallback: Setting ndkVersion from libs.versions.toml: '${libs.versions.ndkVersion.get()}'")
ndkVersion = libs.versions.ndkVersion.get()
}

project.logger.lifecycle("[ReactAndroid] NDK Config: Final applied android.ndkPath='${ndkPath}', android.ndkVersion='${ndkVersion}'")
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down Expand Up @@ -712,13 +725,81 @@ kotlin {

tasks.withType<Test> { jvmArgs = listOf("-Xshare:off") }

/* Publishing Configuration */
apply(from = "./publish.gradle")
// -----------------------------
// Publishing Configuration
// -----------------------------
// Upstream ReactNative ships both release & debug AARs to Maven Central via a top‑level publish.gradle.
// Here, we adapt that flow to push our patched artifacts into our GitHub Packages fork.

// We need to override the artifact ID as this project is called `ReactAndroid` but
// the maven coordinates are on `react-android`.
// Please note that the original coordinates, `react-native`, have been voided
// as they caused https://github.com/facebook/react-native/issues/35210
publishing {
publications { getByName("release", MavenPublication::class) { artifactId = "react-android" } }
// We removed the generic publish.gradle include, opting for an in‑place Kotlin DSL block
// that binds our build artifacts to GitHub Packages.

afterEvaluate {
// make sure both sources-jar tasks wait for codegen
listOf("releaseSourcesJar", "debugSourcesJar").forEach { name ->
tasks.named(name) {
dependsOn("generateCodegenArtifactsFromSchema")
}
}

group = "com.facebook.react"
version = "0.79.2"
publishing {
publications {
// 2) Mirror upstream: publish both release and debug components
create<MavenPublication>("release") {
from(components["release"])
groupId = "com.facebook.react"
artifactId = "react-android"
version = "0.79.2"
pom {
name.set("Aura Patched ReactAndroid")
description.set("Release build of ReactAndroid AAR for the Aura project.")
url.set("https://github.com/isubscribed/react-native")
}
}
create<MavenPublication>("debug") {
from(components["debug"])
groupId = "com.facebook.react"
artifactId = "react-android-debug"
version = "0.79.2"
pom {
name.set("Aura Patched ReactAndroid (Debug)")
description.set("Debug build of ReactAndroid AAR for the Aura project.")
url.set("https://github.com/isubscribed/react-native")
}
}
}
repositories {
maven {
// Push to your fork's GitHub Packages registry
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/isubscribed/react-native")
credentials {
// try a project property first (so you can set -Pgpr.user=foo locally),
// then fall back to the GitHub Actions env
username = (project.findProperty("gpr.user") as String?)
?: System.getenv("GITHUB_ACTOR")
password = (project.findProperty("gpr.key") as String?)
?: System.getenv("GITHUB_TOKEN")
}
}
}
}
}

/**********************
* Some utility tasks
**********************/

tasks.register("printComponents") {
doLast {
components.names.forEach { println(it) }
}
}

tasks.register("printPublications") {
doLast {
println(">>> publications: " + publishing.publications.names)
}
}
2 changes: 1 addition & 1 deletion packages/react-native/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ minSdk = "24"
targetSdk = "35"
compileSdk = "35"
buildTools = "35.0.0"
ndkVersion = "27.1.12297006"
ndkVersion = "27.0.12077973"
# Dependencies versions
agp = "8.8.2"
androidx-annotation = "1.6.0"
Expand Down
Loading