From 36c77c160e691f507d62895a83bfa648fc74c0c4 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 29 Mar 2023 09:05:37 -0700 Subject: [PATCH] Fix the setup to allow the build-from-source on host projects (#36702) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36702 With the monorepo changes we broke the build from source for users. This fixes it so that folks can just follow the guide: https://reactnative.dev/contributing/how-to-build-from-source Changelog: [Android] [Fixed] - Fix the setup to allow the build-from-source on host projects Reviewed By: cipolleschi Differential Revision: D44502428 fbshipit-source-id: 3ad8fb114f5e2f7ffdf6fffa617ceaa45334f5f3 --- packages/react-native/build.gradle.kts | 17 +++++++++++++ packages/react-native/gradle.properties | 1 + packages/react-native/settings.gradle.kts | 30 +++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/packages/react-native/build.gradle.kts b/packages/react-native/build.gradle.kts index 8b137891791fe9..217bf9379b9543 100644 --- a/packages/react-native/build.gradle.kts +++ b/packages/react-native/build.gradle.kts @@ -1 +1,18 @@ +/* + * 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. + */ +// This is the top level build.gradle.kts file used when the users +// is doing a build from source. It's triggered as the user +// will add an `includeBuild(../node_modules/react-native)` in +// their settings.gradle.kts file. +// More on this here: https://reactnative.dev/contributing/how-to-build-from-source +plugins { + id("com.android.library") version "7.4.2" apply false + id("com.android.application") version "7.4.2" apply false + id("de.undercouch.download") version "5.0.1" apply false + kotlin("android") version "1.7.22" apply false +} diff --git a/packages/react-native/gradle.properties b/packages/react-native/gradle.properties index e69de29bb2d1d6..2d8d1e4dd150cb 100644 --- a/packages/react-native/gradle.properties +++ b/packages/react-native/gradle.properties @@ -0,0 +1 @@ +android.useAndroidX=true \ No newline at end of file diff --git a/packages/react-native/settings.gradle.kts b/packages/react-native/settings.gradle.kts index 8b137891791fe9..df9e6e8d2942b3 100644 --- a/packages/react-native/settings.gradle.kts +++ b/packages/react-native/settings.gradle.kts @@ -1 +1,31 @@ +/* + * 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. + */ +// This is the settings.gradle.kts file used when the users +// is doing a build from source. It's triggered as the user +// will add an `includeBuild(../node_modules/react-native)` in +// their settings.gradle.kts file. +// More on this here: https://reactnative.dev/contributing/how-to-build-from-source + +pluginManagement { + repositories { + mavenCentral() + google() + gradlePluginPortal() + } +} + +rootProject.name = "react-native-github" + +include(":packages:react-native:ReactAndroid") + +project(":packages:react-native:ReactAndroid").projectDir = file("ReactAndroid/") + +include(":packages:react-native:ReactAndroid:hermes-engine") + +project(":packages:react-native:ReactAndroid:hermes-engine").projectDir = + file("ReactAndroid/hermes-engine/")