Ajout de la gestion des timestamps pour les fichiers cibles et dépendances, avec des messages de débogage pour faciliter le suivi des modifications.
This commit is contained in:
parent
459c681a00
commit
5775eee448
src/fr/monlouyan/bakefile
@ -101,9 +101,18 @@ public class Rule {
|
|||||||
System.out.println("Debug : Checking if target file " + name + " exist and is up to date");
|
System.out.println("Debug : Checking if target file " + name + " exist and is up to date");
|
||||||
}
|
}
|
||||||
long targetTimestamp = targetFile.exists() ? TimestampManager.getTimestamp(targetFile) : 0;
|
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) {
|
for (String dependency : dependencies) {
|
||||||
File depFile = new File(dependency);
|
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()) {
|
if (!depFile.exists() && !dependency.isEmpty()) {
|
||||||
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.");
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package fr.monlouyan.bakefile;
|
package fr.monlouyan.bakefile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe utilitaire pour la gestion des timestamps des fichiers.
|
* Classe utilitaire pour la gestion des timestamps des fichiers.
|
||||||
@ -36,4 +38,15 @@ public class TimestampManager {
|
|||||||
long time2 = getTimestamp(file2);
|
long time2 = getTimestamp(file2);
|
||||||
return Long.compare(time1, time2);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user