@@ -42,6 +42,16 @@ def downloadsDir = customDownloadDir ? new File(customDownloadDir) : new File(re
42
42
def overrideHermesDir = System . getenv(" REACT_NATIVE_OVERRIDE_HERMES_DIR" ) != null
43
43
def hermesDir = System . getenv(" REACT_NATIVE_OVERRIDE_HERMES_DIR" ) ?: new File (reactNativeRootDir, " sdks/hermes" )
44
44
def hermesBuildDir = new File (" $buildDir /hermes" )
45
+ def hermesCOutputBinary = new File (" $buildDir /hermes/bin/hermesc" )
46
+ // This filetree represents the file of the Hermes build that we want as input/output
47
+ // of the buildHermesC task. Gradle will compute the hash of files in the file tree
48
+ // and won't rebuilt hermesc unless those files are changing.
49
+ def hermesBuildOutputFileTree = fileTree(hermesBuildDir. toString())
50
+ .exclude(' **/*.make' )
51
+ .exclude(' **/*.internal' )
52
+ .exclude(' **/external/**' )
53
+ .exclude(' **/hermes.framework/**' )
54
+ .exclude(' **/bin/hermesc' )
45
55
46
56
def hermesVersion = " main"
47
57
def hermesVersionFile = new File (reactNativeRootDir, " sdks/.hermesversion" )
@@ -86,12 +96,36 @@ task unzipHermes(dependsOn: downloadHermes, type: Copy) {
86
96
87
97
task configureBuildForHermes (type : Exec ) {
88
98
workingDir(hermesDir)
89
- commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), Os . isFamily(Os . FAMILY_WINDOWS ) ? " -GNMake Makefiles" : " " , " -S" , " ." , " -B" , hermesBuildDir. toString(), " -DJSI_DIR=" + jsiDir. absolutePath))
99
+ inputs. dir(hermesDir)
100
+ outputs. files(hermesBuildOutputFileTree)
101
+ commandLine(
102
+ windowsAwareCommandLine(
103
+ findCmakePath(cmakeVersion),
104
+ Os . isFamily(Os . FAMILY_WINDOWS ) ? " -GNMake Makefiles" : " " ,
105
+ " -S" ,
106
+ " ." ,
107
+ " -B" ,
108
+ hermesBuildDir. toString(),
109
+ " -DJSI_DIR=" + jsiDir. absolutePath
110
+ )
111
+ )
90
112
}
91
113
92
- task buildHermes (dependsOn : configureBuildForHermes, type : Exec ) {
114
+ task buildHermesC (dependsOn : configureBuildForHermes, type : Exec ) {
93
115
workingDir(hermesDir)
94
- commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), " --build" , hermesBuildDir. toString(), " --target" , " hermesc" , " -j" , ndkBuildJobs))
116
+ inputs. files(hermesBuildOutputFileTree)
117
+ outputs. file(hermesCOutputBinary)
118
+ commandLine(
119
+ windowsAwareCommandLine(
120
+ findCmakePath(cmakeVersion),
121
+ " --build" ,
122
+ hermesBuildDir. toString(),
123
+ " --target" ,
124
+ " hermesc" ,
125
+ " -j" ,
126
+ ndkBuildJobs,
127
+ )
128
+ )
95
129
}
96
130
97
131
task prepareHeadersForPrefab (type : Copy ) {
@@ -258,9 +292,9 @@ afterEvaluate {
258
292
configureBuildForHermes. dependsOn(unzipHermes)
259
293
prepareHeadersForPrefab. dependsOn(unzipHermes)
260
294
}
261
- preBuild. dependsOn(buildHermes )
295
+ preBuild. dependsOn(buildHermesC )
262
296
preBuild. dependsOn(prepareHeadersForPrefab)
263
- prepareHeadersForPrefab. dependsOn(buildHermes )
297
+ prepareHeadersForPrefab. dependsOn(buildHermesC )
264
298
}
265
299
266
300
/* Publishing Configuration */
0 commit comments