Skip to content

Commit 76c9092

Browse files
authored
Merge pull request EngineHub#5 from KaspianDev/WG7.0
Upstream
2 parents 17a0d9d + 7a0458d commit 76c9092

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+802
-560
lines changed

.travis.yml

-8
This file was deleted.

buildSrc/build.gradle.kts renamed to build-logic/build.gradle.kts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
plugins {
22
`kotlin-dsl`
3-
kotlin("jvm") version embeddedKotlinVersion
43
}
54

65
repositories {
7-
mavenCentral()
86
gradlePluginPortal()
97
}
108

119
dependencies {
1210
implementation(gradleApi())
13-
implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1")
14-
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2")
15-
implementation("com.github.johnrengelman:shadow:8.1.1")
16-
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:5.2.0")
11+
implementation(libs.licenser)
12+
implementation(libs.grgit)
13+
implementation(libs.shadow)
14+
implementation(libs.jfrog.buildinfo)
15+
implementation(libs.gson)
16+
1717
constraints {
18-
val asmVersion = "[9.7,)"
18+
val asmVersion = "[${libs.versions.minimumAsm.get()},)"
1919
implementation("org.ow2.asm:asm:$asmVersion") {
2020
because("Need Java 21 support in shadow")
2121
}
2222
implementation("org.ow2.asm:asm-commons:$asmVersion") {
2323
because("Need Java 21 support in shadow")
2424
}
25-
implementation("org.vafer:jdependency:[2.10,)") {
25+
implementation("org.vafer:jdependency:[${libs.versions.minimumJdependency.get()},)") {
2626
because("Need Java 21 support in shadow")
2727
}
2828
}

build-logic/settings.gradle.kts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create("libs") {
4+
from(files("../gradle/libs.versions.toml"))
5+
}
6+
}
7+
}
8+
9+
rootProject.name = "build-logic"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
2+
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
3+
4+
plugins {
5+
id("com.jfrog.artifactory")
6+
}
7+
8+
val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
9+
val ARTIFACTORY_USER = "artifactory_user"
10+
val ARTIFACTORY_PASSWORD = "artifactory_password"
11+
12+
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
13+
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
14+
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""
15+
16+
configure<ArtifactoryPluginConvention> {
17+
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
18+
clientConfig.publisher.run {
19+
repoKey = when {
20+
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local"
21+
else -> "libs-release-local"
22+
}
23+
username = "${project.property(ARTIFACTORY_USER)}"
24+
password = "${project.property(ARTIFACTORY_PASSWORD)}"
25+
isMaven = true
26+
isIvy = false
27+
}
28+
}
29+
30+
tasks.named<ArtifactoryTask>("artifactoryPublish") {
31+
isSkip = true
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
plugins {
2+
id("com.jfrog.artifactory")
3+
}
4+
5+
// Artifactory eagerly evaluates publications, so this must run after all changes to artifacts are done
6+
afterEvaluate {
7+
tasks.named<org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask>("artifactoryPublish") {
8+
publications("maven")
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import buildlogic.getLibrary
2+
import buildlogic.stringyLibs
3+
4+
plugins {
5+
id("eclipse")
6+
id("idea")
7+
id("checkstyle")
8+
id("buildlogic.common")
9+
}
10+
11+
tasks
12+
.withType<JavaCompile>()
13+
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
14+
.configureEach {
15+
val disabledLint = listOf(
16+
"processing", "path", "fallthrough", "serial", "overloads",
17+
)
18+
options.release.set(21)
19+
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
20+
options.isDeprecation = true
21+
options.encoding = "UTF-8"
22+
options.compilerArgs.add("-parameters")
23+
//options.compilerArgs.add("-Werror")
24+
}
25+
26+
configure<CheckstyleExtension> {
27+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
28+
toolVersion = "10.16.0"
29+
}
30+
31+
tasks.withType<Test>().configureEach {
32+
useJUnitPlatform()
33+
}
34+
35+
dependencies {
36+
"compileOnly"(stringyLibs.getLibrary("jsr305"))
37+
"testImplementation"(platform(stringyLibs.getLibrary("junit-bom")))
38+
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-api"))
39+
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-params"))
40+
"testRuntimeOnly"(stringyLibs.getLibrary("junit-jupiter-engine"))
41+
}
42+
43+
// Java 8 turns on doclint which we fail
44+
tasks.withType<Javadoc>().configureEach {
45+
options.encoding = "UTF-8"
46+
(options as StandardJavadocDocletOptions).apply {
47+
//addBooleanOption("Werror", true)
48+
addBooleanOption("Xdoclint:all", true)
49+
addBooleanOption("Xdoclint:-missing", true)
50+
tags(
51+
"apiNote:a:API Note:",
52+
"implSpec:a:Implementation Requirements:",
53+
"implNote:a:Implementation Note:"
54+
)
55+
}
56+
}
57+
58+
configure<JavaPluginExtension> {
59+
withJavadocJar()
60+
withSourcesJar()
61+
}
62+
63+
tasks.named("check").configure {
64+
dependsOn("checkstyleMain", "checkstyleTest")
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import buildlogic.getLibrary
2+
import buildlogic.stringyLibs
3+
import org.gradle.plugins.ide.idea.model.IdeaModel
4+
5+
plugins {
6+
id("org.cadixdev.licenser")
7+
}
8+
9+
group = rootProject.group
10+
version = rootProject.version
11+
12+
repositories {
13+
mavenCentral()
14+
maven {
15+
name = "EngineHub"
16+
url = uri("https://maven.enginehub.org/repo/")
17+
}
18+
maven {
19+
name = "devmart-other"
20+
url = uri("https://nexuslite.gcnt.net/repos/other/")
21+
}
22+
}
23+
24+
configurations.all {
25+
resolutionStrategy {
26+
cacheChangingModulesFor(1, TimeUnit.DAYS)
27+
}
28+
}
29+
30+
plugins.withId("java") {
31+
the<JavaPluginExtension>().toolchain {
32+
languageVersion.set(JavaLanguageVersion.of(21))
33+
}
34+
}
35+
36+
dependencies {
37+
for (conf in listOf("implementation", "api")) {
38+
if (!configurations.names.contains(conf)) {
39+
continue
40+
}
41+
add(conf, platform(stringyLibs.getLibrary("log4j-bom")).map {
42+
val dep = create(it)
43+
dep.because("Mojang provides Log4j")
44+
dep
45+
})
46+
constraints {
47+
add(conf, stringyLibs.getLibrary("guava")) {
48+
because("Mojang provides Guava")
49+
}
50+
add(conf, stringyLibs.getLibrary("gson")) {
51+
because("Mojang provides Gson")
52+
}
53+
add(conf, stringyLibs.getLibrary("fastutil")) {
54+
because("Mojang provides FastUtil")
55+
}
56+
}
57+
}
58+
}
59+
60+
license {
61+
header(rootProject.file("HEADER.txt"))
62+
include("**/*.java")
63+
include("**/*.kt")
64+
}
65+
66+
plugins.withId("idea") {
67+
configure<IdeaModel> {
68+
module {
69+
isDownloadSources = true
70+
isDownloadJavadoc = true
71+
}
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
plugins {
2+
id("java")
3+
id("maven-publish")
4+
id("buildlogic.common-java")
5+
id("buildlogic.artifactory-sub")
6+
}
7+
8+
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
9+
10+
publishing {
11+
publications {
12+
register<MavenPublication>("maven") {
13+
versionMapping {
14+
usage("java-api") {
15+
fromResolutionOf("runtimeClasspath")
16+
}
17+
usage("java-runtime") {
18+
fromResolutionResult()
19+
}
20+
}
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)