同步应用代码并排除 SDK 交付目录
This commit is contained in:
1 parent
145ec23526
commit
20c0fcf1f4
6 files changed
+63
-5
No files matched your search
@@ -77,3 +77,4 @@ yarn-error.log
|
|||||||
|
|
||||||
# Local SDK workspace
|
# Local SDK workspace
|
||||||
sdk/
|
sdk/
|
||||||
|
sdk-repair/
|
||||||
@@ -2,6 +2,8 @@ apply plugin: "com.android.application"
|
|||||||
apply plugin: "org.jetbrains.kotlin.android"
|
apply plugin: "org.jetbrains.kotlin.android"
|
||||||
apply plugin: "com.facebook.react"
|
apply plugin: "com.facebook.react"
|
||||||
|
|
||||||
|
apply from: rootProject.file("node.gradle")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the configuration block to customize your React Native Android app.
|
* This is the configuration block to customize your React Native Android app.
|
||||||
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
||||||
@@ -26,6 +28,7 @@ react {
|
|||||||
/* Bundling */
|
/* Bundling */
|
||||||
// A list containing the node command and its flags. Default is just 'node'.
|
// A list containing the node command and its flags. Default is just 'node'.
|
||||||
// nodeExecutableAndArgs = ["node"]
|
// nodeExecutableAndArgs = ["node"]
|
||||||
|
nodeExecutableAndArgs = [resolveNodeExecutable()]
|
||||||
//
|
//
|
||||||
// The command to run when bundling. By default is 'bundle'
|
// The command to run when bundling. By default is 'bundle'
|
||||||
// bundleCommand = "ram-bundle"
|
// bundleCommand = "ram-bundle"
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
def parseNodeVersion = { String value ->
|
||||||
|
value.replaceFirst("^v", "")
|
||||||
|
.tokenize(".")
|
||||||
|
.collect { part ->
|
||||||
|
def matcher = part =~ /\d+/
|
||||||
|
matcher.find() ? matcher.group().toInteger() : 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ext.resolveNodeExecutable = {
|
||||||
|
def fromEnv = System.getenv("NODE_BINARY")
|
||||||
|
if (fromEnv != null && !fromEnv.trim().isEmpty()) {
|
||||||
|
return fromEnv.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
def home = System.getProperty("user.home")
|
||||||
|
def candidates = []
|
||||||
|
def nvmVersionsDir = new File(home, ".nvm/versions/node")
|
||||||
|
|
||||||
|
if (nvmVersionsDir.isDirectory()) {
|
||||||
|
def versionDirs = nvmVersionsDir.listFiles()?.findAll {
|
||||||
|
new File(it, "bin/node").canExecute()
|
||||||
|
} ?: []
|
||||||
|
|
||||||
|
versionDirs.sort { a, b ->
|
||||||
|
def aVersion = parseNodeVersion(a.name)
|
||||||
|
def bVersion = parseNodeVersion(b.name)
|
||||||
|
for (int i = 0; i < Math.max(aVersion.size(), bVersion.size()); i++) {
|
||||||
|
def aPart = i < aVersion.size() ? aVersion[i] : 0
|
||||||
|
def bPart = i < bVersion.size() ? bVersion[i] : 0
|
||||||
|
if (aPart != bPart) {
|
||||||
|
return bPart <=> aPart
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.name <=> a.name
|
||||||
|
}.each {
|
||||||
|
candidates.add(new File(it, "bin/node").absolutePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
candidates.addAll([
|
||||||
|
"${home}/.nvm/current/bin/node",
|
||||||
|
"/opt/homebrew/bin/node",
|
||||||
|
"/usr/local/bin/node"
|
||||||
|
])
|
||||||
|
|
||||||
|
return candidates.find { new File(it).canExecute() } ?: "node"
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
|
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
|
||||||
plugins { id("com.facebook.react.settings") }
|
plugins { id("com.facebook.react.settings") }
|
||||||
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
|
apply from: new File(settingsDir, "node.gradle")
|
||||||
|
|
||||||
|
def nodeExecutable = resolveNodeExecutable()
|
||||||
|
def reactNativeCli = new File(settingsDir, "../node_modules/@react-native-community/cli/build/bin.js")
|
||||||
|
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
|
||||||
|
ex.autolinkLibrariesFromCommand([nodeExecutable, reactNativeCli.absolutePath, "config"])
|
||||||
|
}
|
||||||
rootProject.name = 'dfuapp'
|
rootProject.name = 'dfuapp'
|
||||||
include ':app'
|
include ':app'
|
||||||
includeBuild('../node_modules/@react-native/gradle-plugin')
|
includeBuild('../node_modules/@react-native/gradle-plugin')
|
||||||
+2
-2
@@ -4,12 +4,12 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
"clean-a": "cd android && gradlew clean",
|
"clean-a": "cd android && ./gradlew clean",
|
||||||
"ios": "react-native run-ios",
|
"ios": "react-native run-ios",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"start": "react-native start",
|
"start": "react-native start",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build-a": "set NODE_OPTIONS=--openssl-legacy-provider && cd android&&gradlew assembleRelease"
|
"build-a": "cd android && ./gradlew assembleRelease"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native-async-storage/async-storage": "^2.2.0",
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
||||||
|
|||||||
+2
-2
@@ -95,9 +95,9 @@ export default function HomeScreen({ navigation }: Props) {
|
|||||||
<TouchableOpacity style={[styles.button, { marginTop: pxToDp(20) }]} onPress={() => navigation.navigate("ScanScreen2")}>
|
<TouchableOpacity style={[styles.button, { marginTop: pxToDp(20) }]} onPress={() => navigation.navigate("ScanScreen2")}>
|
||||||
<Text style={styles.buttonText}>{t("home.paddle")}</Text>
|
<Text style={styles.buttonText}>{t("home.paddle")}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{/* <TouchableOpacity style={[styles.button, { marginTop: pxToDp(20) }]} onPress={() => navigation.navigate("ScanScreen3")}>
|
<TouchableOpacity style={[styles.button, { marginTop: pxToDp(20) }]} onPress={() => navigation.navigate("ScanScreen3")}>
|
||||||
<Text style={styles.buttonText}>{t("home.T5trainer")}</Text>
|
<Text style={styles.buttonText}>{t("home.T5trainer")}</Text>
|
||||||
</TouchableOpacity> */}
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<UpdateModal
|
<UpdateModal
|
||||||
|
|||||||
Reference in new issue
Block a user