Commit 10c7773a authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya
Browse files

Parsing root model name

parent 34a977fc
Pipeline #71116 passed with stages
in 4 minutes and 17 seconds
......@@ -33,12 +33,12 @@ masterJobLinux:
only:
- master
#masterJobWindows:
# stage: windows
# script:
# - mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml
# tags:
# - Windows10
masterJobWindows:
stage: windows
script:
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml
tags:
- Windows10
BranchJobLinux:
stage: linux
......
......@@ -32,7 +32,6 @@ import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.symboltable.GlobalScope;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.Splitters;
import de.se_rwth.commons.logging.Log;
import java.io.File;
......@@ -150,7 +149,6 @@ public class CNNArch2MxNet implements CNNArchGenerator {
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
public void generateFiles(ArchitectureSymbol architecture) throws IOException{
CNNArchTemplateController archTc = new CNNArchTemplateController(architecture);
Map<String, String> fileContentMap = generateStrings(architecture);
generateFromFilecontentsMap(fileContentMap);
}
......@@ -182,9 +180,9 @@ public class CNNArch2MxNet implements CNNArchGenerator {
}
public Map<String, String> generateCMakeContent(String rootModelName) {
List<String> splitName = Splitters.DOT.splitToList(rootModelName);
String componentName = splitName.get(splitName.size() - 1);
rootModelName = componentName.substring(0, 1).toLowerCase() + componentName.substring(1);
// model name should start with a lower case letter. If it is a component, replace dot . by _
rootModelName = rootModelName.replace('.', '_').replace('[', '_').replace(']', '_');
rootModelName = rootModelName.substring(0, 1).toLowerCase() + rootModelName.substring(1);
CMakeConfig cMakeConfig = new CMakeConfig(rootModelName);
cMakeConfig.addModuleDependency(new CMakeFindModule("Armadillo", true));
......
......@@ -33,7 +33,6 @@ import org.junit.Test;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
......@@ -195,7 +194,7 @@ public class GenerationTest extends AbstractSymtabTest{
}
@Test
public void testSimpleCfgGeneration() throws IOException, TemplateException {
public void testSimpleCfgGeneration() throws IOException {
Log.getFindings().clear();
List<ConfigurationSymbol> configurations = new ArrayList<>();
List<String> instanceName = Arrays.asList("main_net1", "main_net2");
......@@ -231,7 +230,7 @@ public class GenerationTest extends AbstractSymtabTest{
}
@Test
public void testEmptyCfgGeneration() throws IOException, TemplateException {
public void testEmptyCfgGeneration() throws IOException {
Log.getFindings().clear();
List<ConfigurationSymbol> configurations = new ArrayList<>();
List<String> instanceName = Arrays.asList("main_net1");
......@@ -265,7 +264,7 @@ public class GenerationTest extends AbstractSymtabTest{
@Test
public void testCMakeGeneration() {
Log.getFindings().clear();
String rootModelName = "Alexnet";
String rootModelName = "alexnet";
CNNArch2MxNet generator = new CNNArch2MxNet();
generator.setGenerationTargetPath("./target/generated-sources-cnnarch");
generator.generateCMake(rootModelName);
......@@ -284,4 +283,5 @@ public class GenerationTest extends AbstractSymtabTest{
Arrays.asList(
"FindArmadillo.cmake"));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment