Make Gradle build VanillaGradle from source
Also: update Gradle to 8.12
This commit is contained in:
6 files changed
+38
-19
No files matched your search
@@ -2,3 +2,7 @@
|
||||
path = SpongeAPI
|
||||
url = https://github.com/SKBotNL/SpongeAPI-CTS.git
|
||||
branch = api-8
|
||||
[submodule "VanillaGradle"]
|
||||
path = VanillaGradle
|
||||
url = https://github.com/SKBotNL/VanillaGradle-CTS.git
|
||||
branch = master
|
||||
Submodule
+1
Submodule VanillaGradle added at 09022689d0.
+14
-10
@@ -34,16 +34,12 @@ import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.component.ComponentIdentifier;
|
||||
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
|
||||
import org.gradle.api.artifacts.result.ResolvedArtifactResult;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.provider.MapProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.provider.SetProperty;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.Nested;
|
||||
import org.gradle.api.tasks.Optional;
|
||||
import org.gradle.api.tasks.OutputFile;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.api.tasks.*;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileInputStream;
|
||||
@@ -52,6 +48,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Comparator;
|
||||
@@ -161,10 +158,17 @@ public abstract class OutputDependenciesToJson extends DefaultTask {
|
||||
* Excludes configuration, to remove certain entries from dependencies and
|
||||
* transitive dependencies of {@link #getDependencies()}.
|
||||
*/
|
||||
@Input
|
||||
@Optional
|
||||
@Internal
|
||||
public abstract Property<Configuration> getExcludedDependencies();
|
||||
|
||||
@Classpath
|
||||
@Optional
|
||||
public FileCollection getExcludedDependencyArtifacts() {
|
||||
return getExcludedDependencies()
|
||||
.map(config -> (FileCollection) config)
|
||||
.getOrElse(getProject().files());
|
||||
}
|
||||
|
||||
public final void excludedDependencies(final NamedDomainObjectProvider<Configuration> config) {
|
||||
this.getExcludedDependencies().set(config);
|
||||
}
|
||||
@@ -204,7 +208,7 @@ public abstract class OutputDependenciesToJson extends DefaultTask {
|
||||
this.getLogger().info("Writing to {}", this.getOutputFile().get().getAsFile());
|
||||
try (
|
||||
final BufferedWriter writer = new BufferedWriter(
|
||||
new OutputStreamWriter(new FileOutputStream(this.getOutputFile().get().getAsFile()), StandardCharsets.UTF_8))
|
||||
new OutputStreamWriter(Files.newOutputStream(this.getOutputFile().get().getAsFile().toPath()), StandardCharsets.UTF_8))
|
||||
) {
|
||||
OutputDependenciesToJson.GSON.toJson(manifest, writer);
|
||||
} catch (final IOException ex) {
|
||||
@@ -224,7 +228,7 @@ public abstract class OutputDependenciesToJson extends DefaultTask {
|
||||
|
||||
// Get file input stream for reading the file content
|
||||
final String md5hash;
|
||||
try (final InputStream in = new FileInputStream(dependency.getFile())) {
|
||||
try (final InputStream in = Files.newInputStream(dependency.getFile().toPath())) {
|
||||
final MessageDigest hasher = MessageDigest.getInstance("MD5");
|
||||
final byte[] buf = new byte[4096];
|
||||
int read;
|
||||
|
||||
+4
-5
@@ -1,5 +1,4 @@
|
||||
import org.spongepowered.gradle.vanilla.task.DecompileJarTask
|
||||
import java.util.Locale
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
@@ -31,7 +30,7 @@ val junitVersion: String by project
|
||||
val mockitoVersion: String by project
|
||||
val checkerVersion: String by project
|
||||
|
||||
val commonManifest = the<JavaPluginConvention>().manifest {
|
||||
val commonManifest = the<JavaPluginExtension>().manifest {
|
||||
attributes(
|
||||
"Specification-Title" to "Sponge",
|
||||
"Specification-Vendor" to "SpongePowered",
|
||||
@@ -247,7 +246,7 @@ allprojects {
|
||||
apply(plugin = "net.kyori.indra.licenser.spotless")
|
||||
|
||||
base {
|
||||
archivesBaseName = name.toLowerCase(Locale.ENGLISH)
|
||||
archivesName.set(name.lowercase())
|
||||
}
|
||||
|
||||
plugins.withId("nl.skbotnl.sponge.gradle.vanilla") {
|
||||
@@ -280,7 +279,7 @@ allprojects {
|
||||
delegateBuildRunToGradle = false
|
||||
testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
|
||||
}
|
||||
(this as ExtensionAware).extensions.getByType(org.jetbrains.gradle.ext.IdeaCompilerConfiguration::class).run {
|
||||
this.extensions.getByType(org.jetbrains.gradle.ext.IdeaCompilerConfiguration::class).run {
|
||||
addNotNullAssertions = false
|
||||
useReleaseOption = JavaVersion.current().isJava10Compatible
|
||||
parallelCompilation = true
|
||||
@@ -431,7 +430,7 @@ publishing {
|
||||
artifact(tasks["mixinsSourceJar"])
|
||||
artifact(tasks["accessorsSourceJar"])
|
||||
pom {
|
||||
artifactId = project.name.toLowerCase()
|
||||
artifactId = project.name.lowercase()
|
||||
this.name.set(project.name)
|
||||
this.description.set(project.description)
|
||||
this.url.set(projectUrl)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+14
-3
@@ -1,6 +1,17 @@
|
||||
import org.spongepowered.gradle.vanilla.repository.MinecraftRepositoryExtension
|
||||
|
||||
pluginManagement {
|
||||
if (!file("VanillaGradle/gradle.properties").exists()) {
|
||||
throw InvalidUserDataException("""
|
||||
The SpongeAPI submodule required to build does not appear to be set up.
|
||||
|
||||
To correct this, run
|
||||
git submodule update --init --recursive
|
||||
from the project's checkout directory.
|
||||
""".trimIndent())
|
||||
}
|
||||
includeBuild("VanillaGradle")
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("https://repo.spongepowered.org/repository/maven-public/") {
|
||||
@@ -10,7 +21,7 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
// Default plugin versions
|
||||
id("nl.skbotnl.sponge.gradle.vanilla") version "0.2.1-SNAPSHOT"
|
||||
id("nl.skbotnl.sponge.gradle.vanilla")
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id("org.spongepowered.gradle.sponge.dev") version "2.1.1"
|
||||
id("net.kyori.indra.licenser.spotless") version "3.0.1"
|
||||
@@ -55,7 +66,7 @@ if (!file("SpongeAPI/gradle.properties").exists()) {
|
||||
includeBuild("build-logic")
|
||||
includeBuild("SpongeAPI") {
|
||||
dependencySubstitution {
|
||||
substitute(module("org.spongepowered:spongeapi")).with(project(":"))
|
||||
substitute(module("org.spongepowered:spongeapi")).using(project(":"))
|
||||
}
|
||||
}
|
||||
include(":SpongeVanilla")
|
||||
@@ -115,7 +126,7 @@ if (apiProps.exists()) {
|
||||
if (key.startsWith("api")) {
|
||||
extraProperties[key] = value
|
||||
} else {
|
||||
extraProperties["api${key.capitalize()}"] = value
|
||||
extraProperties["api${key.replaceFirstChar { it.uppercase() }}"] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user