forked from skrugly/mirakle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
63 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
61
62
63
group 'com.instamotor'
version '1.4.3'
buildscript {
ext.kotlin_version = '1.4.32'
repositories {
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.gmazzo:gradle-buildconfig-plugin:3.0.0"
}
}
allprojects {
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: "com.github.gmazzo.buildconfig"
apply plugin: 'maven-publish'
apply plugin: 'signing'
buildConfig {
buildConfigField "String", "VERSION", "\"${rootProject.version}\""
buildConfigField 'List<String>', 'TESTED_GRADLE_VERSIONS', 'listOf("6.5", "6.6", "6.7.1", "7.0", "7.2")'
}
repositories {
mavenCentral()
jcenter()
}
sourceSets {
main {
java {
srcDirs += "${buildDir.absolutePath}/gen/buildconfig/src/main"
}
}
}
}
def gitTag() {
def tag = 'git tag --list --points-at HEAD'.execute((List) null, rootProject.projectDir).text.trim()
if (tag.split(System.lineSeparator()).length > 1) {
throw new IllegalStateException("gitTag is accessed but commit has multiple tags: $tag")
}
return tag
}
def validateTagAndVersion() {
if (gitTag().isEmpty()) {
throw new IllegalStateException('Publishing is not allowed because current commit has no tag')
}
if (version != gitTag().substring(1)) {
throw new IllegalStateException('Publishing is not allowed git tag version != project version')
}
}