Skip to content

Commit

Permalink
Update to Gradle 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Johni0702 committed Jun 3, 2021
1 parent 20449e0 commit 7e27897
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 49 deletions.
17 changes: 10 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}

apply plugin: 'idea'
Expand Down Expand Up @@ -59,11 +59,18 @@ repositories {
}

configurations {
// compile has been replaced with api, re-adding to keep the diff small
compile
api.extendsFrom(compile)
testCompile
testImplementation.extendsFrom(testCompile)

deployerJars
}

dependencies {
shadow gradleApi()
testImplementation gradleApi()

compile 'org.ow2.asm:asm:6.0'
compile 'org.ow2.asm:asm-tree:6.0'
Expand Down Expand Up @@ -119,7 +126,7 @@ dependencies {
}

wrapper {
gradleVersion = '5.4.1'
gradleVersion = '7.0.2'
}

compileJava {
Expand All @@ -129,13 +136,9 @@ compileJava {
}

processResources {
from(sourceSets.main.resources.srcDirs) {
include 'forgegradle.version.txt'
filesMatching(["forgegradle.version.txt"]) {
expand 'version': project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'forgegradle.version.txt'
}
}

jar {
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;
Expand All @@ -46,14 +47,11 @@ public class ExtractConfigTask extends CachedTask implements PatternFilterable
@Input
private String config;

@Input
private PatternSet patternSet = new PatternSet();

@Input
private boolean includeEmptyDirs = true;

@Input
@Optional
private boolean clean = false;

@Cached
Expand Down Expand Up @@ -139,6 +137,11 @@ public boolean shouldClean()
return clean;
}

@Input
public boolean isClean() {
return clean;
}

public void setClean(boolean clean)
{
this.clean = clean;
Expand Down Expand Up @@ -170,12 +173,14 @@ public PatternFilterable exclude(Closure arg0)
}

@Override
@Input
public Set<String> getExcludes()
{
return patternSet.getExcludes();
}

@Override
@Input
public Set<String> getIncludes()
{
return patternSet.getIncludes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
import java.util.Map;
import java.util.Map.Entry;

import javax.xml.bind.DatatypeConverter;

import net.minecraftforge.gradle.common.Constants;

import org.apache.commons.codec.binary.Base64;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.OutputFile;
Expand Down Expand Up @@ -70,7 +69,7 @@ public void doTask() throws IOException
if (getAuthName() != null && getAuthPassword() != null)
{
String raw = getAuthName() + ":" + getAuthPassword();
auth = "Basic " + DatatypeConverter.printBase64Binary(raw.getBytes());
auth = "Basic " + Base64.encodeBase64String(raw.getBytes());
}

List<Map<String, Object>> builds = getBuildInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.jar.JarOutputStream;

import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;

public class TaskDepDummy extends DefaultTask
Expand All @@ -47,6 +48,7 @@ public void makeEmptyJar() throws IOException
}
}

@OutputFile
public File getOutputFile()
{
return getProject().file(outputFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import java.util.zip.ZipOutputStream;

import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import com.google.common.base.Charsets;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -141,6 +144,17 @@ private void processJar(File input, File output) throws IOException
}
}

@InputFile
public File getInput() {
return getJar();
}

@OutputFile
public File getOutput() {
return getJar();
}

@Internal
public File getJar()
{
return getProject().file(jar);
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/net/minecraftforge/gradle/user/TaskSingleReobf.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@

import org.gradle.api.DefaultTask;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;

import com.google.common.base.Charsets;
Expand Down Expand Up @@ -279,16 +285,23 @@ private void applyExtraTransformers(File inJar, File outJar, List<ReobfTransform
// Main Jar and classpath
// --------------------------------------------

@InputFile
public File getJar()
{
return getProject().file(jar);
}

@OutputFile
public File getOutput() {
return getJar();
}

public void setJar(Object jar)
{
this.jar = jar;
}

@InputFiles
public FileCollection getClasspath()
{
return classpath;
Expand All @@ -302,6 +315,7 @@ public void setClasspath(FileCollection classpath)
// SRG STUFF
// --------------------------------------------

@InputFile
public File getPrimarySrg()
{
if (primarySrg == null)
Expand All @@ -319,6 +333,7 @@ public void addSecondarySrgFile(Object thing)
secondarySrgFiles.add(thing);
}

@InputFiles
public FileCollection getSecondarySrgFiles()
{
List<File> files = new ArrayList<File>(secondarySrgFiles.size());
Expand All @@ -345,6 +360,7 @@ else if ("srg".equals(Files.getFileExtension(f.getName()).toLowerCase()))
return getProject().files(files);
}

@Input
public List<String> getExtraSrgLines()
{
return extraSrgLines;
Expand All @@ -368,6 +384,8 @@ public void addExtraSrgLines(Collection<String> srgLines)
// GETTERS AND STUF FOR DECOMP SPECIFIC STUFF
// --------------------------------------------

@InputFile
@Optional
public File getFieldCsv()
{
return fieldCsv == null ? null : getProject().file(fieldCsv);
Expand All @@ -378,6 +396,8 @@ public void setFieldCsv(Object fieldCsv)
this.fieldCsv = fieldCsv;
}

@InputFile
@Optional
public File getMethodCsv()
{
return methodCsv == null ? null : getProject().file(methodCsv);
Expand All @@ -388,6 +408,8 @@ public void setMethodCsv(Object methodCsv)
this.methodCsv = methodCsv;
}

@InputFile
@Optional
public File getExceptorCfg()
{
return exceptorCfg == null ? null : getProject().file(exceptorCfg);
Expand All @@ -398,6 +420,8 @@ public void setExceptorCfg(Object file)
this.exceptorCfg = file;
}

@InputFile
@Optional
public File getDeobfFile()
{
return deobfFile == null ? null : getProject().file(deobfFile);
Expand All @@ -408,6 +432,8 @@ public void setDeobfFile(Object deobfFile)
this.deobfFile = deobfFile;
}

@InputFile
@Optional
public File getRecompFile()
{
return recompFile == null ? null : getProject().file(recompFile);
Expand All @@ -418,6 +444,7 @@ public void setRecompFile(Object recompFile)
this.recompFile = recompFile;
}

@Input
public boolean isDecomp()
{
return isDecomp;
Expand All @@ -431,6 +458,7 @@ public void setDecomp(boolean isDecomp)
// EXTRA FANCY TRANSFORMERS
// --------------------------------------------

@Internal
public List<ReobfTransformer> getPostTransformers()
{
return postTransformers; // Autobots! ROLL OUT!
Expand All @@ -446,6 +474,7 @@ public void addPostTransformer(Closure<byte[]> decepticon)
postTransformers.add(new ClosureTransformer(decepticon));
}

@Internal
public List<ReobfTransformer> getPreTransformers()
{
return preTransformers; // Autobots! ROLL OUT!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void include(List<String> strs)
includes.addAll(strs);
}

public ArrayList<String> getIncudes()
public ArrayList<String> getIncludes()
{
return includes;
}
Expand Down
Loading

0 comments on commit 7e27897

Please sign in to comment.