aboutsummaryrefslogtreecommitdiff
path: root/src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java
diff options
context:
space:
mode:
authorThibault Gagnaux <tgagnaux@gmail.com>2022-02-23 19:29:54 +0100
committerThibault Gagnaux <tgagnaux@gmail.com>2022-02-23 19:29:54 +0100
commit049f8d3029b30dc58221e90aa8ddf69b3aa3b61e (patch)
treee6c5e82733f910ebb0db7dba4fc74eb8dc339e77 /src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java
parenta4879784e7be87b5ee184b47eb8faba635019a5d (diff)
downloadfrege-gradle-plugin-049f8d3029b30dc58221e90aa8ddf69b3aa3b61e.tar.gz
frege-gradle-plugin-049f8d3029b30dc58221e90aa8ddf69b3aa3b61e.tar.bz2
frege-gradle-plugin-049f8d3029b30dc58221e90aa8ddf69b3aa3b61e.zip
feat: simplifies the replFrege task
The replFregeTask has the following new logic: 1. Compiles the specified fregeRepl module (either in the `build.gradle` via command line option `--replModule=...`) and all its dependencies. 2. Sets up the correct classpath so that dependent modules don't have to be imported manually. In addition, it solves the shadowing problem by removing the replModule java and class file from the classpath. 3. It prints one single command to directly start the repl and load the specified module. Bonus: I designed the task so that you can even automate step 3 with the following bash command: `eval $(./gradlew -q replFrege)`.
Diffstat (limited to 'src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java')
-rw-r--r--src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java
index 51fa256..f935b28 100644
--- a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java
+++ b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java
@@ -3,6 +3,8 @@ package ch.fhnw.thga.gradleplugins;
import static ch.fhnw.thga.gradleplugins.FregePlugin.FREGE_EXTENSION_NAME;
import static ch.fhnw.thga.gradleplugins.FregePlugin.FREGE_PLUGIN_ID;
import static ch.fhnw.thga.gradleplugins.GradleBuildFileConversionTest.createPluginsSection;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static ch.fhnw.thga.gradleplugins.FregeExtension.DEFAULT_RELATIVE_SOURCE_DIR;
import java.io.BufferedWriter;
@@ -44,6 +46,32 @@ public class SharedFunctionalTestLogic
NEW_LINE
)
);
+
+ public static final boolean fileExists(
+ File testProjectDir,
+ String relativeFilePath)
+ {
+ return testProjectDir
+ .toPath()
+ .resolve(relativeFilePath)
+ .toFile()
+ .exists();
+ }
+
+ public static final void assertFileExists(
+ File testProjectDir,
+ String relativeFilePath)
+ {
+ assertTrue(fileExists(testProjectDir, relativeFilePath));
+ }
+
+
+ public static final void assertFileDoesNotExist(
+ File testProjectDir,
+ String relativeFilePath)
+ {
+ assertFalse(fileExists(testProjectDir, relativeFilePath));
+ }
static String createFregeSection(FregeDTO fregeDTO)
{