Added warning if root model name starts with upper case letter

parent de7ad482
Pipeline #110659 passed with stages
in 15 minutes and 47 seconds
......@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.19-SNAPSHOT</version>
<version>0.0.20-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......
......@@ -134,6 +134,12 @@ public final class DistributedTargetGeneratorCli {
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve(cliParameters.getRootModel(), EMAComponentInstanceSymbol.KIND).orElse(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.");
return;
}
......
......@@ -4,7 +4,10 @@ import de.monticore.lang.embeddedmontiarc.LogConfig;
import de.se_rwth.commons.logging.Finding;
import de.se_rwth.commons.logging.Log;
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.Paths;
......@@ -24,7 +27,7 @@ public class CliTest {
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_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_EMPTY_OPTION = new ArrayList<>();
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