-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
60 lines (50 loc) · 1.58 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
buildscript {
apply from: "$rootDir/gradle/dependencies.gradle"
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath ClassPaths_gradle
classpath ClassPaths_kotlin
classpath ClassPaths_dokka
classpath ClassPaths_benManesVersions
}
}
apply from: "$rootDir/gradle/dokka-multimodule.gradle"
apply from: "$rootDir/gradle/updates.gradle"
allprojects {
project.ext {
libVersion = "0.1.0"
libVersionCode = generateVersionCode(libVersion)
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven {
url "https://maven.pkg.github.com/malloth/latte"
credentials {
username System.getenv("GITHUB_USER")
password System.getenv("GITHUB_TOKEN")
}
}
}
}
static def generateVersionCode(String versionName) {
String[] majorMinorPatch = versionName.split('-').first().split('\\.')
int major = majorMinorPatch.getAt(0).toInteger()
if (major > 99) {
throw new GradleException("Major version of application $major can not be higher than 99")
}
int minor = majorMinorPatch.getAt(1).toInteger()
if (minor > 99) {
throw new GradleException("Minor version of application $minor can not be higher than 99")
}
int patch = majorMinorPatch.getAt(2).toInteger()
if (patch > 9) {
throw new GradleException("Patch (hotfix) version $patch can not be higher than 9")
}
return major * 1000 + minor * 10 + patch
}