1apply plugin: 'com.android.application'
2
3android {
4    compileSdkVersion 30
5
6    compileOptions {
7        sourceCompatibility JavaVersion.VERSION_1_8
8        targetCompatibility JavaVersion.VERSION_1_8
9    }
10
11    lintOptions {
12        // This is important as it will run lint but not abort on error
13        // Lint has some overly obnoxious "errors" that should really be warnings
14        abortOnError false
15
16        //Uncomment disable lines for test builds...
17        //disable 'MissingTranslation'
18        //disable 'ExtraTranslation'
19    }
20
21    defaultConfig {
22        // TODO If this is ever modified, change application_id in strings.xml
23        applicationId "org.dolphinemu.dolphinemu"
24        minSdkVersion 21
25        targetSdkVersion 29
26
27        versionCode(getBuildVersionCode())
28
29        versionName "${getVersion()}"
30    }
31
32    signingConfigs {
33        release {
34            if (project.hasProperty('keystore')) {
35                storeFile file(project.property('keystore'))
36                storePassword project.property('storepass')
37                keyAlias project.property('keyalias')
38                keyPassword project.property('keypass')
39            }
40        }
41    }
42
43    // Define build types, which are orthogonal to product flavors.
44    buildTypes {
45        // Signed by release key, allowing for upload to Play Store.
46        release {
47            signingConfig signingConfigs.release
48        }
49
50        // Signed by debug key disallowing distribution on Play Store.
51        // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
52        debug {
53            // TODO If this is ever modified, change application_id in debug/strings.xml
54            applicationIdSuffix ".debug"
55            versionNameSuffix '-debug'
56            jniDebuggable true
57        }
58    }
59
60    externalNativeBuild {
61        cmake {
62            path "../../../CMakeLists.txt"
63            version "3.10.2"
64        }
65    }
66
67    defaultConfig {
68        externalNativeBuild {
69            cmake {
70                arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
71                // , "-DENABLE_GENERIC=ON"
72                abiFilters "arm64-v8a", "x86_64" //, "armeabi-v7a", "x86"
73            }
74        }
75    }
76}
77
78dependencies {
79    implementation 'androidx.appcompat:appcompat:1.1.0'
80    implementation 'androidx.exifinterface:exifinterface:1.1.0'
81    implementation 'androidx.cardview:cardview:1.0.0'
82    implementation 'androidx.recyclerview:recyclerview:1.1.0'
83    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
84    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
85    implementation 'com.google.android.material:material:1.1.0'
86
87    // Android TV UI libraries.
88    implementation 'androidx.leanback:leanback:1.0.0'
89    implementation 'androidx.tvprovider:tvprovider:1.0.0'
90
91    // For REST calls
92    implementation 'com.android.volley:volley:1.1.1'
93
94    // For loading huge screenshots from the disk.
95    implementation 'com.squareup.picasso:picasso:2.71828'
96
97    implementation 'com.nononsenseapps:filepicker:4.2.1'
98}
99
100def getVersion() {
101    def versionNumber = '0.0'
102
103    try {
104        versionNumber = 'git describe --always --long'.execute([], project.rootDir).text
105                .trim()
106                .replaceAll(/(-0)?-[^-]+$/, "")
107    } catch (Exception e) {
108        logger.error('Cannot find git, defaulting to dummy version number')
109    }
110
111    return versionNumber
112}
113
114
115def getBuildVersionCode() {
116    try {
117        def versionNumber = 'git rev-list --first-parent --count HEAD'.execute([], project.rootDir).text
118                .trim()
119        return Integer.valueOf(versionNumber);
120    } catch (Exception e) {
121        logger.error('Cannot find git, defaulting to dummy version number')
122    }
123
124    return 1;
125}
126