From 049f8d3029b30dc58221e90aa8ddf69b3aa3b61e Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 23 Feb 2022 19:29:54 +0100 Subject: 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)`. --- .../gradleplugins/SharedFunctionalTestLogic.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/functionalTest/java/ch/fhnw/thga/gradleplugins/SharedFunctionalTestLogic.java') 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) { -- cgit