This repository was archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
175 lines (152 loc) · 4.91 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
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
plugins {
java
kotlin("jvm") version "1.7.10"
}
val coreVersion = "Yu-Core:0.2.0.0-DEV26"
allprojects {
version = "0.0.2.0-DEV28"
val dir = projectDir.absolutePath.split(File.separator)
val l2 = dir[dir.size - 2]
group = if (name == "SmartWeb") "com.IceCreamQAQ"
else if (l2 == "TempleEngine") "com.IceCreamQAQ.SmartWeb.Temple"
else if (l2 == "WebServer") "com.IceCreamQAQ.SmartWeb.Server"
else "com.IceCreamQAQ.Yu.WebCore"
repositories {
mavenLocal()
maven("https://maven.icecreamqaq.com/repository/maven-public/")
}
pluginManager.apply(JavaLibraryPlugin::class.java)
pluginManager.apply(MavenPublishPlugin::class.java)
java {
withSourcesJar()
}
configure<PublishingExtension> {
publications {
create<MavenPublication>(name) {
groupId = project.group.toString()
artifactId = name
version = version.toString()
pom {
name.set("Rain Java Dev Framework")
description.set("Rain Java Dev Framework")
url.set("https://github.com/IceCream-Open/Rain")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("IceCream")
name.set("IceCream")
email.set("[email protected]")
}
}
scm {
connection.set("")
}
}
from(components["java"])
}
}
repositories {
mavenLocal()
maven {
val snapshotsRepoUrl = "https://maven.icecreamqaq.com/repository/maven-snapshots/"
val releasesRepoUrl = "https://maven.icecreamqaq.com/repository/maven-releases/"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
val mvnInfo = readMavenUserInfo("IceCream")
username = mvnInfo[0]
password = mvnInfo[1]
}
}
}
}
dependencies {
implementation("com.IceCreamQAQ:$coreVersion")
}
}
dependencies {
implementation(kotlin("stdlib"))
}
java {
withSourcesJar()
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
//publishing {
//
// publications {
// create<MavenPublication>(name) {
// groupId = group.toString()
// artifactId = name
// version = project.version.toString()
//
// pom {
// name.set("Rain Java Dev Framework")
// description.set("Rain Java Dev Framework")
// url.set("https://github.com/IceCream-Open/Rain")
// licenses {
// license {
// name.set("The Apache License, Version 2.0")
// url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
// }
// }
// developers {
// developer {
// id.set("IceCream")
// name.set("IceCream")
// email.set("[email protected]")
// }
// }
// scm {
// connection.set("")
// }
// }
// from(components["java"])
// }
// }
//
// repositories {
// mavenLocal()
// maven {
// val snapshotsRepoUrl = "https://maven.icecreamqaq.com/repository/maven-snapshots/"
// val releasesRepoUrl = "https://maven.icecreamqaq.com/repository/maven-releases/"
// url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
//
//
// credentials {
//
// val mvnInfo = readMavenUserInfo("IceCream")
// username = mvnInfo[0]
// password = mvnInfo[1]
// }
// }
// }
//
//}
fun readMavenUserInfo(id: String) =
fileOr(
"mavenInfo.txt",
"${System.getProperty("user.home")}/.m2/mvnInfo-$id.txt"
)?.readText()?.split("|") ?: arrayListOf("", "")
fun File.check() = if (this.exists()) this else null
fun fileOr(vararg file: String): File? {
for (s in file) {
val f = file(s)
if (f.exists()) return f
}
return null
}