Skip to content

Commit a0cb9d8

Browse files
author
shivenmian
committed
fix: use relative paths for gradle exec invocations
1 parent 7adf6b1 commit a0cb9d8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ abstract class BundleHermesCTask : DefaultTask() {
8989
runCommand(bundleCommand)
9090

9191
if (hermesEnabled.get()) {
92-
val detectedHermesCommand = detectOSAwareHermesCommand(root.get().asFile, hermesCommand.get())
92+
val detectedHermesCommand = File(detectOSAwareHermesCommand(root.get().asFile, hermesCommand.get())).relativeTo(root.get().asFile).path
9393
val bytecodeFile = File("${bundleFile}.hbc")
9494
val outputSourceMap = resolveOutputSourceMap(bundleAssetFilename)
9595
val compilerSourceMap = resolveCompilerSourceMap(bundleAssetFilename)
@@ -136,24 +136,24 @@ abstract class BundleHermesCTask : DefaultTask() {
136136
windowsAwareCommandLine(
137137
buildList {
138138
addAll(nodeExecutableAndArgs.get())
139-
add(cliFile.get().asFile.absolutePath)
139+
add(cliFile.get().asFile.relativeTo(root.get().asFile).path)
140140
add(bundleCommand.get())
141141
add("--platform")
142142
add("android")
143143
add("--dev")
144144
add(devEnabled.get().toString())
145145
add("--reset-cache")
146146
add("--entry-file")
147-
add(entryFile.get().asFile.toString())
147+
add(entryFile.get().asFile.relativeTo(root.get().asFile).path)
148148
add("--bundle-output")
149-
add(bundleFile.toString())
149+
add(bundleFile.relativeTo(root.get().asFile).path)
150150
add("--assets-dest")
151-
add(resourcesDir.get().asFile.toString())
151+
add(resourcesDir.get().asFile.relativeTo(root.get().asFile).path)
152152
add("--sourcemap-output")
153-
add(sourceMapFile.toString())
153+
add(sourceMapFile.relativeTo(root.get().asFile).path)
154154
if (bundleConfig.isPresent) {
155155
add("--config")
156-
add(bundleConfig.get().asFile.absolutePath)
156+
add(bundleConfig.get().asFile.relativeTo(root.get().asFile).path)
157157
}
158158
add("--minify")
159159
add(minifyEnabled.get().toString())
@@ -170,8 +170,8 @@ abstract class BundleHermesCTask : DefaultTask() {
170170
hermesCommand,
171171
"-emit-binary",
172172
"-out",
173-
bytecodeFile.absolutePath,
174-
bundleFile.absolutePath,
173+
bytecodeFile.relativeTo(root.get().asFile).path,
174+
bundleFile.relativeTo(root.get().asFile).path,
175175
*hermesFlags.get().toTypedArray())
176176

177177
internal fun getComposeSourceMapsCommand(
@@ -182,9 +182,9 @@ abstract class BundleHermesCTask : DefaultTask() {
182182
): List<Any> =
183183
windowsAwareCommandLine(
184184
*nodeExecutableAndArgs.get().toTypedArray(),
185-
composeScript.absolutePath,
186-
packagerSourceMap.toString(),
187-
compilerSourceMap.toString(),
185+
composeScript.relativeTo(root.get().asFile).path,
186+
packagerSourceMap.relativeTo(root.get().asFile).path,
187+
compilerSourceMap.relativeTo(root.get().asFile).path,
188188
"-o",
189-
outputSourceMap.toString())
189+
outputSourceMap.relativeTo(root.get().asFile).path)
190190
}

0 commit comments

Comments
 (0)