-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: drop Android.mk and support for old versions of React Nativ…
…e for new architecture As the new architecture is constantly a moving target, we only plan to keep support for latest version of React Native when using new architecture until its stable. So this change removes support for React Native 0.68 using Android.mk for the new architecture
- Loading branch information
Showing
10 changed files
with
1 addition
and
232 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
45 changes: 0 additions & 45 deletions
45
packages/create-react-native-library/templates/cpp-view-mixed/android/Android.mk
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
packages/create-react-native-library/templates/cpp-view-mixed/android/registration.cpp
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
packages/create-react-native-library/templates/cpp-view-new/android/Android.mk
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
packages/create-react-native-library/templates/cpp-view-new/android/registration.cpp
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
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
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 |
---|---|---|
|
@@ -27,33 +27,6 @@ apply plugin: "com.android.library" | |
apply plugin: "kotlin-android" | ||
<% } -%> | ||
|
||
<% if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%> | ||
import groovy.json.JsonSlurper | ||
|
||
// https://github.com/callstack/react-native-builder-bob/discussions/359 | ||
def registrationCompat = { | ||
// The new distribution model uses Maven Central https://reactnative.dev/blog/2023/01/12/version-071 | ||
def reactAndroidProject = rootProject.allprojects.find { it.name == 'ReactAndroid' } | ||
if (reactAndroidProject == null) return false | ||
|
||
def reactNativeManifest = file("${reactAndroidProject.projectDir}/../package.json") | ||
def reactNativeVersion = new JsonSlurper().parseText(reactNativeManifest.text).version as String | ||
// Fabric was introduced at [email protected], full CMake support were introduced at [email protected] | ||
// Use Android.mk for compatibility with [email protected]/0.69 | ||
reactNativeVersion.matches('(0.68.*|0.69.*)') | ||
}() | ||
|
||
def codegenViewLibraryName = "<%- project.name + 'View' -%>" | ||
def codegenViewModuleName = { | ||
// Autolink for Fabric uses codegenConfig.name in package.json since [email protected] | ||
// Use codegenViewLibraryName for compatibility with [email protected]/0.69 | ||
def libraryManifestJson = new JsonSlurper().parseText(file("$projectDir/../package.json").text) | ||
registrationCompat ? codegenViewLibraryName : libraryManifestJson.codegenConfig.name | ||
}() | ||
<% } -%> | ||
|
||
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } | ||
|
||
if (isNewArchitectureEnabled()) { | ||
apply plugin: "com.facebook.react" | ||
} | ||
|
@@ -86,7 +59,7 @@ android { | |
} | ||
} | ||
|
||
<% if (project.cpp || (project.view && (project.arch === "new" || project.arch === "mixed"))) { -%> | ||
<% if (project.cpp) { -%> | ||
ndkVersion getExtOrDefault("ndkVersion") | ||
<% } -%> | ||
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") | ||
|
@@ -96,9 +69,6 @@ android { | |
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") | ||
<% if (project.arch === "new" || project.arch === "mixed") { -%> | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
<% if (project.view) { -%> | ||
buildConfigField "String", "CODEGEN_MODULE_REGISTRATION", (isNewArchitectureEnabled() && registrationCompat ? "\"${codegenViewModuleName}_registration\"" : "null") | ||
<% } -%> | ||
<% } -%> | ||
|
||
<% if (project.cpp) { -%> | ||
|
@@ -108,25 +78,6 @@ android { | |
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a" | ||
} | ||
} | ||
<% } else if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%> | ||
if (isNewArchitectureEnabled() && registrationCompat) { | ||
def reactAndroidProject = project(':ReactAndroid') | ||
externalNativeBuild { | ||
ndkBuild { | ||
arguments "APP_PLATFORM=android-21", | ||
"APP_STL=c++_shared", | ||
"NDK_TOOLCHAIN_VERSION=clang", | ||
"GENERATED_SRC_DIR=$buildDir/generated/source", // for react_codegen_* in this library's codegen/jni | ||
"PROJECT_BUILD_DIR=${appProject.buildDir}", // for REACT_NDK_EXPORT_DIR in ReactAndroid's Android-prebuilt.mk | ||
"REACT_ANDROID_DIR=${reactAndroidProject.projectDir}", | ||
"REACT_ANDROID_BUILD_DIR=${reactAndroidProject.buildDir}", | ||
"CODEGEN_MODULE_NAME=$codegenViewModuleName" | ||
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" | ||
cppFlags "-std=c++17" | ||
targets "${codegenViewModuleName}_registration" | ||
} | ||
} | ||
} | ||
<% } -%> | ||
} | ||
<% if (project.cpp) { -%> | ||
|
@@ -136,16 +87,6 @@ android { | |
path "CMakeLists.txt" | ||
} | ||
} | ||
<% } else if (project.view && (project.arch === "new" || project.arch === "mixed")) { -%> | ||
|
||
if (isNewArchitectureEnabled() && registrationCompat) { | ||
// We configure the NDK build only if you decide to opt-in for the New Architecture. | ||
externalNativeBuild { | ||
ndkBuild { | ||
path "Android.mk" | ||
} | ||
} | ||
} | ||
<% } -%> | ||
<% if (project.arch === "new" || project.arch === "mixed") { -%> | ||
|
||
|
@@ -221,11 +162,7 @@ dependencies { | |
if (isNewArchitectureEnabled()) { | ||
react { | ||
jsRootDir = file("../src/") | ||
<% if (project.view) { -%> | ||
libraryName = codegenViewLibraryName | ||
<% } else { -%> | ||
libraryName = "<%- project.view ? project.name + 'View' : project.name -%>" | ||
<% } -%> | ||
codegenJavaPackageName = "com.<%- project.package -%>" | ||
} | ||
} | ||
|