Commits

Stephen McKamey committed b0a5666

better ensuring dependency maps get rebuild on dirty builds

  • Participants
  • Parent commits b6b657a

Comments (0)

Files changed (4)

File merge-builder/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>merge-builder</artifactId>
-	<version>0.5.1</version>
+	<version>0.5.2</version>
 	<packaging>jar</packaging>
 
 	<name>DUEL Merge Builder</name>

File merge-builder/src/main/java/org/duelengine/merge/BuildManager.java

 		writeChildLinksMap();
 	}
 
-	private boolean isHashCalculated(String path) {
+	public boolean isProcessed(String path) {
 		return hashLookup.containsKey(path);
 	}
 
 
 	public void ensureProcessed(String path) {
 
-		if (isHashCalculated(path) && getTargetFile(path).exists()) {
+		if (isProcessed(path) && getTargetFile(path).exists()) {
 			return;
 		}
 
 				return;
 			}
 	
-			if (!isHashCalculated(path)) {
+			File target;
+			if (isProcessed(path)) {
+				target = getTargetFile(path);
+
+			} else {
 				MessageDigest hash = MessageDigest.getInstance(HASH_ALGORITHM);
 				if (source != null && source.exists()) {
 					compactor.calcHash(this, hash, path, source);
 				String hashPath = encodeBytes(hash.digest());
 				String targetExt = compactor.getTargetExtension(this, path);
 				setProcessedPath(path, settings.getCDNRoot()+hashPath+targetExt);
+
+				target = getTargetFile(path);
+				if (source.exists()) {
+					// ensure target path exists
+					target.getParentFile().mkdirs();
+		
+					// ensure the file has been compacted
+					compactor.compact(this, path, source, target);
+				}
 			}
-	
-			File target = getTargetFile(path);
-			if (!target.exists() && source.exists()) {
-				// ensure target path exists
-				target.getParentFile().mkdirs();
-	
-				// ensure the file has been compacted
-				compactor.compact(this, path, source, target);
-			}
-	
+
 			if (!target.exists()) {
 				// file still missing, remove
 				log.error(path+" failed to compact (output missing)");

File merge-builder/src/main/java/org/duelengine/merge/MergeCompactor.java

 class MergeCompactor implements Compactor {
 
 	private static final int BUFFER_SIZE = 4096;
-	private static final String CHAR_ENCODING = "utf-8";
+	private static final String CHAR_ENCODING = "UTF-8";
 	private static final String EXT = ".merge";
 	private final Logger log = LoggerFactory.getLogger(MergeCompactor.class);
 	private final Map<String, PlaceholderGenerator> placeholders;
 		log.info("Building "+path);
 		String outputPath = manager.getProcessedPath(path);
 
-		if (target.exists()) {
+		if (manager.isProcessed(path) && target.exists()) {
 			log.info("- exists: "+outputPath);
 			return;
 		}
 		}
 
 		File target = manager.getTargetFile(hashPath);
-		if (target.exists()) {
+		if (manager.isProcessed(path) && target.exists()) {
 			return;
 		}
 

File merge-maven-plugin/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>merge-maven-plugin</artifactId>
-	<version>0.5.1</version>
+	<version>0.5.2</version>
 	<packaging>maven-plugin</packaging>
 
 	<name>DUEL Merge Maven Plugin</name>