-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
131 lines (115 loc) · 3.41 KB
/
build.gradle.kts
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
import moe.nikky.counter.CounterExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import plugin.generateconstants.GenerateConstantsTask
plugins {
`maven-publish`
application
idea
`java-library`
// id("constantsGenerator")
kotlin("jvm") version Kotlin.version
kotlin("kapt") version Kotlin.version
id("moe.nikky.persistentCounter") version "0.0.7-SNAPSHOT"
}
idea {
module {
excludeDirs.add(file("run"))
}
}
//base {
// archivesBaseName = "fiber-gradle"
//}
val major = Constants.major
val minor = Constants.minor
val patch = Constants.patch
counter {
variable(id = "buildnumber", key = "$major.$minor.$patch")
}
val counter: CounterExtension = extensions.getByType()
val buildnumber = counter.get("buildnumber")
val versionSuffix = System.getenv("BUILD_NUMBER")?.let { "$buildnumber" } ?: "dev"
allprojects {
group = Constants.group
description = Constants.description
version = "$major.$minor.$patch-$versionSuffix"
repositories {
mavenLocal()
maven(url = "https://kotlin.bintray.com/kotlinx") {
name = "kotlinx"
}
mavenCentral()
jcenter()
}
apply {
plugin("java-library")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
val kotlinProjects = listOf(
project(":extractor"),
project(":plugin")
)
subprojects {
if(this in kotlinProjects) {
apply {
plugin("constantsGenerator")
plugin("kotlin")
}
configure<ConstantsExtension> {
constantsObject(
pkg = "fiber",
className = project.name
.split("-")
.joinToString("") {
it.capitalize()
} + "Constants"
) {
field("BUILD_NUMBER") value buildnumber
field("MAJOR_VERSION") value major
field("MINOR_VERSION") value minor
field("PATCH_VERSION") value patch
field("VERSION") value "$major.$minor.$patch"
field("FULL_VERSION") value project.version as String
}
}
val generateConstants by tasks.getting(GenerateConstantsTask::class) {
kotlin.sourceSets["main"].kotlin.srcDir(outputFolder)
}
// TODO depend on kotlin tasks in the plugin
tasks.withType<KotlinCompile> {
dependsOn(generateConstants)
}
}
apply {
plugin("maven-publish")
}
publishing {
repositories {
maven(url = "http://mavenupload.modmuss50.me/") {
val mavenPass: String? = project.properties["mavenPass"] as String?
mavenPass?.let {
credentials {
username = "buildslave"
password = mavenPass
}
}
}
}
}
}
application {
mainClassName = "config.Main"
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":annotations"))
api(group = "io.github.microutils", name = "kotlin-logging", version = Versions.kotlinLogging)
implementation(group = "ch.qos.logback", name = "logback-classic", version = Versions.logbackClassic)
kapt(project(":processor"))
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}