apply plugin: 'com.android.library'

group = rootProject.extensions.groups.Main
version = "1.2.0"

android {
    compileSdkVersion rootProject.extensions.sdks.CompileSDK
    buildToolsVersion rootProject.extensions.sdks.BuildTool
    publishNonDefault true
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            jniLibs.srcDirs '../../core/android/freetype-prebuilt/libs'
        }
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            debuggable true
        }
        release {
            debuggable false
        }
    }

    defaultConfig {
        minSdkVersion rootProject.extensions.sdks.MinSDK
        targetSdkVersion rootProject.extensions.sdks.TargetSDK

        consumerProguardFiles 'proguard-rules.txt'
        externalNativeBuild {
            cmake {
                arguments  '-DGCANVAS_WEEX=1'
            }

            ndk {
                abiFilters 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }

    flavorDimensions "target_app"
    productFlavors {
        standalone {
            dimension "target_app"
            externalNativeBuild {
                cmake {
                    arguments  '-DGCANVAS_WEEX=0', '-DANDROID_STL=c++_shared', '-DGSTANDALONE=1'
                }

                ndk {
                    abiFilters 'armeabi-v7a', 'arm64-v8a'
                }
            }

            packagingOptions {
                exclude '**/libc++_shared.so'
                exclude '**/**/libc++_shared.so'
            }
        }

        ali {
            dimension "target_app"

            externalNativeBuild {
                cmake {
                    arguments  '-DGCANVAS_WEEX=1', '-DANDROID_STL=c++_shared', '-DGSTANDALONE=0'
                }

                ndk {
                    abiFilters 'armeabi-v7a', 'arm64-v8a'
                }
            }

            if (rootProject.extensions.sdks.EXCLUDE_CPP_SHARED) {
                packagingOptions {
                    exclude '**/libc++_shared.so'
                    exclude '**/**/libc++_shared.so'
                }
            }
        }
    }


    externalNativeBuild {
        cmake {
            path file('../../CMakeLists.txt')
        }
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.alibaba:fastjson:1.1.54.android'
}
project.ext.id = rootProject.extensions.artifacts.Core
project.ext.meta.labels = ['Weex', 'ReactNative', 'GPU', 'OpenGL', 'GCanvas', "canvas", 'WebGL', 'Rendering', 'High Performance']
project.ext.meta.description = 'This package defines GCanvas main library.'
apply from: "${rootProject.projectDir}/publish.gradle"

