apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true'
    }

    sourceSets {
        main {
            manifest.srcFile './ApplicationManifest.xml'
        }
    }
}

apply plugin: SpectrumDownloadAndMergePlugin
import org.apache.tools.ant.filters.ReplaceTokens

downloadAndMergeNativeLibrary {
  externalSourceUri 'https://github.com/google/glog/archive/v0.4.0.tar.gz'
  externalSourceInclude 'glog-0.4.0/src/**/**'
  overrideInclude '**'
  filesMatchingPattern '**/*.h.in'
  filesMatchingAction {
      it.path = (it.name - '.in')
      it.filter(ReplaceTokens, tokens: [
            'ac_cv_have_unistd_h': '1',
            'ac_cv_have_stdint_h': '1',
            'ac_cv_have_systypes_h': '1',
            'ac_cv_have_inttypes_h': '1',
            'ac_cv_have_libgflags': '0',
            'ac_google_start_namespace': 'namespace google {',
            'ac_cv_have_uint16_t': '1',
            'ac_cv_have_u_int16_t': '1',
            'ac_cv_have___uint16': '0',
            'ac_google_end_namespace': '}',
            'ac_cv_have___builtin_expect': '1',
            'ac_google_namespace': 'google',
            'ac_cv___attribute___noinline': '__attribute__ ((noinline))',
            'ac_cv___attribute___noreturn': '__attribute__ ((noreturn))',
            'ac_cv___attribute___printf_4_5': '__attribute__((__format__ (__printf__, 4, 5)))'
      ])
  }
  cacheRevision = 1
}

preBuild.dependsOn {
    prepareNativeLibrary
}

clean.dependsOn {
    cleanNativeLibrary
}
