Skip to content
Snippets Groups Projects
Commit a882cdc3 authored by René Schöne's avatar René Schöne
Browse files

Move tests to separate Gradle module.

parent b7706c07
No related branches found
No related tags found
No related merge requests found
Showing
with 35 additions and 9 deletions
...@@ -157,5 +157,3 @@ jastadd { ...@@ -157,5 +157,3 @@ jastadd {
} }
generateAst.dependsOn relast generateAst.dependsOn relast
apply from: 'test.build.gradle'
...@@ -71,12 +71,17 @@ public class Compiler { ...@@ -71,12 +71,17 @@ public class Compiler {
printMessage("Writing output files"); printMessage("Writing output files");
// copy MqttUpdater into outputDir // copy MqttUpdater into outputDir
final String mqttUpdaterFileName = "MqttUpdater.jadd";
try { try {
Files.copy(Paths.get("src", "main", "resources", "MqttUpdater.jadd"), InputStream inputStream = Compiler.class.getClassLoader().getResourceAsStream(mqttUpdaterFileName);
Paths.get(outputDir, "MqttUpdater.jadd"), if (inputStream == null) {
throw new CompilerException("Could not open " + mqttUpdaterFileName);
}
Files.copy(inputStream,
Paths.get(outputDir, mqttUpdaterFileName),
StandardCopyOption.REPLACE_EXISTING); StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) { } catch (IOException e) {
throw new CompilerException("Could not copy MqttUpdater.java", e); throw new CompilerException("Could not copy " + mqttUpdaterFileName, e);
} }
writeToFile(outputDir + "/Grammar.relast", ros2Rag.getProgram().generateAbstractGrammar()); writeToFile(outputDir + "/Grammar.relast", ros2Rag.getProgram().generateAbstractGrammar());
writeToFile(outputDir + "/ROS2RAG.jadd", ros2Rag.generateAspect(optionRootNode.getValue())); writeToFile(outputDir + "/ROS2RAG.jadd", ros2Rag.generateAspect(optionRootNode.getValue()));
......
import org.jastadd.relast.plugin.RelastPlugin import org.jastadd.relast.plugin.RelastPlugin
import org.jastadd.relast.plugin.RelastTest import org.jastadd.relast.plugin.RelastTest
apply plugin: 'jastadd'
apply plugin: 'application'
apply plugin: RelastPlugin apply plugin: RelastPlugin
relastTest { sourceCompatibility = 1.8
compilerLocation = '../libs/relast.jar'
repositories {
jcenter()
}
buildscript {
repositories.jcenter()
dependencies {
classpath 'org.jastadd:jastaddgradle:1.13.3'
}
} }
dependencies { dependencies {
runtime 'org.jastadd:jastadd:2.3.4'
implementation project(':ros2rag.base')
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
testImplementation 'org.assertj:assertj-core:3.12.1' testImplementation 'org.assertj:assertj-core:3.12.1'
...@@ -15,6 +28,16 @@ dependencies { ...@@ -15,6 +28,16 @@ dependencies {
testImplementation 'com.google.protobuf:protobuf-java:3.0.0' testImplementation 'com.google.protobuf:protobuf-java:3.0.0'
} }
test {
useJUnitPlatform()
maxHeapSize = '1G'
}
relastTest {
compilerLocation = '../libs/relast.jar'
}
sourceSets { sourceSets {
test { test {
java.srcDir "src/test/java-gen" java.srcDir "src/test/java-gen"
...@@ -22,7 +45,6 @@ sourceSets { ...@@ -22,7 +45,6 @@ sourceSets {
} }
task preprocessExampleTest(type: JavaExec, group: 'verification') { task preprocessExampleTest(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/example/Grammar.relast', delete 'src/test/02-after-ros2rag/example/Grammar.relast',
'src/test/02-after-ros2rag/example/MqttUpdater.java', 'src/test/02-after-ros2rag/example/MqttUpdater.java',
......
rootProject.name = 'ros2rag' rootProject.name = 'ros2rag'
include 'relast.preprocessor'
include 'ros2rag.base' include 'ros2rag.base'
include 'ros2rag.tests'
include 'ros2rag.example' include 'ros2rag.example'
include 'ros2rag.senderstub' include 'ros2rag.senderstub'
include 'ros2rag.receiverstub' include 'ros2rag.receiverstub'
include 'relast.preprocessor'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment