-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
91 lines (76 loc) · 2.46 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
import java.util.Properties
import java.net.URI
val localProperties = Properties()
localProperties.load(project.rootProject.file("local.properties").inputStream())
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
kotlin("jvm") version "1.7.21"
kotlin("kapt") version "1.7.21"
`maven-publish`
idea
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.6"
}
repositories {
mavenLocal()
mavenCentral()
}
allprojects {
group = "net.wirlie"
val artifactVersion = System.getenv("ARTIFACT_VERSION") ?: "2.0.0-BETA4"
val artifactSnapshot = (System.getenv("ARTIFACT_PUBLISH_SNAPSHOT") ?: "true") == "true"
version = if(artifactSnapshot) "$artifactVersion-SNAPSHOT" else artifactVersion
}
configure(subprojects.filter { !it.name.contains("-API") }) {
apply(plugin = "com.github.johnrengelman.shadow")
}
subprojects {
apply(plugin = "kotlin")
apply(plugin = "kotlin-kapt")
apply(plugin = "maven-publish")
repositories {
mavenLocal()
mavenCentral()
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = "11"
targetCompatibility = "11"
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
}
}
// Only add Publishing task to -API projects
configure(subprojects.filter { it.name.contains("-API") }) {
val subProject = this
publishing {
publications {
create<MavenPublication>("maven") {
artifact("$rootDir/compiled-api/${subProject.name}-${subProject.version}.jar") {
extension = "jar"
}
}
}
repositories {
val artifactSnapshot = (System.getenv("ARTIFACT_PUBLISH_SNAPSHOT") != null)
// Nexus
maven {
name = "nexus"
url = if(artifactSnapshot) URI("https://nexus.wirlie.net/repository/public-snapshots/") else URI("https://nexus.wirlie.net/repository/public-releases/")
credentials {
username = localProperties.getProperty("nexus-user-publish")
password = localProperties.getProperty("nexus-pass-publish")
}
}
}
}
}
// Clean, remove compiled folder
tasks.register("cleanCompiledArtifactsFolder") {
val folder = project.rootProject.file("compiled")
if(folder.exists()) {
folder.deleteRecursively()
}
}