Fix yet another gradle deprecation, expand tests to cover it

dev/0.11
modmuss50 2021-07-05 23:04:08 +01:00
parent 8ce991dadc
commit b24e067215
3 changed files with 12 additions and 4 deletions

View File

@ -47,7 +47,7 @@ public class UnpickJarTask extends JavaExec {
public UnpickJarTask() { public UnpickJarTask() {
getOutputs().upToDateWhen(e -> false); getOutputs().upToDateWhen(e -> false);
classpath(getProject().getConfigurations().getByName(Constants.Configurations.UNPICK_CLASSPATH)); classpath(getProject().getConfigurations().getByName(Constants.Configurations.UNPICK_CLASSPATH));
setMain("daomephsta.unpick.cli.Main"); getMainClass().set("daomephsta.unpick.cli.Main");
} }
@Override @Override

View File

@ -42,17 +42,25 @@ class UnpickTest extends Specification implements ProjectTestTrait {
def "unpick decompile"() { def "unpick decompile"() {
when: when:
def result = create("genSources") def result = create("genSources", gradle)
then: then:
result.task(":genSources").outcome == SUCCESS result.task(":genSources").outcome == SUCCESS
getClassSource("net/minecraft/block/CakeBlock.java").contains("Block.DEFAULT_SET_BLOCK_STATE_FLAG") getClassSource("net/minecraft/block/CakeBlock.java").contains("Block.DEFAULT_SET_BLOCK_STATE_FLAG")
where:
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
} }
def "unpick build"() { def "unpick build"() {
when: when:
def result = create("build") def result = create("build", gradle)
then: then:
result.task(":build").outcome == SUCCESS result.task(":build").outcome == SUCCESS
where:
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
} }
String getClassSource(String classname, String mappings = MAPPINGS) { String getClassSource(String classname, String mappings = MAPPINGS) {

View File

@ -29,7 +29,7 @@ import org.gradle.testkit.runner.GradleRunner
trait ProjectTestTrait { trait ProjectTestTrait {
final static String DEFAULT_GRADLE = "7.0.1" final static String DEFAULT_GRADLE = "7.0.1"
final static String PRE_RELEASE_GRADLE = "7.2-20210703221006+0000" final static String PRE_RELEASE_GRADLE = "7.2-20210704221017+0000"
static File gradleHome = File.createTempDir() static File gradleHome = File.createTempDir()
File testProjectDir = File.createTempDir() File testProjectDir = File.createTempDir()