move to j16/gradle7

This commit is contained in:
wagyourtail 2021-06-23 11:24:22 -06:00
parent de42109771
commit f0130c7199
No known key found for this signature in database
GPG Key ID: E6E3EB7DCD4EB017
9 changed files with 108 additions and 74 deletions

31
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,31 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Minecraft Client",
"request": "launch",
"cwd": "${workspaceFolder}/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "net.fabricmc.devlaunchinjector.Main",
"vmArgs": "-Dfabric.dli.config\u003dC:\\Users\\ruwag\\Documents\\Baritone\\.gradle\\loom-cache\\launch.cfg -Dfabric.dli.env\u003dclient -Dfabric.dli.main\u003dnet.fabricmc.loader.launch.knot.KnotClient",
"args": "",
"env": {},
"projectName": ""
},
{
"type": "java",
"name": "Minecraft Server",
"request": "launch",
"cwd": "${workspaceFolder}/run",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "net.fabricmc.devlaunchinjector.Main",
"vmArgs": "-Dfabric.dli.config\u003dC:\\Users\\ruwag\\Documents\\Baritone\\.gradle\\loom-cache\\launch.cfg -Dfabric.dli.env\u003dserver -Dfabric.dli.main\u003dnet.fabricmc.loader.launch.knot.KnotServer",
"args": "nogui",
"env": {},
"projectName": ""
}
]
}

View File

@ -14,46 +14,24 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
buildscript {
repositories {
mavenCentral()
maven { url "https://maven.architectury.dev/" }
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
url = 'https://www.dogforce-games.com/maven/'
}
maven {
url = 'https://maven.fabricmc.net/'
}
maven {
url = 'https://libraries.minecraft.net/'
}
}
dependencies {
classpath group: 'me.shedaniel', name: 'forgified-fabric-loom', version: '0.7.0-SNAPSHOT'
}
plugins {
id 'java'
id 'dev.architectury.loom' version '0.8.0-SNAPSHOT'
id 'maven-publish'
}
group 'baritone'
version '1.6.3'
group 'baritone'
version '1.7.0'
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
def compileType = project.hasProperty("baritone.fabric_build") ? "FABRIC" : project.hasProperty("baritone.forge_build") ? "FORGE" : "OFFICIAL"
apply plugin: 'java'
apply plugin: 'forgified-fabric-loom'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = "UTF-8" // allow emoji in comments :^)
@ -74,11 +52,9 @@ sourceSets {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
schematica_api {
compileClasspath += main.compileClasspath
}
main {
compileClasspath += schematica_api.output
}
@ -88,20 +64,11 @@ loom {
mixinConfig 'mixins.baritone.json'
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.api.allSource
}
minecraft {}
minecraft.refmapName = "mixins.baritone.refmap.json"
repositories {
mavenCentral()
maven {
name = 'SpongePowered'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
@ -109,6 +76,7 @@ repositories {
maven {
url = 'https://www.dogforce-games.com/maven/'
}
mavenCentral()
}
dependencies {
@ -116,7 +84,7 @@ dependencies {
forge "net.minecraftforge:forge:1.16.5-36.1.0"
}
minecraft "com.mojang:minecraft:1.16.5"
mappings "de.oceanlabs.mcp:mcp_snapshot:20201028-1.16.3"
mappings minecraft.officialMojangMappings()
if (!compileType.equals("FORGE")) {
modImplementation "net.fabricmc:fabric-loader:0.9.1+build.205"
}

View File

@ -20,6 +20,6 @@ repositories {
}
dependencies {
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
}

View File

@ -99,7 +99,7 @@ class BaritoneGradleTask extends DefaultTask {
}
protected Path getRelativeFile(String file) {
return Paths.get(new File(file).getAbsolutePath());
return Paths.get(new File(getProject().getBuildDir(), file).getAbsolutePath());
}
protected Path getTemporaryFile(String file) {
@ -107,6 +107,6 @@ class BaritoneGradleTask extends DefaultTask {
}
protected Path getBuildFile(String file) {
return getRelativeFile("build/libs/" + file);
return getRelativeFile("libs/" + file);
}
}

View File

@ -19,7 +19,7 @@ package baritone.gradle.task;
import org.gradle.api.tasks.TaskAction;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
@ -93,10 +93,22 @@ public class CreateDistTask extends BaritoneGradleTask {
if (SHA1_DIGEST == null) {
SHA1_DIGEST = MessageDigest.getInstance("SHA-1");
}
return DatatypeConverter.printHexBinary(SHA1_DIGEST.digest(Files.readAllBytes(path))).toLowerCase();
return bytesToHex(SHA1_DIGEST.digest(Files.readAllBytes(path))).toLowerCase();
} catch (Exception e) {
// haha no thanks
throw new IllegalStateException(e);
}
}
private static final byte[] HEX_ARRAY = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
public static String bytesToHex(byte[] bytes) {
byte[] hexChars = new byte[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars, StandardCharsets.UTF_8);
}
}

View File

@ -22,28 +22,15 @@ import org.apache.commons.io.IOUtils;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.JavaVersion;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.internal.file.IdentityFileResolver;
import org.gradle.api.internal.plugins.DefaultConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.TaskCollection;
import org.gradle.api.tasks.compile.ForkOptions;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.internal.Pair;
import org.gradle.internal.jvm.Jvm;
import org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector;
import org.gradle.process.internal.DefaultExecActionFactory;
import java.io.*;
import java.net.URL;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
@ -61,12 +48,24 @@ public class ProguardTask extends BaritoneGradleTask {
@Input
private String url;
public String getUrl() {
return url;
}
@Input
private String extract;
public String getExtract() {
return extract;
}
@Input
private String compType;
public String getCompType() {
return compType;
}
private final File copyMcTargetDir = new File("./build/createMcIntermediaryJar").getAbsoluteFile();
private final File copyMcTargetJar = new File(copyMcTargetDir, "client.jar");
@ -216,15 +215,16 @@ public class ProguardTask extends BaritoneGradleTask {
}
private boolean validateJavaVersion(String java) {
final JavaVersion javaVersion = new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())).getJavaVersion(java);
if (!javaVersion.getMajorVersion().equals("8")) {
System.out.println("Failed to validate Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
// throw new RuntimeException("Java version incorrect: " + javaVersion.getMajorVersion() + " for " + java);
return false;
}
System.out.println("Validated Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
//TODO: fix for j16
// final JavaVersion javaVersion = new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())).getJavaVersion(java);
//
// if (!javaVersion.getMajorVersion().equals("8")) {
// System.out.println("Failed to validate Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
// // throw new RuntimeException("Java version incorrect: " + javaVersion.getMajorVersion() + " for " + java);
// return false;
// }
//
// System.out.println("Validated Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
return true;
}

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Tue Jul 31 21:56:56 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

View File

@ -15,5 +15,29 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
rootProject.name = 'baritone'
pluginManagement {
repositories {
maven { url "https://maven.architectury.dev/" }
maven {
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'forge'
url = 'https://files.minecraftforge.net/maven'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
url = 'https://www.dogforce-games.com/maven/'
}
maven {
url = 'https://libraries.minecraft.net/'
}
mavenCentral()
}
}
rootProject.name = 'baritone'