Skip to content

Commit

Permalink
fix(android): fix codegen not being applied correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Aug 17, 2022
1 parent de978fc commit b8d55fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {
// https://github.com/react-native-community/cli/blob/6cf12b00c02aca6d4bc843446394331d71a9749e/packages/platform-android/src/commands/runAndroid/index.ts#L180
buildDir = "${rootDir}/${name}/build"

def reactNativeDir = findNodeModulesPath("react-native", rootDir)
def reactNativeDir = file(findNodeModulesPath("react-native", rootDir))
def reactNativeVersion = getPackageVersionNumber("react-native", rootDir)

repositories {
Expand Down Expand Up @@ -256,8 +256,8 @@ dependencies {
// TODO: Remove this block when we drop support for 0.68.
if (reactNativeVersion < 6900) {
def hermesEngineDir =
findNodeModulesPath("hermes-engine", file(reactNativeDir))
?: findNodeModulesPath("hermesvm", file(reactNativeDir))
findNodeModulesPath("hermes-engine", reactNativeDir)
?: findNodeModulesPath("hermesvm", reactNativeDir)
if (hermesEngineDir == null) {
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
}
Expand All @@ -272,7 +272,7 @@ dependencies {
}
}

if (buildReactNativeFromSource(rootDir)) {
if (project.ext.react.enableNewArchitecture) {
implementation project(":ReactAndroid")
} else {
implementation "com.facebook.react:react-native:+"
Expand Down
5 changes: 0 additions & 5 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import java.security.MessageDigest

ext.manifest = null

ext.buildReactNativeFromSource = { baseDir ->
def reactNativePath = findNodeModulesPath("react-native", baseDir)
return !file("${reactNativePath}/android").exists()
}

ext.findFile = { fileName ->
def currentDirPath = rootDir == null ? null : rootDir.toString()

Expand Down
17 changes: 0 additions & 17 deletions test-app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@ def cliAndroidDir = findNodeModulesPath("@react-native-community/cli-platform-an
apply(from: "${cliAndroidDir}/native_modules.gradle")

ext.applyTestAppSettings = { DefaultSettings settings ->
if (settings.buildReactNativeFromSource(settings.rootDir)) {
def buildFile = Paths.get("${testAppDir}/android/react-native-build.gradle")
settings.rootProject.buildFileName = settings.rootDir.toPath().relativize(buildFile)

def reactNativeDir = findNodeModulesPath("react-native", settings.rootDir)
settings.include(":ReactAndroid")
settings.project(":ReactAndroid")
.projectDir = file("${reactNativeDir}/ReactAndroid")

settings.include(":packages:react-native-codegen:android")
settings.project(":packages:react-native-codegen:android")
.projectDir = file("${reactNativeDir}/packages/react-native-codegen/android")

settings.includeBuild("${reactNativeDir}/packages/react-native-codegen/android")
settings.includeBuild("${reactNativeDir}/packages/react-native-gradle-plugin")
}

settings.include(":app")
settings.include(":support")

Expand Down

0 comments on commit b8d55fb

Please sign in to comment.