@@ -22,7 +22,7 @@ allprojects {
22
22
def ndkDebuggable = false ;
23
23
def optimized = project. hasProperty(" optimized" )
24
24
25
- if (optimized) {
25
+ if (optimized) {
26
26
println " Optimized build triggered."
27
27
}
28
28
@@ -34,7 +34,6 @@ for (String runTask : runTasks) {
34
34
}
35
35
}
36
36
37
-
38
37
project. ext. sdkDir = System . getenv(" ANDROID_HOME" )
39
38
def ndkDir = System . getenv(" ANDROID_NDK_HOME" )
40
39
def propertiesFile = project. rootProject. file(' local.properties' )
@@ -46,110 +45,71 @@ if (propertiesFile.exists()) {
46
45
project. ext. ndkDir = ndkDir;
47
46
48
47
49
- class StripSymbolsTaskExecutionListener implements TaskExecutionListener
50
- {
48
+ class StripSymbolsTaskExecutionListener implements TaskExecutionListener {
51
49
@Override
52
- void beforeExecute (Task task )
53
- {
50
+ void beforeExecute (Task task ) {
54
51
}
55
52
56
- String getMachineName ()
57
- {
58
- if (OperatingSystem . current(). isWindows())
59
- {
53
+ String getMachineName () {
54
+ if (OperatingSystem . current(). isWindows()) {
60
55
return " windows" ;
61
- }
62
- else if (OperatingSystem . current(). isMacOsX())
63
- {
56
+ } else if (OperatingSystem . current(). isMacOsX()) {
64
57
return " darwin" ;
65
- }
66
- else
67
- {
58
+ } else {
68
59
return " linux" ;
69
60
}
70
61
}
71
62
72
- String getStripToolName (String stripTaskName )
73
- {
63
+ String getStripToolName (String stripTaskName ) {
74
64
stripTaskName = stripTaskName. toLowerCase();
75
65
def stripToolName = " "
76
- if (stripTaskName. contains(" arm64" ))
77
- {
66
+ if (stripTaskName. contains(" arm64" )) {
78
67
stripToolName = " aarch64-linux-android-strip" ;
79
- }
80
- else if (stripTaskName. contains(" arm" ))
81
- {
68
+ } else if (stripTaskName. contains(" arm" )) {
82
69
stripToolName = " arm-linux-androideabi-strip" ;
83
- }
84
- else if (stripTaskName. contains(" mips64" ))
85
- {
70
+ } else if (stripTaskName. contains(" mips64" )) {
86
71
stripToolName = " mips64el-linux-android-strip" ;
87
- }
88
- else if (stripTaskName. contains(" mips" ))
89
- {
72
+ } else if (stripTaskName. contains(" mips" )) {
90
73
stripToolName = " mipsel-linux-android-strip" ;
91
- }
92
- else if (stripTaskName. contains(" x86_64" ))
93
- {
74
+ } else if (stripTaskName. contains(" x86_64" )) {
94
75
stripToolName = " x86_64-linux-android-strip" ;
95
- }
96
- else if (stripTaskName. contains(" x86" ))
97
- {
76
+ } else if (stripTaskName. contains(" x86" )) {
98
77
stripToolName = " i686-linux-android-strip" ;
99
- }
100
- else
101
- {
78
+ } else {
102
79
throw new IllegalArgumentException (" NOT SUPPORTED ARCHITECTURE NAME: ${ stripTaskName} " );
103
80
}
104
81
105
- if (OperatingSystem . current(). isWindows())
106
- {
82
+ if (OperatingSystem . current(). isWindows()) {
107
83
stripToolName + = " .exe" ;
108
84
}
109
85
110
86
return stripToolName;
111
87
}
112
88
113
- String getStripToolDirectory (String stripTaskName )
114
- {
89
+ String getStripToolDirectory (String stripTaskName ) {
115
90
stripTaskName = stripTaskName. toLowerCase();
116
91
def stripToolDirectory = " "
117
- if (stripTaskName. contains(" arm64" ))
118
- {
92
+ if (stripTaskName. contains(" arm64" )) {
119
93
stripToolDirectory = " aarch64-linux-android-4.9" ;
120
- }
121
- else if (stripTaskName. contains(" arm" ))
122
- {
94
+ } else if (stripTaskName. contains(" arm" )) {
123
95
stripToolDirectory = " arm-linux-androideabi-4.9" ;
124
- }
125
- else if (stripTaskName. contains(" mips64" ))
126
- {
96
+ } else if (stripTaskName. contains(" mips64" )) {
127
97
stripToolDirectory = " mips64el-linux-android-4.9" ;
128
- }
129
- else if (stripTaskName. contains(" mips" ))
130
- {
98
+ } else if (stripTaskName. contains(" mips" )) {
131
99
stripToolDirectory = " mipsel-linux-android-4.9" ;
132
- }
133
- else if (stripTaskName. contains(" x86_64" ))
134
- {
100
+ } else if (stripTaskName. contains(" x86_64" )) {
135
101
stripToolDirectory = " x86_64-4.9" ;
136
- }
137
- else if (stripTaskName. contains(" x86" ))
138
- {
102
+ } else if (stripTaskName. contains(" x86" )) {
139
103
stripToolDirectory = " x86-4.9" ;
140
- }
141
- else
142
- {
104
+ } else {
143
105
throw new IllegalArgumentException (" NOT SUPPORTED ARCHITECTURE: ${ stripTaskName} " );
144
106
}
145
107
146
108
return stripToolDirectory;
147
109
}
148
110
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) {
153
113
println " Found STRIP COMMAND: ${ task.getName()} "
154
114
println " input file " + task. getInputs(). getFiles(). getAsPath();
155
115
println " output dir " + task. getOutputs(). getFiles(). getAsPath();
@@ -170,12 +130,9 @@ class StripSymbolsTaskExecutionListener implements TaskExecutionListener
170
130
println " Strip tool: ${ stripToolPath} "
171
131
172
132
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 {
179
136
command = " ${ stripToolPath} ${ libToStripPath} " ;
180
137
}
181
138
@@ -186,8 +143,7 @@ class StripSymbolsTaskExecutionListener implements TaskExecutionListener
186
143
}
187
144
}
188
145
189
- if (! ndkDebuggable)
190
- {
146
+ if (! ndkDebuggable) {
191
147
project. gradle. addListener(new StripSymbolsTaskExecutionListener ())
192
148
}
193
149
@@ -200,7 +156,7 @@ model {
200
156
buildToolsVersion = project. ext. _buildToolsVersion
201
157
202
158
defaultConfig. with {
203
- if (optimized) {
159
+ if (optimized) {
204
160
project. archivesBaseName = " ${ archivesBaseName} -optimized"
205
161
} else {
206
162
project. archivesBaseName = " ${ archivesBaseName} -regular"
@@ -230,38 +186,35 @@ model {
230
186
" -I${ file("src/main/jni/v8_inspector")} " . toString(),
231
187
// "-I${file("src/main/jni/v8_inspector/platform/inspector_protocol/")}".toString(),
232
188
// "-I${file("src/main/jni/v8_inspector/protocol/")}".toString(),
233
- ])
189
+ ])
234
190
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"
236
193
237
194
238
195
CFlags . addAll([" -Wno-error=format-security" , " -g" , " -fno-builtin-stpcpy" ])
239
196
240
197
ldLibs. addAll([" android" , " dl" , " log" , " atomic" , " z" ])
241
198
242
- if (optimized) {
199
+ if (optimized) {
243
200
ldFlags. addAll([" -Wl,--exclude-libs=ALL" , " -Wl,--gc-sections" ])
244
201
}
245
202
ldFlags. addAll([" -Wl,--allow-multiple-definition" ])
246
203
247
204
toolchain = " clang"
248
205
stl = " c++_static"
249
206
250
- abiFilters. addAll([" armeabi-v7a " , " x86 " ])
207
+ abiFilters. addAll([" x86 " , " armeabi-v7a " ])
251
208
252
- if (System . getProperties()[' idea.platform.prefix' ] != null )
253
- {
209
+ if (System . getProperties()[' idea.platform.prefix' ] != null ) {
254
210
// Built from AndroidStudio
255
211
println " Build from AndroidStudio"
256
212
257
- if (! ndkDebuggable)
258
- {
213
+ if (! ndkDebuggable) {
259
214
abiFilters. addAll([" x86" , " arm64-v8a" ])
260
215
261
216
}
262
- }
263
- else
264
- {
217
+ } else {
265
218
// Built from command line
266
219
abiFilters. addAll([" x86" , " arm64-v8a" ])
267
220
@@ -311,8 +264,7 @@ model {
311
264
312
265
tasks. whenTaskAdded { task ->
313
266
def taskName = task. getName()
314
- if (taskName == " androidRelease" )
315
- {
267
+ if (taskName == " androidRelease" ) {
316
268
task. dependsOn(setRuntimeCommit)
317
269
task. mustRunAfter setRuntimeCommit
318
270
task. finalizedBy revertVersionFile
@@ -332,24 +284,28 @@ model {
332
284
create(" armeabi-v7a" ) {
333
285
abiFilters. add(" armeabi-v7a" )
334
286
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())
335
290
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_base.a")} " . toString())
336
291
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libplatform.a")} " . toString())
337
292
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libbase.a")} " . toString())
338
293
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_libsampler.a")} " . toString())
339
294
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libv8_nosnapshot.a")} " . toString())
340
- ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libinspector.a")} " . toString())
341
295
ldLibs. add(" ${ file("src/main/libs/armeabi-v7a/libzip.a")} " . toString())
342
296
}
343
297
344
298
create(" x86" ) {
345
299
abiFilters. add(" x86" )
346
300
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())
347
304
ldLibs. add(" ${ file("src/main/libs/x86/libv8_base.a")} " . toString())
348
305
ldLibs. add(" ${ file("src/main/libs/x86/libv8_libplatform.a")} " . toString())
349
306
ldLibs. add(" ${ file("src/main/libs/x86/libv8_libbase.a")} " . toString())
350
- ldLibs. add(" ${ file("src/main/libs/x86/libv8_libsampler.a")} " . toString())
351
307
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())
353
309
ldLibs. add(" ${ file("src/main/libs/x86/libzip.a")} " . toString())
354
310
}
355
311
@@ -359,12 +315,15 @@ model {
359
315
ldFlags. addAll([
360
316
" -L${ file("src/main/libs/arm64-v8a")} " . toString(),
361
317
" -lv8_base" ,
318
+ " -lv8_builtins_setup" ,
319
+ " -lv8_builtins_generators" ,
320
+ " -lv8_base" ,
362
321
" -lv8_libplatform" ,
363
322
" -lv8_libbase" ,
364
323
" -lv8_libsampler" ,
365
324
" -lv8_nosnapshot" ,
366
- " -linspector " ,
367
- " -lzip "
325
+ " -lzip " ,
326
+ " -v "
368
327
])
369
328
370
329
// The correct way of setting these flags is not working hence the workaround above
@@ -392,7 +351,8 @@ model {
392
351
staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_libbase.a" )
393
352
staticLibraryFile = file(" src/main/libs/${ targetPlatform.getName()} /libv8_libsampler.a" )
394
353
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" )
396
356
}
397
357
}
398
358
}
0 commit comments