Skip to content

Commit 4af4bbf

Browse files
committed
Update 1.2.40
1 parent 01a4eab commit 4af4bbf

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

dev/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ dependencies {
3939
includeOnly(project(":dev11")) {
4040
transitive = false
4141
}
42+
// For testes only
43+
testImplementation(gradleTestKit())
44+
testImplementation(gradleFixtures()) { transitive = false }
45+
testRuntimeOnly(project(":common"))
46+
47+
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
48+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
4249
}
4350

4451
gradlePlugin {
@@ -48,6 +55,10 @@ gradlePlugin {
4855
}
4956
}
5057

58+
test {
59+
useJUnitPlatform()
60+
}
61+
5162
jar.dependsOn(":common:jar")
5263
jar.dependsOn(":dev11:jar")
5364

dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class GradlePlugin implements Plugin<Project> {
141141
}
142142
}
143143
project.afterEvaluate {
144-
tasks.withType(JavaCompile.class).configureEach {
144+
project.tasks.withType(JavaCompile.class).configureEach {
145145
options.compilerArgs += '-g'
146146
options.encoding = 'UTF-8'
147147
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.fox2code.foxloader.dev.tests;
2+
3+
import com.fox2code.foxloader.dev.GradlePlugin;
4+
import org.gradle.api.Project;
5+
import org.gradle.testfixtures.ProjectBuilder;
6+
import org.junit.jupiter.api.Assertions;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class SampleGradlePluginTest {
10+
@Test
11+
public void sampleTest() {
12+
Project project = ProjectBuilder.builder().build();
13+
project.getPluginManager().apply("foxloader.dev");
14+
// Test if java plugin is loaded
15+
for (String pluginName : new String[]{"foxloader.dev", "java"}) {
16+
Assertions.assertTrue(project.getPluginManager().hasPlugin(pluginName), () -> "Missing plugin " + pluginName);
17+
}
18+
// Test if extension work properly
19+
GradlePlugin.FoxLoaderConfig config = (GradlePlugin.FoxLoaderConfig)
20+
project.getExtensions().getByName("foxloader");
21+
Assertions.assertNotNull(config, "Missing FoxLoader Config Extension");
22+
config.setDecompileSources(false); // <- Disable source decompiling for tests
23+
// Run, "afterEvaluate" listeners
24+
project.evaluationDependsOn(":");
25+
// Test if tasks are injected properly
26+
for (String taskName : new String[]{"runClient", "runServer"}) {
27+
Assertions.assertNotNull(project.getTasks().getByName(taskName), () -> "Missing task " + taskName);
28+
}
29+
}
30+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.gradle.parallel=true
33
org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8
44

55
# FoxLoader properties
6-
foxloader.version=1.2.39
6+
foxloader.version=1.2.40
77
foxloader.lastReIndevTransformerChanges=1.2.39
88
# https://www.jitpack.io/#com.fox2code/FoxLoader
99

0 commit comments

Comments
 (0)