@@ -22,7 +22,7 @@ allprojects {
2222def ndkDebuggable = false ;
2323def optimized = project. hasProperty(" optimized" )
2424
25- if (optimized) {
25+ if (optimized) {
2626 println " Optimized build triggered."
2727}
2828
@@ -34,7 +34,6 @@ for (String runTask : runTasks) {
3434 }
3535}
3636
37-
3837project. ext. sdkDir = System . getenv(" ANDROID_HOME" )
3938def ndkDir = System . getenv(" ANDROID_NDK_HOME" )
4039def propertiesFile = project. rootProject. file(' local.properties' )
@@ -46,110 +45,71 @@ if (propertiesFile.exists()) {
4645project. ext. ndkDir = ndkDir;
4746
4847
49- class StripSymbolsTaskExecutionListener implements TaskExecutionListener
50- {
48+ class StripSymbolsTaskExecutionListener implements TaskExecutionListener {
5149 @Override
52- void beforeExecute (Task task )
53- {
50+ void beforeExecute (Task task ) {
5451 }
5552
56- String getMachineName ()
57- {
58- if (OperatingSystem . current(). isWindows())
59- {
53+ String getMachineName () {
54+ if (OperatingSystem . current(). isWindows()) {
6055 return " windows" ;
61- }
62- else if (OperatingSystem . current(). isMacOsX())
63- {
56+ } else if (OperatingSystem . current(). isMacOsX()) {
6457 return " darwin" ;
65- }
66- else
67- {
58+ } else {
6859 return " linux" ;
6960 }
7061 }
7162
72- String getStripToolName (String stripTaskName )
73- {
63+ String getStripToolName (String stripTaskName ) {
7464 stripTaskName = stripTaskName. toLowerCase();
7565 def stripToolName = " "
76- if (stripTaskName. contains(" arm64" ))
77- {
66+ if (stripTaskName. contains(" arm64" )) {
7867 stripToolName = " aarch64-linux-android-strip" ;
79- }
80- else if (stripTaskName. contains(" arm" ))
81- {
68+ } else if (stripTaskName. contains(" arm" )) {
8269 stripToolName = " arm-linux-androideabi-strip" ;
83- }
84- else if (stripTaskName. contains(" mips64" ))
85- {
70+ } else if (stripTaskName. contains(" mips64" )) {
8671 stripToolName = " mips64el-linux-android-strip" ;
87- }
88- else if (stripTaskName. contains(" mips" ))
89- {
72+ } else if (stripTaskName. contains(" mips" )) {
9073 stripToolName = " mipsel-linux-android-strip" ;
91- }
92- else if (stripTaskName. contains(" x86_64" ))
93- {
74+ } else if (stripTaskName. contains(" x86_64" )) {
9475 stripToolName = " x86_64-linux-android-strip" ;
95- }
96- else if (stripTaskName. contains(" x86" ))
97- {
76+ } else if (stripTaskName. contains(" x86" )) {
9877 stripToolName = " i686-linux-android-strip" ;
99- }
100- else
101- {
78+ } else {
10279 throw new IllegalArgumentException (" NOT SUPPORTED ARCHITECTURE NAME: ${ stripTaskName} " );
10380 }
10481
105- if (OperatingSystem . current(). isWindows())
106- {
82+ if (OperatingSystem . current(). isWindows()) {
10783 stripToolName + = " .exe" ;
10884 }
10985
11086 return stripToolName;
11187 }
11288
113- String getStripToolDirectory (String stripTaskName )
114- {
89+ String getStripToolDirectory (String stripTaskName ) {
11590 stripTaskName = stripTaskName. toLowerCase();
11691 def stripToolDirectory = " "
117- if (stripTaskName. contains(" arm64" ))
118- {
92+ if (stripTaskName. contains(" arm64" )) {
11993 stripToolDirectory = " aarch64-linux-android-4.9" ;
120- }
121- else if (stripTaskName. contains(" arm" ))
122- {
94+ } else if (stripTaskName. contains(" arm" )) {
12395 stripToolDirectory = " arm-linux-androideabi-4.9" ;
124- }
125- else if (stripTaskName. contains(" mips64" ))
126- {
96+ } else if (stripTaskName. contains(" mips64" )) {
12797 stripToolDirectory = " mips64el-linux-android-4.9" ;
128- }
129- else if (stripTaskName. contains(" mips" ))
130- {
98+ } else if (stripTaskName. contains(" mips" )) {
13199 stripToolDirectory = " mipsel-linux-android-4.9" ;
132- }
133- else if (stripTaskName. contains(" x86_64" ))
134- {
100+ } else if (stripTaskName. contains(" x86_64" )) {
135101 stripToolDirectory = " x86_64-4.9" ;
136- }
137- else if (stripTaskName. contains(" x86" ))
138- {
102+ } else if (stripTaskName. contains(" x86" )) {
139103 stripToolDirectory = " x86-4.9" ;
140- }
141- else
142- {
104+ } else {
143105 throw new IllegalArgumentException (" NOT SUPPORTED ARCHITECTURE: ${ stripTaskName} " );
144106 }
145107
146108 return stripToolDirectory;
147109 }
148110
149- void afterExecute (Task task , TaskState taskState )
150- {
151- if (task. getName(). contains(" stripSymbols" ) && ! taskState. failure)
152- {
111+ void afterExecute (Task task , TaskState taskState ) {
112+ if (task. getName(). contains(" stripSymbols" ) && ! taskState. failure) {
153113 println " Found STRIP COMMAND: ${ task.getName()} "
154114 println " input file " + task. getInputs(). getFiles(). getAsPath();
155115 println " output dir " + task. getOutputs(). getFiles(). getAsPath();
@@ -170,12 +130,9 @@ class StripSymbolsTaskExecutionListener implements TaskExecutionListener
170130 println " Strip tool: ${ stripToolPath} "
171131
172132 def command = " " ;
173- if (OperatingSystem . current(). isWindows())
174- {
175- command = " cmd /c ${ stripToolPath} ${ libToStripPath} " ;
176- }
177- else
178- {
133+ if (OperatingSystem . current(). isWindows()) {
134+ command = " cmd /c ${ stripToolPath} ${ libToStripPath} " ;
135+ } else {
179136 command = " ${ stripToolPath} ${ libToStripPath} " ;
180137 }
181138
@@ -186,8 +143,7 @@ class StripSymbolsTaskExecutionListener implements TaskExecutionListener
186143 }
187144}
188145
189- if (! ndkDebuggable)
190- {
146+ if (! ndkDebuggable) {
191147 project. gradle. addListener(new StripSymbolsTaskExecutionListener ())
192148}
193149
@@ -200,7 +156,7 @@ model {
200156 buildToolsVersion = project. ext. _buildToolsVersion
201157
202158 defaultConfig. with {
203- if (optimized) {
159+ if (optimized) {
204160 project. archivesBaseName = " ${ archivesBaseName} -optimized"
205161 } else {
206162 project. archivesBaseName = " ${ archivesBaseName} -regular"
@@ -230,38 +186,35 @@ model {
230186 " -I${ file("src/main/jni/v8_inspector")} " . toString(),
231187 // "-I${file("src/main/jni/v8_inspector/platform/inspector_protocol/")}".toString(),
232188 // "-I${file("src/main/jni/v8_inspector/protocol/")}".toString(),
233- ])
189+ ])
234190
235- cppFlags. addAll([" -std=c++11" , " -fexceptions" , " -fno-builtin-stpcpy" , " -DHAVE_INSPECTOR" , " -D__ANDROID__" ]) // , "-DV8_INSPECTOR_USE_STL=1", "-D__GXX_EXPERIMENTAL_CXX0X__=1"
191+ cppFlags. addAll([" -std=c++11" , " -fexceptions" , " -fno-builtin-stpcpy" , " -D__ANDROID__" ])
192+ // , "-DV8_INSPECTOR_USE_STL=1", "-D__GXX_EXPERIMENTAL_CXX0X__=1", "-DHAVE_INSPECTOR"
236193
237194
238195 CFlags . addAll([" -Wno-error=format-security" , " -g" , " -fno-builtin-stpcpy" ])
239196
240197 ldLibs. addAll([" android" , " dl" , " log" , " atomic" , " z" ])
241198
242- if (optimized) {
199+ if (optimized) {
243200 ldFlags. addAll([" -Wl,--exclude-libs=ALL" , " -Wl,--gc-sections" ])
244201 }
245202 ldFlags. addAll([" -Wl,--allow-multiple-definition" ])
246203
247204 toolchain = " clang"
248205 stl = " c++_static"
249206
250- abiFilters. addAll([" armeabi-v7a " , " x86 " ])
207+ abiFilters. addAll([" x86 " , " armeabi-v7a " ])
251208
252- if (System . getProperties()[' idea.platform.prefix' ] != null )
253- {
209+ if (System . getProperties()[' idea.platform.prefix' ] != null ) {
254210 // Built from AndroidStudio
255211 println " Build from AndroidStudio"
256212
257- if (! ndkDebuggable)
258- {
213+ if (! ndkDebuggable) {
259214 abiFilters. addAll([" x86" , " arm64-v8a" ])
260215
261216 }
262- }
263- else
264- {
217+ } else {
265218 // Built from command line
266219 abiFilters. addAll([" x86" , " arm64-v8a" ])
267220
@@ -311,8 +264,7 @@ model {
311264
312265 tasks. whenTaskAdded { task ->
313266 def taskName = task. getName()
314- if (taskName == " androidRelease" )
315- {
267+ if (taskName == " androidRelease" ) {
316268 task. dependsOn(setRuntimeCommit)
317269 task. mustRunAfter setRuntimeCommit
318270 task. finalizedBy revertVersionFile
@@ -332,24 +284,28 @@ model {
332284 create(" armeabi-v7a" ) {
333285 abiFilters. add(" armeabi-v7a" )
334286
287+ ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_base.a")} " . toString())
288+ ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_builtins_setup.a")} " . toString())
289+ ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_builtins_generators.a")} " . toString())
335290 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_base.a")} " . toString())
336291 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libplatform.a")} " . toString())
337292 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libbase.a")} " . toString())
338293 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libsampler.a")} " . toString())
339294 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_nosnapshot.a")} " . toString())
340- ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libinspector.a")} " . toString())
341295 ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libzip.a")} " . toString())
342296 }
343297
344298 create(" x86" ) {
345299 abiFilters. add(" x86" )
346300
301+ ldLibs. add(" ${ file("src/main/libs/x86/libv8_base.a")} " . toString())
302+ ldLibs. add(" ${ file("src/main/libs/x86/libv8_builtins_setup.a")} " . toString())
303+ ldLibs. add(" ${ file("src/main/libs/x86/libv8_builtins_generators.a")} " . toString())
347304 ldLibs. add(" ${ file("src/main/libs/x86/libv8_base.a")} " . toString())
348305 ldLibs. add(" ${ file("src/main/libs/x86/libv8_libplatform.a")} " . toString())
349306 ldLibs. add(" ${ file("src/main/libs/x86/libv8_libbase.a")} " . toString())
350- ldLibs. add(" ${ file("src/main/libs/x86/libv8_libsampler.a")} " . toString())
351307 ldLibs. add(" ${ file("src/main/libs/x86/libv8_nosnapshot.a")} " . toString())
352- ldLibs. add(" ${ file("src/main/libs/x86/libinspector .a")} " . toString())
308+ ldLibs. add(" ${ file("src/main/libs/x86/libv8_libsampler .a")} " . toString())
353309 ldLibs. add(" ${ file("src/main/libs/x86/libzip.a")} " . toString())
354310 }
355311
@@ -359,12 +315,15 @@ model {
359315 ldFlags. addAll([
360316 " -L${ file("src/main/libs/arm64-v8a")} " . toString(),
361317 " -lv8_base" ,
318+ " -lv8_builtins_setup" ,
319+ " -lv8_builtins_generators" ,
320+ " -lv8_base" ,
362321 " -lv8_libplatform" ,
363322 " -lv8_libbase" ,
364323 " -lv8_libsampler" ,
365324 " -lv8_nosnapshot" ,
366- " -linspector " ,
367- " -lzip "
325+ " -lzip " ,
326+ " -v "
368327 ])
369328
370329 // The correct way of setting these flags is not working hence the workaround above
@@ -392,7 +351,8 @@ model {
392351 staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_libbase.a" )
393352 staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_libsampler.a" )
394353 staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_nosnapshot.a" )
395- staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libzip.a" )
354+ staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_builtins_setup.a" )
355+ staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_builtins_generators.a" )
396356 }
397357 }
398358 }
0 commit comments