Merge pull request #4 from GTNewHorizons/fixbuild

fixbuild
This commit is contained in:
Martin Robertz authored and GitHub committed 2021-12-23 23:18:02 +01:00
commit 55ccf763b0
4 files changed
+98 -36

No files matched your search

+84 -25
View File
@@ -1,4 +1,4 @@
//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428
//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb
/*
DO NOT CHANGE THIS FILE!
@@ -42,6 +42,7 @@ plugins {
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id("maven-publish")
}
apply plugin: 'forge'
@@ -194,7 +195,9 @@ if(file("addon.gradle").exists()) {
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation)
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
@@ -260,16 +263,28 @@ task relocateShadowJar(type: ConfigureShadowRelocation) {
}
shadowJar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
dependsOn(relocateShadowJar)
}
jar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
@@ -343,31 +358,31 @@ tasks.withType(JavaExec).configureEach {
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
// replace version and mcversion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
if(usesMixins.toBoolean()) {
from refMap
}
if(usesMixins.toBoolean()) {
from refMap
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
@@ -400,6 +415,12 @@ task sourcesJar(type: Jar) {
}
task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
@@ -408,7 +429,7 @@ task shadowDevJar(type: ShadowJar) {
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
@@ -423,6 +444,12 @@ task circularResolverJar(type: Jar) {
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
@@ -460,6 +487,38 @@ artifacts {
}
}
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: jar
artifact source: sourcesJar, classifier: "src"
artifact source: devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
version = System.getenv("ARTIFACT_VERSION") ?: project.version
}
}
repositories {
maven {
String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown"
String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
name = "GitHubPackages"
url = githubRepositoryUrl
credentials {
username = System.getenv("GITHUB_ACTOR") ?: "NONE"
password = System.getenv("GITHUB_TOKEN") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
Vendored Regular → Executable
View File
File mode changed.
@@ -1,5 +1,7 @@
package codechicken.core;
import codechicken.core.launch.CodeChickenCorePlugin;
public class ProfileTimer
{
public double decay;
@@ -33,7 +35,6 @@ public class ProfileTimer
scanCount++;
if(logScans > 0 && scanCount % logScans == 0)
System.out.println("Profiled " + logName + " " + nanoTime + "ns");
CodeChickenCorePlugin.logger.info("Profiled " + logName + " " + nanoTime + "ns");
}
}
@@ -12,6 +12,8 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
import sun.misc.URLClassPath;
import sun.net.util.URLUtil;
import codechicken.core.launch.CodeChickenCorePlugin;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
@@ -318,9 +320,9 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
if (!mod.delete()) {
mod.deleteOnExit();
String msg = owner + " was unable to delete file " + mod.getPath() + " the game will now try to delete it on exit. If this dialog appears again, delete it manually.";
System.err.println(msg);
CodeChickenCorePlugin.logger.error(msg);
if (!GraphicsEnvironment.isHeadless())
JOptionPane.showMessageDialog(null, msg, "An update error has occured", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, msg, "An update error has occurred", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
@@ -332,7 +334,7 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
try {
URL libDownload = new URL(dep.url + '/' + dep.file.filename);
downloadMonitor.updateProgressString("Downloading file %s", libDownload.toString());
System.out.format("Downloading file %s\n", libDownload.toString());
CodeChickenCorePlugin.logger.debug("Downloading file " + libDownload);
URLConnection connection = libDownload.openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
@@ -340,13 +342,13 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
int sizeGuess = connection.getContentLength();
download(connection.getInputStream(), sizeGuess, libFile);
downloadMonitor.updateProgressString("Download complete");
System.out.println("Download complete");
CodeChickenCorePlugin.logger.trace("Download complete");
scanDepInfo(libFile);
} catch (Exception e) {
libFile.delete();
if (downloadMonitor.shouldStopIt()) {
System.err.println("You have stopped the downloading operation before it could complete");
CodeChickenCorePlugin.logger.error("You have stopped the downloading operation before it could complete");
System.exit(1);
return;
}
@@ -428,12 +430,12 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
int cmp = vfile.version.compareTo(dep.file.version);
if (cmp < 0) {
System.out.println("Deleted old version " + f.getName());
CodeChickenCorePlugin.logger.warn("Deleted old version " + f.getName());
deleteMod(f);
return null;
}
if (cmp > 0) {
System.err.println("Warning: version of " + dep.file.name + ", " + vfile.version + " is newer than request " + dep.file.version);
CodeChickenCorePlugin.logger.warn("Warning: version of " + dep.file.name + ", " + vfile.version + " is newer than request " + dep.file.version);
return f.getName();
}
return f.getName();//found dependency
@@ -507,7 +509,7 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
loadJSon(zip.getInputStream(e));
zip.close();
} catch (Exception e) {
System.err.println("Failed to load dependencies.info from " + file.getName() + " as JSON");
CodeChickenCorePlugin.logger.error("Failed to load dependencies.info from " + file.getName() + " as JSON");
e.printStackTrace();
}
}
@@ -547,7 +549,7 @@ public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
if(node.has("pattern"))
pattern = Pattern.compile(node.get("pattern").getAsString());
} catch (PatternSyntaxException e) {
System.err.println("Invalid filename pattern: "+node.get("pattern"));
CodeChickenCorePlugin.logger.error("Invalid filename pattern: " + node.get("pattern"));
e.printStackTrace();
}
if(pattern == null)