Aufgrund eines Security Updates wird GitLab heute zwischen 14:30 und 15:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to a security update GitLab will be temporarily unavailable between 2:30 and 3 today.

Added additional error msgs to compile scripts to make debugging/installation easier

parent a9de67d7
Pipeline #106144 passed with stages
in 8 minutes and 24 seconds
......@@ -10,15 +10,16 @@ import java.util.List;
public class BashCompilationGenerator extends CompilationGenerator {
private String PATH_TEMPLATE = "if [ -n \"$<new_exe>_HOME\" ]\n" +
"then\n"+
" export PATH=\"$<new_exe>_HOME:$PATH\"\n"+
"\texport PATH=\"$<new_exe>_HOME:$PATH\"\n" +
"fi";
private String CHECK_EXE_TEMPLATE = "if [[ `command -v <exe>` ]]\n" +
"then\n" +
" echo \"Found <exe>\"\n" +
"\techo \"Found <exe>\"\n" +
"else\n" +
" echo \"Can not find <exe> in PATH! Aborting.\"\n" +
" exit 1\n" +
"\techo \"Can not find <exe> in PATH! Aborting.\"\n" +
"<additional_error>" +
"\texit 1\n" +
"fi";
private String SOURCE_ENV_VARS_TEMPLATE = "source <env_file>";
......@@ -56,6 +57,8 @@ public class BashCompilationGenerator extends CompilationGenerator {
@Override
protected List<String> getAdditionalPathDirs() {
setAdditionalErrorMsg("roscore", defaultErrorMsg("ROS"));
setAdditionalErrorMsg("ros2", defaultErrorMsg("ROS2"));
return Arrays.asList("cmake","make");
}
......
......@@ -2,15 +2,13 @@ package de.monticore.lang.monticar.generator.middleware.compile;
import de.monticore.lang.monticar.generator.FileContent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public abstract class CompilationGenerator {
private boolean useRos = false;
private boolean useRos2 = false;
private Map<String, String> additionalErrorMsg = new HashMap<>();
public abstract boolean supportsRos();
......@@ -20,6 +18,15 @@ public abstract class CompilationGenerator {
return (supportsRos() || !useRos()) && (supportsRos2() || !useRos2());
}
protected void setAdditionalErrorMsg(String executable, String errorMsg) {
additionalErrorMsg.put(executable, errorMsg);
}
protected String getAdditionalErrorMsg(String executable) {
String s = additionalErrorMsg.getOrDefault(executable, defaultErrorMsg(executable));
return "\techo \"" + s + "\"" + getNewlineDelimiter();
}
protected abstract String getPathTemplate();
protected abstract String getCheckExeTemplate();
......@@ -55,7 +62,9 @@ public abstract class CompilationGenerator {
}
protected String fillCheckExeTemplate(String exe) {
return getCheckExeTemplate().replace("<exe>", exe);
return getCheckExeTemplate()
.replace("<exe>", exe)
.replace("<additional_error>", getAdditionalErrorMsg(exe));
}
protected String fillSourceEnvVarsTemplate(String envFile) {
......@@ -107,4 +116,8 @@ public abstract class CompilationGenerator {
res.add(new MsbuildCompilationGenerator());
return res;
}
protected String defaultErrorMsg(String executable) {
return "Try setting the environment variable " + executable + "_HOME to the base of your installation or adding it to your PATH!";
}
}
......@@ -19,6 +19,8 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator {
@Override
protected List<String> getAdditionalPathDirs() {
setAdditionalErrorMsg("vcvars64.bat", defaultErrorMsg("msbuild"));
setAdditionalErrorMsg("ros2", defaultErrorMsg("ROS2"));
return Arrays.asList("cmake","msbuild");
}
......
package de.monticore.lang.monticar.generator.middleware.compile;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.middleware.helpers.FileHelper;
import de.monticore.lang.monticar.generator.middleware.helpers.TemplateHelper;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
import java.util.ArrayList;
import java.util.List;
public abstract class WindowsCompilationGenerator extends CompilationGenerator {
private String PATH_TEMPLATE = "IF NOT [%<new_exe>_HOME%] == [] (\n" +
" set PATH=\"%<new_exe>_HOME%;%PATH%\"\n" +
"\tset PATH=\"%<new_exe>_HOME%;%PATH%\"\n" +
")";
private String CHECK_EXE_TEMPLATE = "where <exe>\n" +
"IF NOT %ERRORLEVEL% EQU 0 (\n" +
" echo \"Can not find <exe> in PATH! Aborting.\"\n" +
" exit /B 1\n" +
"\techo \"Can not find <exe> in PATH! Aborting.\"\n" +
"<additional_error>" +
"\texit /B 1\n" +
")";
private String SOURCE_ENV_VARS_TEMPLATE = "call <env_file>";
......
......@@ -17,6 +17,7 @@ then
echo "Found cmake"
else
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
if [[ `command -v make` ]]
......@@ -24,6 +25,7 @@ then
echo "Found make"
else
echo "Can not find make in PATH! Aborting."
echo "Try setting the environment variable make_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
......
......@@ -14,16 +14,19 @@ IF NOT [%g++_HOME%] == [] (
where cmake
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
where make
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find make in PATH! Aborting."
echo "Try setting the environment variable make_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
where g++
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find g++ in PATH! Aborting."
echo "Try setting the environment variable g++_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
......
......@@ -11,11 +11,13 @@ IF NOT [%msbuild_HOME%] == [] (
where cmake
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
where vcvars64.bat
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find vcvars64.bat in PATH! Aborting."
echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
......@@ -26,6 +28,7 @@ call vcvars64.bat
where msbuild
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find msbuild in PATH! Aborting."
echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
......
......@@ -17,6 +17,7 @@ then
echo "Found cmake"
else
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
if [[ `command -v make` ]]
......@@ -24,6 +25,7 @@ then
echo "Found make"
else
echo "Can not find make in PATH! Aborting."
echo "Try setting the environment variable make_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
......@@ -36,6 +38,7 @@ then
echo "Found roscore"
else
echo "Can not find roscore in PATH! Aborting."
echo "Try setting the environment variable ROS_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
......
......@@ -17,6 +17,7 @@ then
echo "Found cmake"
else
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
if [[ `command -v make` ]]
......@@ -24,6 +25,7 @@ then
echo "Found make"
else
echo "Can not find make in PATH! Aborting."
echo "Try setting the environment variable make_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
......@@ -36,6 +38,7 @@ then
echo "Found ros2"
else
echo "Can not find ros2 in PATH! Aborting."
echo "Try setting the environment variable ROS2_HOME to the base of your installation or adding it to your PATH!"
exit 1
fi
......
......@@ -11,11 +11,13 @@ IF NOT [%msbuild_HOME%] == [] (
where cmake
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find cmake in PATH! Aborting."
echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
where vcvars64.bat
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find vcvars64.bat in PATH! Aborting."
echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
......@@ -27,11 +29,13 @@ call %ROS2_HOME%\local_setup.bat
where msbuild
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find msbuild in PATH! Aborting."
echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
where ros2
IF NOT %ERRORLEVEL% EQU 0 (
echo "Can not find ros2 in PATH! Aborting."
echo "Try setting the environment variable ROS2_HOME to the base of your installation or adding it to your PATH!"
exit /B 1
)
......
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