build.gradle 4.16 KB
Newer Older
Lee Jaebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.ajoberstar:gradle-git:0.12+'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation project(':ABVJE_UI_Android')
16
    implementation 'com.android.support:multidex:1.0.3'
Lee Jaebin committed
17 18 19
}

android {
20
    compileSdkVersion 26
21
    buildToolsVersion '28.0.3'
Lee Jaebin committed
22 23

    defaultConfig {
24
        minSdkVersion 23
Lee Jaebin committed
25 26 27 28 29 30 31 32
        multiDexEnabled true

        // from gradle.properties
        applicationId app_custompackagename
        versionCode app_versioncode as int;
        versionName version_name

        buildConfigField("boolean", "isStoreProduct", "${isStoreProduct}")
Lee Jaebin committed
33
        manifestPlaceholders = [HOME_APP: "android.intent.category.DEFAULT"]
Lee Jaebin committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
    }

    dexOptions {
        preDexLibraries = true
        jumboMode = true
        javaMaxHeapSize "2g"
    }
    signingConfigs {
        release {
            storeFile file(keystore)
            storePassword keystorepassword
            keyAlias keyalias
            keyPassword keyaliaspassword
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['res']
            aidl.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
    lintOptions {
        quiet true
        checkReleaseBuilds false
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'values/attrs.xml'
        exclude 'values/dimens.xml'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
    }

    flavorDimensions "default" // OK
    productFlavors {

        if (isStoreProduct.toBoolean()) {
            armv7 {
                versionCode defaultConfig.versionCode
                ndk {
92
                    abiFilters "armeabi-v7a", "x86", ""
Lee Jaebin committed
93 94
                }
            }
95 96

            armv8 {
Lee Jaebin committed
97 98
                versionCode defaultConfig.versionCode + 1
                ndk {
99 100 101 102 103 104 105
                    abiFilters "arm64-v8a", ""
                }
            }

            x86 {
                versionCode defaultConfig.versionCode + 2
                ndk {
Lee Jaebin committed
106 107 108
                    abiFilters "x86", ""
                }
            }
109 110 111 112 113 114 115 116

            x86_64 {
                versionCode defaultConfig.versionCode + 3
                ndk {
                    abiFilters "x86_64", ""
                }
            }

Lee Jaebin committed
117 118 119 120 121 122 123 124 125 126
            // 容量が大きいため、コメントアウト
//            x86_armv7 {
//                ndk {
//                    abiFilters "x86", "armeabi-v7a", ""
//                }
//            }
        } else {
            armv7 {
                versionCode defaultConfig.versionCode
                ndk {
127
                    abiFilters "armeabi-v7a", "x86", ""
Lee Jaebin committed
128 129
                }
            }
130 131 132 133 134 135
            armv8 {
                versionCode defaultConfig.versionCode + 1
                ndk {
                    abiFilters "arm64-v8a", ""
                }
            }
Lee Jaebin committed
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
        }
    }
}

import org.ajoberstar.grgit.*
task gitInfo << {
    description 'update githash.txt with current hash'
    def grgit = Grgit.open(project.file('..'))
    def gitfile=file('assets/githash.txt')
    gitfile.write grgit.head().id
}
preBuild.dependsOn gitInfo

task convertToPackage << {
    description 'convert to package for google-services.json'
    def appModuleRootFolder = '.'
    def googleServicesJson = 'google-services.json'
    copy {
        from "fcm"
        include "$googleServicesJson"
        into "$appModuleRootFolder"
        expand PACKAGE_NAME : app_custompackagename
    }
}
preBuild.dependsOn convertToPackage

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.encoding = "UTF-8"
        options.compilerArgs << "-Xlint:unchecked" <<  "-Xlint:deprecation"
    }
}