From c0a0e49db6249494354eb6c81808cff8374f4d4c Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 14 Oct 2013 11:40:13 +0200 Subject: [PATCH] Ignore folders used by source code control software (subversino, git...) #1619 --- app/src/processing/app/debug/Compiler.java | 18 +++++++++++------- app/src/processing/app/packages/Library.java | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 5a2c1f46d..d9bf5f1f1 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -235,7 +235,7 @@ public class Compiler implements MessageConsumer { File objectFile = new File(objectPath); File dependFile = new File(dependPath); objectPaths.add(objectFile); - if (is_already_compiled(file, objectFile, dependFile, prefs)) + if (isAlreadyCompiled(file, objectFile, dependFile, prefs)) continue; String[] cmd = getCommandCompilerC(includePaths, file.getAbsolutePath(), objectPath); @@ -248,7 +248,7 @@ public class Compiler implements MessageConsumer { File objectFile = new File(objectPath); File dependFile = new File(dependPath); objectPaths.add(objectFile); - if (is_already_compiled(file, objectFile, dependFile, prefs)) + if (isAlreadyCompiled(file, objectFile, dependFile, prefs)) continue; String[] cmd = getCommandCompilerCPP(includePaths, file.getAbsolutePath(), objectPath); @@ -258,10 +258,10 @@ public class Compiler implements MessageConsumer { return objectPaths; } - private boolean is_already_compiled(File src, File obj, File dep, Map prefs) { + private boolean isAlreadyCompiled(File src, File obj, File dep, Map prefs) { boolean ret=true; try { - //System.out.println("\n is_already_compiled: begin checks: " + obj.getPath()); + //System.out.println("\n isAlreadyCompiled: begin checks: " + obj.getPath()); if (!obj.exists()) return false; // object file (.o) does not exist if (!dep.exists()) return false; // dep file (.d) does not exist long src_modified = src.lastModified(); @@ -284,8 +284,8 @@ public class Compiler implements MessageConsumer { String objpath = obj.getCanonicalPath(); File linefile = new File(line); String linepath = linefile.getCanonicalPath(); - //System.out.println(" is_already_compiled: obj = " + objpath); - //System.out.println(" is_already_compiled: line = " + linepath); + //System.out.println(" isAlreadyCompiled: obj = " + objpath); + //System.out.println(" isAlreadyCompiled: line = " + linepath); if (objpath.compareTo(linepath) == 0) { need_obj_parse = false; continue; @@ -308,7 +308,7 @@ public class Compiler implements MessageConsumer { ret = false; // prerequisite modified since object was compiled break; } - //System.out.println(" is_already_compiled: prerequisite ok"); + //System.out.println(" isAlreadyCompiled: prerequisite ok"); } } reader.close(); @@ -575,6 +575,10 @@ public class Compiler implements MessageConsumer { boolean recurse) { List files = new ArrayList(); + if (Library.SOURCE_CONTROL_FOLDERS.contains(folder.getName())) { + return files; + } + if (folder.listFiles() == null) return files; diff --git a/app/src/processing/app/packages/Library.java b/app/src/processing/app/packages/Library.java index 579f58550..fb1931235 100644 --- a/app/src/processing/app/packages/Library.java +++ b/app/src/processing/app/packages/Library.java @@ -35,6 +35,8 @@ public class Library { private static final List OPTIONAL_FILES = Arrays .asList(new String[] { "keywords.txt", "library.properties" }); + public static final List SOURCE_CONTROL_FOLDERS = Arrays.asList(new String[]{"CSV", "RCS", ".git", ".svn", ".hq", ".bzr"}); + /** * Scans inside a folder and create a Library object out of it. Automatically * detects pre-1.5 libraries. Automatically fills metadata from @@ -75,7 +77,7 @@ public class Library { // 3. check if root folder contains prohibited stuff for (File file : libFolder.listFiles()) { if (file.isDirectory()) { - if (!OPTIONAL_FOLDERS.contains(file.getName())) + if (!SOURCE_CONTROL_FOLDERS.contains(file.getName()) && !OPTIONAL_FOLDERS.contains(file.getName())) throw new IOException("Invalid folder '" + file.getName() + "'."); } else { if (!OPTIONAL_FILES.contains(file.getName()))