@ohos-ports/react-native-gradle-plugin 0.71.19-beta.0 → 0.71.19-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.gradle.kts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|
8
9
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
9
10
|
|
|
10
11
|
plugins {
|
|
11
|
-
kotlin("jvm") version "2.
|
|
12
|
+
kotlin("jvm") version "2.1.20"
|
|
12
13
|
id("java-gradle-plugin")
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -43,15 +44,13 @@ java {
|
|
|
43
44
|
targetCompatibility = JavaVersion.VERSION_11
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>
|
|
47
|
-
|
|
48
|
-
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
|
|
49
|
-
}
|
|
47
|
+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
48
|
+
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.majorVersion }
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
tasks.withType<Test>().configureEach {
|
|
53
52
|
testLogging {
|
|
54
|
-
exceptionFormat =
|
|
53
|
+
exceptionFormat = TestExceptionFormat.FULL
|
|
55
54
|
showExceptions = true
|
|
56
55
|
showCauses = true
|
|
57
56
|
showStackTraces = true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
package/gradlew
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
#
|
|
30
30
|
# ksh Gradle
|
|
31
31
|
#
|
|
32
|
-
#
|
|
32
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
33
33
|
# requires all of these POSIX shell features:
|
|
34
34
|
# * functions;
|
|
35
35
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
@@ -86,7 +86,19 @@ APP_NAME="Gradle"
|
|
|
86
86
|
APP_BASE_NAME=${0##*/}
|
|
87
87
|
|
|
88
88
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
89
|
-
DEFAULT_JVM_OPTS
|
|
89
|
+
# HarmonyOS toybox xargs does not strip quotes from DEFAULT_JVM_OPTS,
|
|
90
|
+
# so we use unquoted space-separated values instead.
|
|
91
|
+
# Also override os.name=Linux because Gradle/Kotlin plugin does not recognize HarmonyOS.
|
|
92
|
+
DEFAULT_JVM_OPTS='-Xmx64m -Xms64m -Dos.name=Linux -Dos.arch=aarch64'
|
|
93
|
+
|
|
94
|
+
# HarmonyOS compatibility: ensure the Gradle daemon also gets os.name=Linux
|
|
95
|
+
# because Gradle/Kotlin do not recognize HarmonyOS as an operating system.
|
|
96
|
+
# JAVA_TOOL_OPTIONS is used because it propagates to forked JVM processes
|
|
97
|
+
# (like the Gradle daemon), unlike -D options in DEFAULT_JVM_OPTS which only
|
|
98
|
+
# affect the wrapper process.
|
|
99
|
+
if [ "$(uname -s)" = "HarmonyOS" ]; then
|
|
100
|
+
export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS} -Dos.name=Linux -Dos.arch=aarch64"
|
|
101
|
+
fi
|
|
90
102
|
|
|
91
103
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
104
|
MAX_FD=maximum
|
|
@@ -186,8 +198,8 @@ if "$cygwin" || "$msys" ; then
|
|
|
186
198
|
# possibly modified.
|
|
187
199
|
#
|
|
188
200
|
# NB: a `for` loop captures its iteration list before it begins, so
|
|
189
|
-
# changing the positional parameters here affects neither the number
|
|
190
|
-
# iterations, nor the values presented in `arg`.
|
|
201
|
+
# changing the positional parameters here affects neither the number
|
|
202
|
+
# of iterations, nor the values presented in `arg`.
|
|
191
203
|
shift # remove old arg
|
|
192
204
|
set -- "$@" "$arg" # push replacement arg
|
|
193
205
|
done
|
|
@@ -205,30 +217,12 @@ set -- \
|
|
|
205
217
|
org.gradle.wrapper.GradleWrapperMain \
|
|
206
218
|
"$@"
|
|
207
219
|
|
|
208
|
-
#
|
|
209
|
-
#
|
|
210
|
-
#
|
|
211
|
-
#
|
|
212
|
-
#
|
|
213
|
-
#
|
|
214
|
-
|
|
215
|
-
# set -- "${ARGS[@]}" "$@"
|
|
216
|
-
#
|
|
217
|
-
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
218
|
-
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
219
|
-
# character that might be a shell metacharacter, then use eval to reverse
|
|
220
|
-
# that process (while maintaining the separation between arguments), and wrap
|
|
221
|
-
# the whole thing up as a single "set" statement.
|
|
222
|
-
#
|
|
223
|
-
# This will of course break if any of these variables contains a newline or
|
|
224
|
-
# an unmatched quote.
|
|
225
|
-
#
|
|
226
|
-
|
|
227
|
-
eval "set -- $(
|
|
228
|
-
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
229
|
-
xargs -n1 |
|
|
230
|
-
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
231
|
-
tr '\n' ' '
|
|
232
|
-
)" '"$@"'
|
|
220
|
+
# HarmonyOS fix: toybox xargs does not strip quotes from quoted arguments,
|
|
221
|
+
# causing JVM options like "-Xmx64m" to be passed as literal strings with
|
|
222
|
+
# quotes instead of being parsed as -Xmx64m. This results in:
|
|
223
|
+
# "Error: Could not find or load main class \"-Xmx64m\""
|
|
224
|
+
# Instead of using xargs-based parsing, we use simple word splitting which
|
|
225
|
+
# works correctly with unquoted DEFAULT_JVM_OPTS on all POSIX shells.
|
|
226
|
+
eval "set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\$@\""
|
|
233
227
|
|
|
234
228
|
exec "$JAVACMD" "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/react-native-gradle-plugin",
|
|
3
|
-
"version": "0.71.19-beta.
|
|
3
|
+
"version": "0.71.19-beta.1",
|
|
4
4
|
"description": "⚛️ Gradle Plugin for React Native",
|
|
5
5
|
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"clean": "./gradlew clean",
|
|
14
14
|
"test": "./gradlew check"
|
|
15
15
|
},
|
|
16
|
-
"main": "index.js",
|
|
17
16
|
"license": "MIT",
|
|
18
17
|
"files": [
|
|
19
18
|
"settings.gradle.kts",
|
|
@@ -22,9 +21,8 @@
|
|
|
22
21
|
"gradlew",
|
|
23
22
|
"gradlew.bat",
|
|
24
23
|
"src/main",
|
|
25
|
-
"README.md"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {},
|
|
27
|
+
"devDependencies": {}
|
|
30
28
|
}
|
|
@@ -13,6 +13,7 @@ import com.facebook.react.utils.moveTo
|
|
|
13
13
|
import com.facebook.react.utils.windowsAwareCommandLine
|
|
14
14
|
import java.io.File
|
|
15
15
|
import org.gradle.api.DefaultTask
|
|
16
|
+
import org.gradle.api.GradleException
|
|
16
17
|
import org.gradle.api.file.ConfigurableFileTree
|
|
17
18
|
import org.gradle.api.file.DirectoryProperty
|
|
18
19
|
import org.gradle.api.file.RegularFileProperty
|
|
@@ -127,13 +128,15 @@ abstract class BundleHermesCTask : DefaultTask() {
|
|
|
127
128
|
File(jsIntermediateSourceMapsDir.get().asFile, "$bundleAssetName.compiler.map")
|
|
128
129
|
|
|
129
130
|
private fun runCommand(command: List<Any>) {
|
|
130
|
-
val process =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
val process =
|
|
132
|
+
ProcessBuilder(command.map { it.toString() })
|
|
133
|
+
.directory(root.get().asFile)
|
|
134
|
+
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
|
135
|
+
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
|
136
|
+
.start()
|
|
134
137
|
val exitCode = process.waitFor()
|
|
135
138
|
if (exitCode != 0) {
|
|
136
|
-
|
|
139
|
+
throw GradleException("Process '$command' finished with exit value $exitCode")
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
|
|
Binary file
|
package/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-native-gradle-plugin Node.js entry point
|
|
3
|
-
*
|
|
4
|
-
* This package is a Gradle/Kotlin build plugin for React Native.
|
|
5
|
-
* It is compiled to a JAR file and loaded via the JVM/Gradle runtime.
|
|
6
|
-
* This JS entry point provides a bridge to invoke the Gradle plugin
|
|
7
|
-
* from Node.js using the available JVM and Gradle toolchain.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const { execSync } = require('child_process');
|
|
11
|
-
const path = require('path');
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
|
|
14
|
-
// Locate the compiled JAR
|
|
15
|
-
const jarPath = path.join(__dirname, 'build', 'libs', 'react-native-gradle-plugin.jar');
|
|
16
|
-
|
|
17
|
-
// Package metadata
|
|
18
|
-
const pkg = require('./package.json');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get the path to the compiled Gradle plugin JAR.
|
|
22
|
-
* @returns {string} Absolute path to the JAR file
|
|
23
|
-
*/
|
|
24
|
-
function getJarPath() {
|
|
25
|
-
return jarPath;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Check if the JAR has been compiled and is available.
|
|
30
|
-
* @returns {boolean} True if the JAR exists
|
|
31
|
-
*/
|
|
32
|
-
function isCompiled() {
|
|
33
|
-
return fs.existsSync(jarPath);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Run the Gradle plugin via the Gradle build tool.
|
|
38
|
-
* This invokes the Gradle build system with the React Native plugin applied.
|
|
39
|
-
*
|
|
40
|
-
* @param {Object} options - Options for the Gradle invocation
|
|
41
|
-
* @param {string} options.projectDir - Directory of the project to build
|
|
42
|
-
* @param {string[]} options.tasks - Gradle tasks to execute
|
|
43
|
-
* @param {Object} options.gradleProps - Additional Gradle properties
|
|
44
|
-
* @returns {string} Output of the Gradle command
|
|
45
|
-
*/
|
|
46
|
-
function runGradle(options = {}) {
|
|
47
|
-
const projectDir = options.projectDir || process.cwd();
|
|
48
|
-
const tasks = options.tasks || ['assembleRelease'];
|
|
49
|
-
const gradleCmd = process.env.GRADLE_CMD || 'gradle';
|
|
50
|
-
const args = [gradleCmd, ...tasks, '-p', projectDir];
|
|
51
|
-
|
|
52
|
-
if (options.gradleProps) {
|
|
53
|
-
for (const [key, value] of Object.entries(options.gradleProps)) {
|
|
54
|
-
args.push(`-P${key}=${value}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const cmd = args.join(' ');
|
|
59
|
-
return execSync(cmd, {
|
|
60
|
-
cwd: projectDir,
|
|
61
|
-
encoding: 'utf-8',
|
|
62
|
-
stdio: 'pipe',
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = {
|
|
67
|
-
name: pkg.name,
|
|
68
|
-
version: pkg.version,
|
|
69
|
-
description: pkg.description,
|
|
70
|
-
getJarPath,
|
|
71
|
-
isCompiled,
|
|
72
|
-
runGradle,
|
|
73
|
-
};
|