Scheme-a-version

- Fix Resources not being closed properly
- Change versioning scheme to match Create
- Add LICENSE to built jar
- Fix mods.toml version sync
- Move JOML code to non-src directory
- Update Gradle
- Organize imports
This commit is contained in:
PepperCode1 2022-07-15 00:00:54 -07:00
parent 0a671b8f43
commit a42c027b6f
95 changed files with 50 additions and 56 deletions

View file

@ -11,10 +11,10 @@ buildscript {
classpath "org.parchmentmc:librarian:${librarian_version}" classpath "org.parchmentmc:librarian:${librarian_version}"
} }
} }
plugins { plugins {
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
} }
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
@ -24,11 +24,10 @@ apply plugin: 'org.spongepowered.mixin'
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false');
ext.buildNumber = System.getenv('BUILD_NUMBER') ext.buildNumber = System.getenv('BUILD_NUMBER')
if (buildNumber == null) buildNumber = 'custom'
version = "${mc_update_version}-${mod_version}" + (dev ? ".${buildNumber}" : '')
group = 'com.jozufozu.flywheel' group = 'com.jozufozu.flywheel'
archivesBaseName = 'flywheel-forge' archivesBaseName = "flywheel-forge-${artifact_minecraft_version}"
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
@ -36,7 +35,6 @@ println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getPro
minecraft { minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
runs { runs {
client { client {
workingDirectory project.file('run') workingDirectory project.file('run')
@ -89,10 +87,6 @@ minecraft {
} }
} }
mixin {
add sourceSets.main, 'flywheel.refmap.json'
}
repositories { repositories {
maven { maven {
url 'https://www.cursemaven.com' url 'https://www.cursemaven.com'
@ -130,53 +124,64 @@ dependencies {
} }
} }
// Example for how to get properties into the manifest for reading by the runtime.. processResources {
inputs.property 'version', mod_version
filesMatching('META-INF/mods.toml') {
expand 'version': mod_version
}
}
mixin {
add sourceSets.main, 'flywheel.refmap.json'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
jar { jar {
manifest { manifest {
attributes([ attributes([
'Specification-Title' : 'flywheel', 'Specification-Title' : 'flywheel',
//'Specification-Vendor': 'flywheel authors', //'Specification-Vendor': 'flywheel authors',
'Specification-Version' : '1', // We are version 1 of ourselves 'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name, 'Implementation-Title' : project.jar.baseName,
'Implementation-Version' : project.version, 'Implementation-Version' : project.jar.archiveVersion,
//'Implementation-Vendor': 'flywheel authors', //'Implementation-Vendor': 'flywheel authors',
'MixinConfigs' : 'flywheel.mixins.json', 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") 'MixinConfigs' : 'flywheel.mixins.json'
]) ])
} }
} }
jar.finalizedBy('reobfJar')
javadoc { javadoc {
source = [sourceSets.main.allJava] source = [sourceSets.main.allJava]
// prevent java 8's strict doclint for javadocs from failing builds // prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('Xdoclint:none', '-quiet')
} }
task sourcesJar(type: Jar) { java {
from sourceSets.main.allSource withSourcesJar()
archiveBaseName.set(project.archivesBaseName) withJavadocJar()
archiveVersion.set("${project.version}")
archiveClassifier.set('sources')
} }
task javadocJar(type: Jar, dependsOn: javadoc) { void addLicense(jarTask) {
from javadoc.destinationDir jarTask.from('LICENSE') {
archiveClassifier.set('javadoc') rename { "${it}_${project.archivesBaseName}" }
}
} }
artifacts { jar.finalizedBy('reobfJar')
archives jar, sourcesJar, javadocJar addLicense(jar)
}
publishing { publishing {
tasks.publish.dependsOn 'build'
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifact jar artifactId = archivesBaseName
artifact sourcesJar
artifact javadocJar from components.java
fg.component(it)
} }
} }

View file

@ -3,7 +3,8 @@ org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.6.4 mod_version = 0.6.4
mc_update_version = 1.18 artifact_minecraft_version = 1.18.2
minecraft_version = 1.18.2 minecraft_version = 1.18.2
forge_version = 40.1.60 forge_version = 40.1.60

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

10
gradlew vendored
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script # Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features: # requires all of these POSIX shell features:
# * functions; # * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»; # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»; # * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit». # * various built-in commands including «command», «set», and «ulimit».
# #
# Important for patching: # Important for patching:
# #

View file

@ -7,8 +7,8 @@ import org.slf4j.Logger;
import com.jozufozu.flywheel.api.FlywheelWorld; import com.jozufozu.flywheel.api.FlywheelWorld;
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat; import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
import com.jozufozu.flywheel.backend.instancing.ParallelTaskEngine; import com.jozufozu.flywheel.backend.instancing.ParallelTaskEngine;
import com.jozufozu.flywheel.config.FlwConfig;
import com.jozufozu.flywheel.config.BackendType; import com.jozufozu.flywheel.config.BackendType;
import com.jozufozu.flywheel.config.FlwConfig;
import com.jozufozu.flywheel.core.shader.ProgramSpec; import com.jozufozu.flywheel.core.shader.ProgramSpec;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;

View file

@ -96,10 +96,8 @@ public class Loader implements ResourceManagerReloadListener {
Collection<ResourceLocation> programSpecs = manager.listResources(PROGRAM_DIR, s -> s.endsWith(".json")); Collection<ResourceLocation> programSpecs = manager.listResources(PROGRAM_DIR, s -> s.endsWith(".json"));
for (ResourceLocation location : programSpecs) { for (ResourceLocation location : programSpecs) {
try { try (Resource resource = manager.getResource(location)) {
Resource file = manager.getResource(location); String s = StringUtil.readToString(resource.getInputStream());
String s = StringUtil.readToString(file.getInputStream());
ResourceLocation specName = ResourceUtil.trim(location, PROGRAM_DIR, ".json"); ResourceLocation specName = ResourceUtil.trim(location, PROGRAM_DIR, ".json");

View file

@ -19,7 +19,6 @@ import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.client.event.RegisterClientCommandsEvent; import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.fml.ModList;
public class FlwCommands { public class FlwCommands {
public static void registerClientCommands(RegisterClientCommandsEvent event) { public static void registerClientCommands(RegisterClientCommandsEvent event) {

View file

@ -36,16 +36,14 @@ public class ShaderSources implements SourceFinder {
}); });
for (ResourceLocation location : allShaders) { for (ResourceLocation location : allShaders) {
try { try (Resource resource = manager.getResource(location)) {
Resource resource = manager.getResource(location);
String source = StringUtil.readToString(resource.getInputStream()); String source = StringUtil.readToString(resource.getInputStream());
ResourceLocation name = ResourceUtil.removePrefixUnchecked(location, SHADER_DIR); ResourceLocation name = ResourceUtil.removePrefixUnchecked(location, SHADER_DIR);
shaderSources.put(name, new SourceFile(this, name, source)); shaderSources.put(name, new SourceFile(this, name, source));
} catch (IOException e) { } catch (IOException e) {
//
} }
} }

View file

@ -1,14 +1,11 @@
package com.jozufozu.flywheel.core.vertex; package com.jozufozu.flywheel.core.vertex;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.lwjgl.system.MemoryUtil; import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.api.vertex.ShadedVertexList; import com.jozufozu.flywheel.api.vertex.ShadedVertexList;
import com.jozufozu.flywheel.api.vertex.VertexList;
import com.jozufozu.flywheel.util.RenderMath; import com.jozufozu.flywheel.util.RenderMath;
import com.mojang.blaze3d.platform.MemoryTracker;
public class BlockVertexListUnsafe extends AbstractVertexList { public class BlockVertexListUnsafe extends AbstractVertexList {

View file

@ -1,13 +1,10 @@
package com.jozufozu.flywheel.core.vertex; package com.jozufozu.flywheel.core.vertex;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.lwjgl.system.MemoryUtil; import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.api.vertex.VertexList;
import com.jozufozu.flywheel.util.RenderMath; import com.jozufozu.flywheel.util.RenderMath;
import com.mojang.blaze3d.platform.MemoryTracker;
public class PosTexNormalVertexListUnsafe extends AbstractVertexList { public class PosTexNormalVertexListUnsafe extends AbstractVertexList {

View file

@ -3,7 +3,6 @@ package com.jozufozu.flywheel.util;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;

View file

@ -5,7 +5,7 @@ license = "MIT"
[[mods]] [[mods]]
modId = "flywheel" modId = "flywheel"
version = "${file.jarVersion}" version = "${version}"
displayName = "Flywheel" displayName = "Flywheel"
logoFile = "logo.png" logoFile = "logo.png"
displayURL = "https://www.curseforge.com/minecraft/mc-mods/flywheel" displayURL = "https://www.curseforge.com/minecraft/mc-mods/flywheel"