1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

Ignore folders used by source code control software (subversino, git...) #1619

This commit is contained in:
Federico Fissore 2013-10-14 11:40:13 +02:00
parent e548f3111c
commit c0a0e49db6
2 changed files with 14 additions and 8 deletions

View File

@ -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<String, String> prefs) {
private boolean isAlreadyCompiled(File src, File obj, File dep, Map<String, String> 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<File> files = new ArrayList<File>();
if (Library.SOURCE_CONTROL_FOLDERS.contains(folder.getName())) {
return files;
}
if (folder.listFiles() == null)
return files;

View File

@ -35,6 +35,8 @@ public class Library {
private static final List<String> OPTIONAL_FILES = Arrays
.asList(new String[] { "keywords.txt", "library.properties" });
public static final List<String> 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()))