forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
193 lines (166 loc) · 4.41 KB
/
build.gradle
File metadata and controls
193 lines (166 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
Properties props = new Properties()
props.load(new FileInputStream(new File(project.rootDir, "retroarch.properties")))
props.each { prop ->
project.ext.set(prop.key, prop.value)
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
ndkVersion "22.0.7026061"
flavorDimensions "variant"
defaultConfig {
minSdkVersion 16
externalNativeBuild {
ndkBuild {
arguments "-j${Runtime.runtime.availableProcessors()}"
}
}
targetSdkVersion 28
versionCode System.currentTimeSeconds().toInteger()
versionName "${getManifestAttribute("versionName")}_GIT"
}
productFlavors {
normal {
resValue "string", "app_name", "RetroArch"
buildConfigField "boolean", "PLAY_STORE_BUILD", "false"
dimension "variant"
}
aarch64 {
applicationIdSuffix '.aarch64'
resValue "string", "app_name", "RetroArch (AArch64)"
buildConfigField "boolean", "PLAY_STORE_BUILD", "false"
dimension "variant"
ndk {
abiFilters 'arm64-v8a', 'x86_64'
}
}
ra32 {
applicationIdSuffix '.ra32'
resValue "string", "app_name", "RetroArch (32-bit)"
buildConfigField "boolean", "PLAY_STORE_BUILD", "false"
dimension "variant"
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
}
playStoreNormal {
minSdkVersion 21
targetSdkVersion 35
versionCode getPlayStoreVersionCode()
versionName getPlayStoreVersionName()
resValue "string", "app_name", "RetroArch"
buildConfigField "boolean", "PLAY_STORE_BUILD", "true"
dimension "variant"
}
playStorePlus {
minSdkVersion 26
targetSdkVersion 35
versionCode getPlayStoreVersionCode()
versionName getPlayStoreVersionName()
applicationIdSuffix '.aarch64'
resValue "string", "app_name", "RetroArch Plus"
buildConfigField "boolean", "PLAY_STORE_BUILD", "true"
dimension "variant"
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
assets.srcDirs = ['assets']
java.srcDirs = ['src', '../phoenix-common/src']
jniLibs.srcDir '../phoenix-common/libs'
jni.srcDirs = []
res.srcDirs = ['res', '../phoenix-common/res']
}
normal {
java.srcDirs += ['../play-core-stub']
}
aarch64 {
java.srcDirs += ['../play-core-stub']
res.srcDirs = ['res', 'res64']
}
ra32 {
java.srcDirs += ['../play-core-stub']
}
playStoreNormal {
java.srcDirs += ['../play-core-impl']
}
playStorePlus {
java.srcDirs += ['../play-core-impl']
}
}
externalNativeBuild {
ndkBuild {
path '../phoenix-common/jni/Android.mk'
}
}
signingConfigs {
if (project.hasProperty("RELEASE_STORE_FILE")) {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
if (project.hasProperty("RELEASE_STORE_FILE")) {
release {
signingConfig signingConfigs.release
}
}
else {
release {
signingConfig signingConfigs.debug
}
}
}
}
def playCore = 'com.google.android.play:core:1.10.3'
dependencies {
playStoreNormalImplementation playCore
playStorePlusImplementation playCore
}
def dynamicFeatures = file("dynamic_features.gradle")
if(dynamicFeatures.exists()) {
apply from: "dynamic_features.gradle"
}
int getPlayStoreVersionCode() {
def baseVersion = getManifestAttribute("versionCode").toInteger()
def baseTime = 1609632000
def halfWeek = 302400
def increment = (System.currentTimeSeconds() - baseTime) / halfWeek
return baseVersion + increment
}
String getPlayStoreVersionName() {
def versionName = getManifestAttribute("versionName")
return "$versionName (${new Date().format("yyyy-MM-dd")})"
}
String getManifestAttribute(String attribute) {
def manifest = new XmlParser().parse("${project.projectDir}/AndroidManifest.xml")
return manifest.attributes().find {
((String) it.key).contains(attribute)
}.value
}
tasks.register("outputVersionCode") {
doLast {
println getPlayStoreVersionCode()
}
}