Modification des codes de sortie pour les erreurs dans le système de build

This commit is contained in:
Moncef STITI 2025-03-02 15:57:42 +01:00
parent 91484ff5cc
commit 8f79794ddc
4 changed files with 753 additions and 5 deletions

@ -162,7 +162,7 @@ public class BakefileParser {
if (!Files.exists(Paths.get(filename))) { if (!Files.exists(Paths.get(filename))) {
System.out.println("*** No targets specified and no makefile found. Stop."); System.out.println("*** No targets specified and no makefile found. Stop.");
System.exit(1); System.exit(2);
} }
try { try {
@ -192,7 +192,7 @@ public class BakefileParser {
if (line.matches("^ +.*$")) { if (line.matches("^ +.*$")) {
System.err.println(filename + ":" + (i+1) + ": *** missing separator. Stop."); System.err.println(filename + ":" + (i+1) + ": *** missing separator. Stop.");
System.exit(1); System.exit(2);
} }
Matcher varMatcher = VARIABLE_PATTERN.matcher(line); Matcher varMatcher = VARIABLE_PATTERN.matcher(line);

@ -59,12 +59,12 @@ public class CommandExecutor {
if (exitCode != 0) { if (exitCode != 0) {
System.err.println("bake: *** [" + rule.getName() + "] Error " + exitCode); System.err.println("bake: *** [" + rule.getName() + "] Error " + exitCode);
System.exit(exitCode); System.exit(2);
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(2);
} }
} }
} }

@ -55,7 +55,7 @@ public class Rule {
boolean hasRule = BakeEngine.hasRule(dependency); boolean hasRule = BakeEngine.hasRule(dependency);
if (!depFile.exists() && !dependency.isEmpty() && !hasRule) { if (!depFile.exists() && !dependency.isEmpty() && !hasRule) {
System.out.println("bake: *** No rule to make target `" + dependency + "', needed by `" + name + "'. Stop."); System.out.println("bake: *** No rule to make target `" + dependency + "', needed by `" + name + "'. Stop.");
System.exit(1); System.exit(2);
} }
} }

748
tests/BakeTestRunner.java Normal file

File diff suppressed because it is too large Load Diff