This repository has been archived by the owner on Jun 2, 2022. It is now read-only.
forked from Mishiranu/Dashchan
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
183 lines (150 loc) · 5.65 KB
/
build.gradle
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
buildscript {
repositories {
jcenter()
google()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.trevjonez.AndroidGithubReleasePlugin:plugin:1.2.2'
}
}
plugins {
id 'com.gladed.androidgitversion' version '0.4.10'
}
allprojects {
repositories {
jcenter()
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.trevjonez.AndroidGithubReleasePlugin'
dependencies {
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
compileOnly 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
implementation 'androidx.browser:browser:1.2.0'
implementation 'io.noties.markwon:core:4.4.0'
implementation 'com.google.android.exoplayer:exoplayer:2.11.5'
implementation project(":player-lib")
}
def privateProperties = new Properties()
if (file('private.properties').exists()) {
privateProperties.load(new FileInputStream(file('private.properties')))
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
sourceSets.main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'src-api', 'src-external']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jni.srcDirs = []
jniLibs.srcDir 'libs'
}
if (file('keystore.properties').exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(file('keystore.properties')))
signingConfigs {
general {
storeFile file(keystoreProperties['store.file'])
storePassword keystoreProperties['store.password']
keyAlias keystoreProperties['key.alias']
keyPassword keystoreProperties['key.password']
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes.debug.signingConfig signingConfigs.general
buildTypes.release.signingConfig signingConfigs.general
}
defaultConfig {
applicationId "com.f77.dashchan"
versionName androidGitVersion.name()
versionCode androidGitVersion.code()
def apiKeyGoogle = privateProperties['api.key.google']
def apiKeySoundCloud = privateProperties['api.key.soundcloud']
if (apiKeyGoogle == null) apiKeyGoogle = ''
if (apiKeySoundCloud == null) apiKeySoundCloud = ''
buildConfigField 'String', 'API_KEY_GOOGLE', '"' + apiKeyGoogle + '"'
buildConfigField 'String', 'API_KEY_SOUNDCLOUD', '"' + apiKeySoundCloud + '"'
buildConfigField 'long', 'BUILD_TIMESTAMP', System.currentTimeMillis() + 'L'
minSdkVersion 16
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 25
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
abortOnError false
disable 'MissingTranslation', 'ValidFragment', 'ResourceType'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
// Github releases.
if (file('github.properties').exists()) {
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(file('github.properties')))
GithubApi {
owner githubProperties['github.owner']
repo githubProperties['github.repo']
authToken githubProperties['github.api.key']
}
AndroidGithubRelease {
defaultConfig {
tagName androidGitVersion.name()
}
androidConfigs {
debug {
assets 'build/outputs/apk/debug/' + project.name + '-debug.apk'
releaseName androidGitVersion.name()
// allows release meta data to be updated, existing binaries must be manually deleted prior to re-upload.
overwrite true
// default: false, flags the github release as a pre-release.
preRelease true
// (Transformer<String, String>) optional, transformer for dynamic tag naming based on combined configuration.
tagModifier { it + "-DEBUG" } // "1.0.0-DEBUG"
}
release {
assets 'build/outputs/apk/release/' + project.name + '-release.apk'
releaseName androidGitVersion.name()
// allows release meta data to be updated, existing binaries must be manually deleted prior to re-upload.
overwrite true
// default: false, flags the github release as a draft
draft false
}
}
}
}
def getNdkBuildCommand() {
def ndkDir = System.env.ANDROID_NDK_HOME
if (ndkDir == null && file('local.properties').exists()) {
Properties localProperties = new Properties()
localProperties.load(new FileInputStream(file('local.properties')))
ndkDir = localProperties.getProperty('ndk.dir')
}
def windows = org.gradle.internal.os.OperatingSystem.current().isWindows()
return (ndkDir != null ? ndkDir + File.separator : '') + 'ndk-build' + (windows ? '.cmd' : '')
}
task ndkBuildCompile(type: Exec) {
commandLine getNdkBuildCommand(), '-C', file('.').absolutePath
}
task ndkBuildClean(type: Exec) {
commandLine getNdkBuildCommand(), 'clean', file('.').absolutePath
}
tasks.withType(JavaCompile) { compileTask ->
compileTask.dependsOn ndkBuildCompile
}
clean.dependsOn ndkBuildClean