Commit 70f8eb21 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'RootModelUppercaseCheck' into 'master'

Added warning if root model name starts with upper case letter

See merge request !32
parents de7ad482 33745d7b
Pipeline #115722 canceled with stages
in 1 minute and 6 seconds
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId> <artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.19-SNAPSHOT</version> <version>0.0.20-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
......
...@@ -134,6 +134,12 @@ public final class DistributedTargetGeneratorCli { ...@@ -134,6 +134,12 @@ public final class DistributedTargetGeneratorCli {
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve(cliParameters.getRootModel(), EMAComponentInstanceSymbol.KIND).orElse(null); EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve(cliParameters.getRootModel(), EMAComponentInstanceSymbol.KIND).orElse(null);
if (componentInstanceSymbol == null) { if (componentInstanceSymbol == null) {
String[] parts = cliParameters.getRootModel().split("\\.");
String componentInstanceName = parts[parts.length - 1];
if(Character.isUpperCase(componentInstanceName.charAt(0))){
parts[parts.length - 1] = componentInstanceName.substring(0,1).toLowerCase() + componentInstanceName.substring(1);
Log.warn("The given ComponentInstance name " + componentInstanceName + " starts with an upper case letter(Invalid). Did you mean " + String.join(".", parts) + "?");
}
Log.error("0x5FFAE: The given component cannot be resolved."); Log.error("0x5FFAE: The given component cannot be resolved.");
return; return;
} }
......
...@@ -4,7 +4,10 @@ import de.monticore.lang.embeddedmontiarc.LogConfig; ...@@ -4,7 +4,10 @@ import de.monticore.lang.embeddedmontiarc.LogConfig;
import de.se_rwth.commons.logging.Finding; import de.se_rwth.commons.logging.Finding;
import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.Log;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.junit.*; import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
...@@ -24,7 +27,7 @@ public class CliTest { ...@@ -24,7 +27,7 @@ public class CliTest {
private static final List<String> VALID_GENERATOR_ALL_OPTION = Arrays.asList("cpp", "roscpp", "odv"); private static final List<String> VALID_GENERATOR_ALL_OPTION = Arrays.asList("cpp", "roscpp", "odv");
private static final String INVALID_MODELS_DIR_OPTION = "src/invalid/resources/"; private static final String INVALID_MODELS_DIR_OPTION = "src/invalid/resources/";
private static final String INVALID_ROOT_MODEL_OPTION = "invalid.invalid.addComp"; private static final String INVALID_ROOT_MODEL_OPTION = "invalid.invalid.AddComp";
private static final List<String> INVALID_GENERATOR_OPTION = Arrays.asList("invalid"); private static final List<String> INVALID_GENERATOR_OPTION = Arrays.asList("invalid");
private static final List<String> INVALID_GENERATOR_EMPTY_OPTION = new ArrayList<>(); private static final List<String> INVALID_GENERATOR_EMPTY_OPTION = new ArrayList<>();
public static final String RESNET_MODELNAME = "tests.emadlTests.resNet34"; public static final String RESNET_MODELNAME = "tests.emadlTests.resNet34";
......
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