以下是项目使用的weex sdk 是0.18.0的,直接从git上下载的项目然后拷贝过来使用的
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
        classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.5.0'
    }
}

plugins {
    id "com.github.hierynomus.license" version "0.14.0"
}

apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
apply plugin: 'com.getkeepsafe.dexcount'

ext.disableCov = project.hasProperty('disableCov') ? 
project.getProperty('disableCov') : 'false'
if(!disableCov.toBoolean()){
    apply plugin: 'com.vanniktech.android.junit.jacoco'
    junitJacoco {
        excludes = 
['com/taobao/weex/dom/flex/**','com/taobao/weex/ui/view/refresh/circlebar/**']
    }
}

task checkstyle(type: Checkstyle) {
    configFile file("${project.rootDir}/config/quality/checkstyle.xml") // 
Where my checkstyle config is...
    // configProperties.checkstyleSuppressionsPath = 
file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
 // Where is my suppressions file for checkstyle is...
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    exclude '**/test/**'
    exclude '**/com/taobao/weex/dom/flex/**'
    classpath = files()
}

checkstyle {
    toolVersion = '6.9'
}

version = "0.18.0"

android {
    compileSdkVersion project.compileSdkVersion
    buildToolsVersion project.buildToolsVersion
    resourcePrefix "weex"

    useLibrary 'org.apache.http.legacy'
    copy {
        from '../../pre-build'
        into new File(projectDir,"assets")
        include 'native-bundle-main.js'
        rename('native-bundle-main.js','main.js')
    }
    def line
    new File(projectDir,"assets/main.js").withReader { line = it.readLine() }
    def m = line =~ /[A-Z\s]+\s+([0-9\.]+),\s+Build\s+[0-9]+/;
    def jsfmVersion = m[0][1]
    println jsfmVersion

    if(project.hasProperty('asfRelease')){
        //download so file if not exist, when compile in source release
        download{
            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/armeabi/libweexjsc.so;hb=refs/heads/master'
            dest "${projectDir}/libs/armeabi/libweexjsc.so"
            overwrite false
        }
        download{
            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/x86/libweexjsc.so;hb=refs/heads/master'
            dest "${projectDir}/libs/x86/libweexjsc.so"
            overwrite false
        }
    }

    def ARMEABI_Size = new 
File(projectDir,"libs/armeabi/libweexjsc.so").length();
    def X86_Size = new File(projectDir,"libs/x86/libweexjsc.so").length();
    println "ARMEABI_Size: "+ARMEABI_Size;
    println "X86_Size:" + X86_Size;


    defaultConfig {
        buildConfigField "long", "ARMEABI_Size", "${ARMEABI_Size}"
        buildConfigField "long", "X86_Size", "${X86_Size}"
        buildConfigField "String", "buildJavascriptFrameworkVersion", 
"\"${jsfmVersion}\""
        buildConfigField "String", "buildVersion", "\"${version}\""
        minSdkVersion 14
        targetSdkVersion project.targetSdkVersion
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
            buildConfigField "boolean", "ENABLE_TRACE", "false"
        }

        debug {
            testCoverageEnabled true
            buildConfigField "boolean", "ENABLE_TRACE", "true"
        }
    }

    sourceSets {
        main {
            assets.srcDirs = ['assets']
            jniLibs.srcDir(['libs'])
            java {
                srcDirs = ["src/main/java"];
            }
        }
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

    compileOptions.encoding = "UTF-8"
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    testOptions {
        unitTests.returnDefaultValues = true
        unitTests.all {
            maxHeapSize = "1024m"
            jvmArgs += ['-XX:-UseSplitVerifier', '-noverify','-Xverify:none']/* 
fix VerifyError  */
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    provided "com.android.support:recyclerview-v7:25.1.1"
    provided "com.android.support:support-v4:25.1.1"
    provided "com.android.support:appcompat-v7:25.1.1"
    provided "com.alibaba:fastjson:1.1.46.android"

    testCompile "com.alibaba:fastjson:1.1.46.android"
    testCompile 'junit:junit:4.12'
    testCompile 'org.hamcrest:hamcrest-core:1.3'
    testCompile 'org.javassist:javassist:3.20.0-GA'
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'org.objenesis:objenesis:2.1'
    testCompile 'org.powermock:powermock-core:1.6.4'
    testCompile 'org.powermock:powermock-api-mockito:1.6.4'
    testCompile 'org.powermock:powermock-module-junit4-common:1.6.4'
    testCompile 'org.powermock:powermock-module-junit4:1.6.4'
    testCompile 'org.powermock:powermock-module-junit4-legacy:1.6.4'
    testCompile 'org.powermock:powermock-module-testng:1.6.4'
    testCompile 'org.powermock:powermock-classloading-xstream:1.6.4'
    testCompile "org.powermock:powermock-module-junit4-rule:1.6.4"
    testCompile 'org.robolectric:robolectric:3.3.2'
    testCompile "org.robolectric:shadows-httpclient:3.3.2"
    testCompile 'org.json:json:20160212'
}
if(file('../license/LICENSE').exists()){
    license {
        header = file('../license/LICENSE')
        excludes(["com/taobao/weex/dom/flex/*.java"])
    }
    preBuild.dependsOn licenseFormat
}


[ Full content available at: 
https://github.com/apache/incubator-weex/issues/1515 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to