yeet
This commit is contained in:
65
node_modules/expo-constants/scripts/get-app-config-android.gradle
generated
vendored
Normal file
65
node_modules/expo-constants/scripts/get-app-config-android.gradle
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
// Gradle script for generating serialized public app config (from app.config.js/ts or app.json) and bundling it into the APK
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.util.GradleVersion
|
||||
|
||||
void runBefore(String dependentTaskName, Task task) {
|
||||
Task dependentTask = tasks.findByPath(dependentTaskName);
|
||||
if (dependentTask != null) {
|
||||
dependentTask.dependsOn task
|
||||
}
|
||||
}
|
||||
|
||||
def expoConstantsDir = ["node", "-e", "console.log(require('path').dirname(require.resolve('expo-constants/package.json')));"].execute([], projectDir).text.trim()
|
||||
|
||||
def config = project.hasProperty("react") ? project.react : [];
|
||||
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"]
|
||||
|
||||
afterEvaluate {
|
||||
def projectRoot = file("../../")
|
||||
def inputExcludes = ["android/**", "ios/**"]
|
||||
|
||||
android.applicationVariants.each { variant ->
|
||||
def folderName = variant.name
|
||||
def targetName = folderName.capitalize()
|
||||
|
||||
def assetsDir = file("$buildDir/intermediates/merged_assets/${folderName}/out")
|
||||
|
||||
GradleVersion gradleVersion = GradleVersion.current()
|
||||
if (gradleVersion < GradleVersion.version('5.0')) {
|
||||
assetsDir = file("$buildDir/intermediates/merged_assets/${folderName}/merge${targetName}Assets/out")
|
||||
}
|
||||
|
||||
// Bundle task name for variant
|
||||
def bundleAppConfigTaskName = "bundle${targetName}ExpoConfig"
|
||||
|
||||
def currentBundleTask = tasks.create(
|
||||
name: bundleAppConfigTaskName,
|
||||
type: Exec) {
|
||||
description = "expo-constants: Bundle app config for ${targetName}."
|
||||
|
||||
// Create dirs if they are not there (e.g. the "clean" task just ran)
|
||||
doFirst {
|
||||
assetsDir.mkdirs()
|
||||
}
|
||||
|
||||
// Set up inputs and outputs so gradle can cache the result
|
||||
inputs.files fileTree(dir: projectRoot, excludes: inputExcludes)
|
||||
outputs.dir assetsDir
|
||||
|
||||
// Switch to project root and generate the app config
|
||||
workingDir projectRoot
|
||||
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
commandLine("cmd", "/c", *nodeExecutableAndArgs, "$expoConstantsDir/scripts/getAppConfig.js", projectRoot, assetsDir)
|
||||
} else {
|
||||
commandLine(*nodeExecutableAndArgs, "$expoConstantsDir/scripts/getAppConfig.js", projectRoot, assetsDir)
|
||||
}
|
||||
}
|
||||
|
||||
currentBundleTask.dependsOn("merge${targetName}Resources")
|
||||
currentBundleTask.dependsOn("merge${targetName}Assets")
|
||||
|
||||
runBefore("process${targetName}Resources", currentBundleTask)
|
||||
}
|
||||
}
|
19
node_modules/expo-constants/scripts/get-app-config-ios.sh
generated
vendored
Executable file
19
node_modules/expo-constants/scripts/get-app-config-ios.sh
generated
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
DEST="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
|
||||
NODE_BINARY=${NODE_BINARY:-node}
|
||||
|
||||
# Related to: https://github.com/facebook/react-native/blob/c9f869f9c7c8b035a669980382af4bbd4afecb89/scripts/react-native-xcode.sh#L59-L69
|
||||
PROJECT_ROOT=${PROJECT_ROOT:-$PWD}
|
||||
cd "$PROJECT_ROOT" || exit
|
||||
|
||||
if ! [ -x "$(command -v $NODE_BINARY)" ]; then
|
||||
echo 'Error: cannot find the node binary. Try setting the NODE_BINARY variable in the ' \
|
||||
'"Bundle React Native code and images" Build Phase to the absolute path to your node binary. ' \
|
||||
'You can find it by executing "which node" in a terminal window.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$NODE_BINARY" "$(dirname "${BASH_SOURCE[0]}")/getAppConfig.js" "$PROJECT_ROOT" "$DEST"
|
20
node_modules/expo-constants/scripts/getAppConfig.js
generated
vendored
Normal file
20
node_modules/expo-constants/scripts/getAppConfig.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
const { getConfig } = require('@expo/config');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const possibleProjectRoot = process.argv[2];
|
||||
const destinationDir = process.argv[3];
|
||||
|
||||
// Remove projectRoot validation when we no longer support React Native <= 62
|
||||
let projectRoot;
|
||||
if (fs.existsSync(path.join(possibleProjectRoot, 'package.json'))) {
|
||||
projectRoot = possibleProjectRoot;
|
||||
} else if (fs.existsSync(path.join(possibleProjectRoot, '..', 'package.json'))) {
|
||||
projectRoot = path.resolve(possibleProjectRoot, '..');
|
||||
}
|
||||
|
||||
const { exp } = getConfig(projectRoot, {
|
||||
isPublicConfig: true,
|
||||
skipSDKVersionRequirement: true,
|
||||
});
|
||||
fs.writeFileSync(path.join(destinationDir, 'app.config'), JSON.stringify(exp));
|
Reference in New Issue
Block a user