Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions monticore-grammar-emf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ dependencies {
testImplementation testFixtures(project(':monticore-runtime'))
}

def srcDir = "$buildDir/main/java"
def srcResourcesDir = "$buildDir/main/resources"
def testDir = "$buildDir/test/java"
def srcDir = layout.buildDirectory.dir("main/java")
def srcResourcesDir = layout.buildDirectory.dir("main/resources")
def testDir = layout.buildDirectory.dir("test/java")

task copySrc(type: Copy) {
tasks.register('copySrc', Copy) {
from "${project(':monticore-grammar').projectDir}/src/main/java"
into srcDir
}

task copySrcResources(type: Copy) {
from "${project(':monticore-grammar').projectDir}/src/main/resources"
into srcResourcesDir
tasks.register('copySrcResources', Copy) {
from "${project(':monticore-grammar').projectDir}/src/main/resources"
into srcResourcesDir
}

task copyTest(type: Copy) {
tasks.register('copyTest', Copy) {
from "${project(':monticore-grammar').projectDir}/src/test/java"
into testDir
}

task copyTestResources(type: Copy) {
from "${project(':monticore-grammar').projectDir}/src/test/resources"
into "$buildDir/test/resources"
tasks.register('copyTestResources', Copy) {
from "${project(':monticore-grammar').projectDir}/src/test/resources"
into layout.buildDirectory.dir("resources/test")
}

def grammarDir = "${project(':monticore-grammar').projectDir}/src/main/grammars"
Expand All @@ -63,40 +63,27 @@ sourceSets {
"${project(':monticore-grammar').projectDir}/src/main/examples"]
}

task generate {}
tasks.register('generate') {}

tasks.named('generateMCGrammars') {
grammar.setFrom(file grammarDir)
grammar = file(grammarDir)
script = "de/monticore/monticore_emf.groovy"
modelPath "${project(':monticore-grammar').projectDir}/src/main/grammars"
handcodedPath srcDir
modelPath = "${project(':monticore-grammar').projectDir}/src/main/grammars"
handWrittenCodeDir = files(srcDir)
genINT = true
dependsOn(copySrc, copyTest, copyTestResources)
}

generateTestMCGrammars {
script = "de/monticore/monticore_emf.groovy"
modelPath("$grammarDir", "${project(':monticore-grammar').projectDir}/src/test/grammars", "${project(':monticore-grammar').projectDir}/src/main/examples")
handcodedPath(srcDir, testDir)
modelPath = files("$grammarDir", "${project(':monticore-grammar').projectDir}/src/test/grammars", "${project(':monticore-grammar').projectDir}/src/main/examples")
handWrittenCodeDir = files(srcDir, testDir)
genINT = true
dependsOn(copySrc, copyTest, copyTestResources)
}

test {
useJUnitPlatform()
exclude '**/CommentsOnASTTest.class'
exclude '**/SwitchStatementValidTest.class'
exclude '**/GrammarInheritanceCycleTest.class'
exclude '**/GrammarNameEqualsFileNameTest.class'
exclude '**/MCGrammarParserTest.class'
exclude '**/MCGrammarPrettyPrinterTest.class'
exclude '**/SynthesizeSymTypeFromMCBasicTypesTest.class'
exclude '**/SynthesizeSymTypeFromMCCollectionTypesTest.class'
exclude '**/SynthesizeSymTypeFromMCSimpleGenericTypesTest.class'
exclude '**/SynthesizeSymTypeFromMCFullGenericTypesTest.class'
exclude '**/SynthesizeSymTypeFromMCArrayTypesTest.class'
exclude '**/MCType2SymTypeExpressionTest.class'
exclude '**/ComponentTypeSymbolDeSerTest.class'
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void before() {

@Test
public void testComments() throws IOException {
Optional<ASTJavaMethod> ast = parser.parse("src/test/resources/de/monticore/comments/CommentsTest.jlight");
Optional<ASTJavaMethod> ast = parser.parse("target/resources/test/de/monticore/comments/CommentsTest.jlight");
assertTrue(ast.isPresent());
assertFalse(parser.hasErrors());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public static Grammar_WithConceptsGlobalScope create() {
// reset global scope
scope.clear();
scope.setFileExt("mc4");
scope.getSymbolPath().addEntry(Paths.get("src/test/resources"));
scope.getSymbolPath().addEntry(Paths.get("target/test/resources"));
scope.getSymbolPath().addEntry(Paths.get("target/resources/test"));
return (Grammar_WithConceptsGlobalScope) scope;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void before() {

@Test
public void testParse() throws IOException {
String model = "src/test/resources/de/monticore/Statechart.mc4";
String model = "target/resources/test/de/monticore/Statechart.mc4";

Grammar_WithConceptsParser parser =
Grammar_WithConceptsMill.parser();
Expand Down Expand Up @@ -79,7 +79,7 @@ public void testSematicPred() throws IOException {

@Test
public void testScript() throws IOException {
String model = "src/test/resources/de/monticore/script/ScriptExample.mc4";
String model = "target/resources/test/de/monticore/script/ScriptExample.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -91,7 +91,7 @@ public void testScript() throws IOException {

@Test
public void testAutomatonV1() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonV1.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonV1.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -103,7 +103,7 @@ public void testAutomatonV1() throws IOException {

@Test
public void testAutomatonV2() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonV2.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonV2.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -115,7 +115,7 @@ public void testAutomatonV2() throws IOException {

@Test
public void testAutomatonV3() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonV3.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonV3.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -125,7 +125,7 @@ public void testAutomatonV3() throws IOException {

@Test
public void testHierarchicalAutomaton() throws IOException {
String model = "src/test/resources/de/monticore/script/HierarchicalAutomaton.mc4";
String model = "target/resources/test/de/monticore/script/HierarchicalAutomaton.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -137,7 +137,7 @@ public void testHierarchicalAutomaton() throws IOException {

@Test
public void testAutomatonWithInvsComp() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonWithInvsComp.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonWithInvsComp.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -153,7 +153,7 @@ public void testAutomatonWithInvsComp() throws IOException {

@Test
public void testAutomatonWithInvs() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonWithInvs.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonWithInvs.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -163,7 +163,7 @@ public void testAutomatonWithInvs() throws IOException {

@Test
public void testAutomatonWithInvsAndStartRule() throws IOException {
String model = "src/test/resources/de/monticore/script/AutomatonWithInvsAndStartRule.mc4";
String model = "target/resources/test/de/monticore/script/AutomatonWithInvsAndStartRule.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -173,7 +173,7 @@ public void testAutomatonWithInvsAndStartRule() throws IOException {

@Test
public void testGrammarSymbolTableInfo() throws IOException {
String model = "src/test/resources/Automaton.mc4";
String model = "target/resources/test/Automaton.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> result = parser.parse(model);
Expand All @@ -197,7 +197,7 @@ public void testGrammarSymbolTableInfo() throws IOException {

@Test
public void testPackageNameWithPointsDefined() throws IOException {
String model = "src/test/resources/de/monticore/point.in.packagename/PackagePathTest.mc4";
String model = "target/resources/test/de/monticore/point.in.packagename/PackagePathTest.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
parser.parse(model);
Expand All @@ -210,7 +210,7 @@ public void testPackageNameWithPointsDefined() throws IOException {

@Test
public void testPackageWrongPackageDefined() throws IOException {
String model = "src/test/resources/de/monticore/WrongPackage.mc4";
String model = "target/resources/test/de/monticore/WrongPackage.mc4";

Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
parser.parse(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void before() {
@Test
// Test simple grammar
public void testStatechart() throws IOException {
String model = "src/test/resources/de/monticore/Statechart.mc4";
String model = "target/resources/test/de/monticore/Statechart.mc4";

// Parsing input
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Expand All @@ -58,7 +58,7 @@ public void testStatechart() throws IOException {
@Test
// Test grammar with symbols and scopes
public void testAutomaton() throws IOException {
String model = "src/test/resources/Automaton.mc4";
String model = "target/resources/test/Automaton.mc4";

// Parsing input
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Expand All @@ -84,7 +84,7 @@ public void testAutomaton() throws IOException {
@Test
// Test grammar with symbols and scopes
public void testGrammar() throws IOException {
String model = "src/test/resources/de/monticore/TestGrammar.mc4";
String model = "target/resources/test/de/monticore/TestGrammar.mc4";

// Parsing input
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Expand All @@ -110,7 +110,7 @@ public void testGrammar() throws IOException {
@Test
// test lexicals with lexer commands and end actions
public void testLexicals() throws IOException {
String model = "src/test/resources/de/monticore/common/TestLexicals.mc4";
String model = "target/resources/test/de/monticore/common/TestLexicals.mc4";

// Parsing input
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Expand All @@ -136,7 +136,7 @@ public void testLexicals() throws IOException {
@Test
// test annotations
public void testAnnotations() throws IOException {
String model = "src/test/resources/de/monticore/Annotations.mc4";
String model = "target/resources/test/de/monticore/Annotations.mc4";

// Parsing input
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void init() {
@Test
public void testInvalid() throws IOException {
Grammar_WithConceptsParser parser = new Grammar_WithConceptsParser();
Optional<ASTMCGrammar> grammar = parser.parse("src/test/resources/de/monticore/grammar/cocos/invalid/A4023/A4023.mc4");
Optional<ASTMCGrammar> grammar = parser.parse("target/resources/test/de/monticore/grammar/cocos/invalid/A4023/A4023.mc4");

getFindings().clear();
checker.checkAll(grammar.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void init() {
@Test
public void testInvalidFilename() throws IOException {
Log.getFindings().clear();
parser.parse("src/test/resources/de/monticore/grammar/cocos/invalid/A4003/A4003.mc4");
parser.parse("target/resources/test/de/monticore/grammar/cocos/invalid/A4003/A4003.mc4");

assertFalse(Log.getFindings().isEmpty());
for(Finding f : Log.getFindings()){
Expand All @@ -35,7 +35,7 @@ public void testInvalidFilename() throws IOException {
@Test
public void testInvalidPackage() throws IOException {
Log.getFindings().clear();
parser.parse("src/test/resources/de/monticore/grammar/cocos/invalid/A4004/A4004.mc4");
parser.parse("target/resources/test/de/monticore/grammar/cocos/invalid/A4004/A4004.mc4");

assertFalse(Log.getFindings().isEmpty());
for(Finding f : Log.getFindings()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public void before() {
JavaLightTypeCheck3.init();

globalScope = TestJavaLightMill.globalScope();
globalScope.getSymbolPath().addEntry(Paths.get("src/test/resources"));
globalScope.getSymbolPath().addEntry(Paths.get("target/test/resources"));
globalScope.getSymbolPath().addEntry(Paths.get("target/resources/test"));
}

protected void testValid(String fileName, String methodName, JavaLightCoCoChecker checker) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static Stream<Arguments> exprAndErrorProvider() {
void testSwitchEnumConstantsValid(String expr) throws IOException {
// Given
IMCCommonStatementsArtifactScope imported =
new MCCommonStatementsSymbols2Json().load("src/test/resources/de/monticore/statements/Enum.sym");
new MCCommonStatementsSymbols2Json().load("target/resources/test/de/monticore/statements/Enum.sym");
TestMCCommonStatementsMill.globalScope().addSubScope(imported);

VariableSymbol variable = TestMCCommonStatementsMill.variableSymbolBuilder()
Expand Down Expand Up @@ -123,7 +123,7 @@ void testSwitchEnumConstantsValid(String expr) throws IOException {
void testSwitchEnumConstantsInvalid(String expr, String error) throws IOException {
// Given
IMCCommonStatementsArtifactScope imported =
new MCCommonStatementsSymbols2Json().load("src/test/resources/de/monticore/statements/Enum.sym");
new MCCommonStatementsSymbols2Json().load("target/resources/test/de/monticore/statements/Enum.sym");
TestMCCommonStatementsMill.globalScope().addSubScope(imported);

VariableSymbol variable = TestMCCommonStatementsMill.variableSymbolBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class ComponentTypeSymbolDeSerTest {

protected static final String RELATIVE_DIR = "src/test/resources/de/monticore/symbols/compsymbols/_symboltable/";
protected static final String RELATIVE_DIR = "target/resources/test/de/monticore/symbols/compsymbols/_symboltable/";

protected ComponentTypeSymbolDeSer deSer;
protected CompSymbolsSymbols2Json comp2json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void init() {
gs.add(DefsTypeBasic.type("Person"));

CombineExpressionsWithLiteralsSymbols2Json symbols2Json = new CombineExpressionsWithLiteralsSymbols2Json();
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("src/test/resources/de/monticore/types/check/Persondex.cesym");
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("target/resources/test/de/monticore/types/check/Persondex.cesym");
as.setEnclosingScope(gs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void init() {
gs.add(DefsTypeBasic.type("Person"));

CombineExpressionsWithLiteralsSymbols2Json symbols2Json = new CombineExpressionsWithLiteralsSymbols2Json();
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("src/test/resources/de/monticore/types/check/Persondex.cesym");
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("target/resources/test/de/monticore/types/check/Persondex.cesym");
as.setEnclosingScope(gs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public void init(){
gs.add(buildGeneric("Optional", "T"));

CombineExpressionsWithLiteralsSymbols2Json symbols2Json = new CombineExpressionsWithLiteralsSymbols2Json();
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("src/test/resources/de/monticore/types/check/Persondex.cesym");
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("target/resources/test/de/monticore/types/check/Persondex.cesym");
as.setEnclosingScope(gs);

ICombineExpressionsWithLiteralsArtifactScope as2 = symbols2Json.load("src/test/resources/de/monticore/types/check/Personaz.cesym");
ICombineExpressionsWithLiteralsArtifactScope as2 = symbols2Json.load("target/resources/test/de/monticore/types/check/Personaz.cesym");
as2.setEnclosingScope(gs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ public void init() {
gs.add(DefsTypeBasic.type("Void"));

CombineExpressionsWithLiteralsSymbols2Json symbols2Json = new CombineExpressionsWithLiteralsSymbols2Json();
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("src/test/resources/de/monticore/types/check/Persondex.cesym");
ICombineExpressionsWithLiteralsArtifactScope as = symbols2Json.load("target/resources/test/de/monticore/types/check/Persondex.cesym");
as.setEnclosingScope(gs);

ICombineExpressionsWithLiteralsArtifactScope as2 = symbols2Json.load("src/test/resources/de/monticore/types/check/Personaz.cesym");
ICombineExpressionsWithLiteralsArtifactScope as2 = symbols2Json.load("target/resources/test/de/monticore/types/check/Personaz.cesym");
as2.setEnclosingScope(gs);

ICombineExpressionsWithLiteralsArtifactScope as3 = symbols2Json.load("src/test/resources/de/monticore/types/check/Iterator.cesym");
ICombineExpressionsWithLiteralsArtifactScope as3 = symbols2Json.load("target/resources/test/de/monticore/types/check/Iterator.cesym");
as3.setEnclosingScope(gs);

ICombineExpressionsWithLiteralsArtifactScope as4 = symbols2Json.load("src/test/resources/de/monticore/types/check/String.cesym");
ICombineExpressionsWithLiteralsArtifactScope as4 = symbols2Json.load("target/resources/test/de/monticore/types/check/String.cesym");
as4.setEnclosingScope(gs);

ICombineExpressionsWithLiteralsArtifactScope as5 = symbols2Json.load("src/test/resources/de/monticore/types/check/Personjl.cesym");
ICombineExpressionsWithLiteralsArtifactScope as5 = symbols2Json.load("target/resources/test/de/monticore/types/check/Personjl.cesym");
as5.setEnclosingScope(gs);
}

Expand Down
Loading
Loading