diff --git a/src/fr/monlouyan/bakefile/Rule.java b/src/fr/monlouyan/bakefile/Rule.java index 0b1b01c..a3218c2 100644 --- a/src/fr/monlouyan/bakefile/Rule.java +++ b/src/fr/monlouyan/bakefile/Rule.java @@ -101,9 +101,18 @@ public class Rule { System.out.println("Debug : Checking if target file " + name + " exist and is up to date"); } long targetTimestamp = targetFile.exists() ? TimestampManager.getTimestamp(targetFile) : 0; + + if (BakeCLI.isDebug()) { + System.out.println("Debug : Target file '" + name + "' last modified at " + TimestampManager.formatTimestamp(targetTimestamp)); + } for (String dependency : dependencies) { File depFile = new File(dependency); + long depTimestamp = depFile.exists() ? TimestampManager.getTimestamp(depFile) : 0; + + if (BakeCLI.isDebug()) { + System.out.println("Debug : Dependency '" + dependency + "' last modified at " + TimestampManager.formatTimestamp(depTimestamp)); + } if (!depFile.exists() && !dependency.isEmpty()) { System.out.println("bake: *** No rule to make target '" + dependency + "', needed by '" + name + "'. Stop."); diff --git a/src/fr/monlouyan/bakefile/TimestampManager.java b/src/fr/monlouyan/bakefile/TimestampManager.java index fc37bda..6ffac34 100644 --- a/src/fr/monlouyan/bakefile/TimestampManager.java +++ b/src/fr/monlouyan/bakefile/TimestampManager.java @@ -1,6 +1,8 @@ package fr.monlouyan.bakefile; import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; /** * Classe utilitaire pour la gestion des timestamps des fichiers. @@ -36,4 +38,15 @@ public class TimestampManager { long time2 = getTimestamp(file2); return Long.compare(time1, time2); } + + /** + * Permet de formater un timestamp en une date lisible. + * @param timestamp Le timestamp à formater + * @return La date formatée + */ + public static String formatTimestamp(long timestamp) { + if (timestamp == 0) return "N/A"; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(new Date(timestamp)); + } }