@@ -26,20 +26,11 @@ apply plugin: 'checkstyle'
26
26
apply plugin : ' com.jfrog.bintray'
27
27
apply plugin : ' com.github.dcendents.android-maven'
28
28
29
- task checkstyle (type : Checkstyle ) {
30
- configFile file(" ${ project.rootDir} /sdk/config/quality/checkstyle.xml" ) // Where my checkstyle config is...
31
- // configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath // Where is my suppressions file for checkstyle is...
32
- source ' src'
33
- include ' **/*.java'
34
- exclude ' **/gen/**'
35
- exclude ' **/test/**'
36
- exclude ' **/com/taobao/weex/dom/flex/**'
37
- classpath = files()
38
- }
39
-
40
- checkstyle {
41
- toolVersion = ' 6.9'
42
- }
29
+ apply from : ' buildSrc/asan.gradle'
30
+ apply from : ' buildSrc/jcenter.gradle'
31
+ apply from : ' buildSrc/unstripped.gradle'
32
+ apply from : ' buildSrc/checkStyle.gradle'
33
+ apply from : ' buildSrc/packageName.gradle'
43
34
44
35
version = project. hasProperty(' weexVersion' ) ? project. getProperty(' weexVersion' ) : ' 0.26.0.1'
45
36
@@ -62,8 +53,6 @@ if (!project.hasProperty('ignoreVersionCheck') || !project.getProperty('ignoreVe
62
53
}
63
54
}
64
55
65
- def useApachePackageName = project. hasProperty(' apachePackageName' ) ? project. property(' apachePackageName' ). toBoolean() : true
66
-
67
56
android {
68
57
compileSdkVersion project. compileSdkVersion
69
58
resourcePrefix " weex"
@@ -114,7 +103,7 @@ android {
114
103
115
104
def buildRuntimeApi = project. hasProperty(' buildRuntimeApi' ) ? project. property(' buildRuntimeApi' ) : false
116
105
117
- defaultPublishConfig useApachePackageName ? ' apacheRelease' : ' legacyRelease'
106
+ defaultPublishConfig project . useApachePackageName ? ' apacheRelease' : ' legacyRelease'
118
107
119
108
defaultConfig {
120
109
buildConfigField " String" , " buildJavascriptFrameworkVersion" , " \" ${ jsfmVersion} \" "
@@ -188,7 +177,7 @@ android {
188
177
sourceSets {
189
178
main. assets. srcDirs = [' assets' ]
190
179
main. jniLibs. srcDirs = [' libs' ]
191
- if (! useApachePackageName){
180
+ if (! project . useApachePackageName){
192
181
main. java. srcDirs = [' src/legacyRelease/java' ]
193
182
main. manifest. srcFile (new File (' src/legacyRelease/AndroidManifest.xml' ))
194
183
}
@@ -267,207 +256,4 @@ task weex_core_license(type: com.hierynomus.gradle.license.tasks.LicenseFormat)
267
256
' Source/include/JavaScriptCore/**/*.cpp' ])
268
257
}
269
258
270
- def ndkDir = ' '
271
- task checkNdkVersion () {
272
- def rootDir = project. rootDir
273
- def localProperties = new File (rootDir, " local.properties" )
274
- if (localProperties. exists()) {
275
- Properties properties = new Properties ()
276
- localProperties. withInputStream { instr ->
277
- properties. load(instr)
278
- }
279
- ndkDir = properties. getProperty(' ndk.dir' )
280
- }
281
- }
282
-
283
- def siteUrl = ' https://weex.incubator.apache.org'
284
- def gitUrl = ' https://github.com/apache/incubator-weex.git'
285
- group = " com.taobao.android"
286
- install {
287
- repositories. mavenInstaller {
288
- // This generates POM.xml with proper parameters
289
- pom {
290
- project {
291
- packaging ' aar'
292
- name ' weex_sdk'
293
- url siteUrl
294
- licenses {
295
- license {
296
- name ' The Apache Software License, Version 2.0'
297
- url ' https://www.apache.org/licenses/LICENSE-2.0.txt'
298
- }
299
- }
300
- developers {
301
- developer {
302
- id ' weex alibaba'
303
- name ' weex alibaba'
304
-
305
- }
306
- }
307
- scm {
308
- connection gitUrl
309
- developerConnection gitUrl
310
- url siteUrl
311
- }
312
- }
313
- }
314
- }
315
- }
316
-
317
- bintray {
318
- configurations = [' archives' ]
319
- user = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
320
- key = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
321
- pkg {
322
- repo = " maven"
323
- name = " weex_sdk"
324
- websiteUrl = siteUrl
325
- vcsUrl = gitUrl
326
- licenses = [" Apache-2.0" ]
327
- publish = true
328
- version {
329
- // The version to be published
330
- name = project. version
331
- vcsTag = project. version
332
- }
333
- }
334
- }
335
- artifactory {
336
- contextUrl = ' http://oss.jfrog.org/artifactory'
337
- publish {
338
- repository {
339
- repoKey = ' oss-snapshot-local'
340
- username = bintray. user
341
- password = bintray. key
342
- maven = true
343
- }
344
- defaults {
345
- publishConfigs(' archives' )
346
- }
347
- }
348
- }
349
- def asanAbi = project. hasProperty(' asanAbi' ) ? project. getProperty(' asanAbi' ) : ' arm64-v8a'
350
- task clearASanLibs (type : Delete ){
351
- delete project. android. sourceSets. main. resources. srcDirs
352
- delete fileTree(project. android. sourceSets. main. jniLibs. srcDirs[-1 ]) {
353
- include ' **/libclang_rt.asan-*-android.so'
354
- }
355
- }
356
- task copyWrapScript (type : Copy ,dependsOn : clearASanLibs) {
357
- if (project. hasProperty(' enableASan' ) && " true" == project. getProperty(' enableASan' )) {
358
- from ' wrap.sh'
359
- into new File (project. android. sourceSets. main. resources. srcDirs[-1 ], " lib" )
360
- eachFile {
361
- it. path = " ${ asanAbi} /${ it.name} "
362
- }
363
- }
364
- }
365
- task copyASanLib (type : Copy ,dependsOn : copyWrapScript){
366
- if (project. hasProperty(' enableASan' ) && " true" == project. getProperty(' enableASan' )) {
367
- def ndkPath = ndkDir == ' ' ? System . getenv(" ANDROID_NDK_HOME" ): ndkDir
368
- def dir = ndkPath + ' /toolchains/llvm/prebuilt/'
369
- def renamedAbi = asanAbi
370
- if (asanAbi == " armeabi-v7a" || asanAbi == " armeabi" )
371
- renamedAbi = " arm"
372
- if (asanAbi == " arm64-v8a" )
373
- renamedAbi = " aarch64"
374
- if (asanAbi == " x86" )
375
- renamedAbi = " i686"
376
- new File (dir). eachFileRecurse { file ->
377
- if (file. name == ' libclang_rt.asan-' + renamedAbi + ' -android.so' )
378
- from file. absolutePath
379
- into project. android. sourceSets. main. jniLibs. srcDirs[-1 ]
380
- eachFile {
381
- it. path = " ${ asanAbi} /${ it.name} "
382
- }
383
- includeEmptyDirs = false
384
- }
385
- }
386
- }
387
-
388
- task copyAndRenamePackage (type : Copy ) {
389
- if (! useApachePackageName) {
390
- doFirst {
391
- delete new File (' src/legacyRelease/java' )
392
- }
393
- from new File (' src/main/java/com/taobao/weex' )
394
- into new File (' src/legacyRelease/java/org/apache/weex' )
395
- filter { String line ->
396
- line. replaceAll(/ ^(package com\. taobao)(\. weex.*)$/ , { _ , packageName , suffix ->
397
- " package org.apache${ suffix} "
398
- }). replaceAll(/ ^(import com\. taobao)(\. weex.*)$/ , { _ , packageName , suffix ->
399
- " import org.apache${ suffix} "
400
- }). replaceAll(/ ^(import static com\. taobao)(\. weex.*)$/ , { _ , packageName , suffix ->
401
- " import static org.apache${ suffix} "
402
- })
403
- }
404
- }
405
- }
406
-
407
- task copyManifest (type : Copy ){
408
- if (! useApachePackageName){
409
- doFirst {
410
- delete new File (' src/legacyRelease/AndroidManifest.xml' )
411
- }
412
- from new File (' src/main/AndroidManifest.xml' )
413
- into new File (' src/legacyRelease' )
414
- filter { String line ->
415
- line. replaceAll(/ (com\. taobao)(\. weex.*)/ , { _ , packageName , suffix ->
416
- " org.apache${ suffix} "
417
- })
418
- }
419
- }
420
- }
421
-
422
- def processNativeLibs = { unstripped , stripped ->
423
- copy{
424
- from unstripped
425
- into new File (project. buildDir, " unstrippedSo" )
426
- include ' **/libweexjss.so' , ' **/libweexcore.so'
427
- eachFile {
428
- it. path = " ${ it.relativePath.segments[-2]} _${ it.name} "
429
- }
430
- }
431
-
432
- if (project. hasProperty(' supportArmeabi' ) && " true" == project. getProperty(' supportArmeabi' )){
433
- // Copy stripped shared library from armeabi-v7a into armeabi
434
- copy{
435
- from stripped
436
- into project. android. sourceSets. main. jniLibs. srcDirs[-1 ]
437
- include ' **/armeabi-v7a/**'
438
- exclude ' **/libc++_shared.so'
439
- eachFile {
440
- it. path = " armeabi/${ it.name} "
441
- }
442
- }
443
-
444
- // Copy Unstripped shared library from armeabi-v7a into armeabi
445
- copy{
446
- from unstripped
447
- into new File (project. buildDir, " unstrippedSo" )
448
- include ' **/armeabi-v7a/libweexjss.so' , ' **/armeabi-v7a/libweexcore.so'
449
- eachFile {
450
- it. path = " armeabi_${ it.name} "
451
- }
452
- }
453
- }
454
- }
455
-
456
- afterEvaluate { project ->
457
- transformNativeLibsWithStripDebugSymbolForRelease << {
458
- processNativeLibs transformNativeLibsWithMergeJniLibsForRelease,
459
- transformNativeLibsWithStripDebugSymbolForRelease
460
- }
461
-
462
- transformNativeLibsWithStripDebugSymbolForApacheRelease << {
463
- processNativeLibs transformNativeLibsWithMergeJniLibsForApacheRelease,
464
- transformNativeLibsWithStripDebugSymbolForApacheRelease
465
- }
466
-
467
- transformNativeLibsWithStripDebugSymbolForLegacyRelease << {
468
- processNativeLibs transformNativeLibsWithMergeJniLibsForLegacyRelease,
469
- transformNativeLibsWithStripDebugSymbolForLegacyRelease
470
- }
471
- }
472
-
473
259
preBuild. dependsOn copyAndRenamePackage, copyManifest, copyASanLib, checkNdkVersion, licenseFormat
0 commit comments