Skip to content

Recursive compilation #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions app/src/processing/app/debug/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public boolean compile(Sketch sketch,
// 2. compile the libraries, outputting .o files to: <buildPath>/<library>/

sketch.setCompilingProgress(40);

for (File libraryFolder : sketch.getImportedLibraries()) {
copyRecursively(avrBasePath, libraryFolder, buildPath, objectFiles, includePaths, boardPreferences);
}

/*
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zombie code, can be safety removed

for (File libraryFolder : sketch.getImportedLibraries()) {
File outputFolder = new File(buildPath, libraryFolder.getName());
File utilityFolder = new File(libraryFolder, "utility");
Expand All @@ -160,7 +166,8 @@ public boolean compile(Sketch sketch,
// other libraries should not see this library's utility/ folder
includePaths.remove(includePaths.size() - 1);
}

*/

// 3. compile the core, outputting .o files to <buildPath> and then
// collecting them into the core.a library file.

Expand Down Expand Up @@ -250,7 +257,32 @@ public boolean compile(Sketch sketch,

return true;
}



private void copyRecursively(String avrBasePath, File folder, String where, List<File> objectFiles, List includePaths, Map<String, String> boardPreferences) throws RunnerException {
File outputFolder = new File(where, folder.getName());
createFolder(outputFolder);

//if (folder.isDirectory()){
File[] subdirList = folder.listFiles();
if (subdirList != null){ //if it contains folder
for (File child : subdirList) {
copyRecursively(avrBasePath, child, outputFolder.getAbsolutePath(), objectFiles, includePaths, boardPreferences);
}
}
//}

includePaths.add(folder.getAbsolutePath());

objectFiles.addAll(
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
findFilesInFolder(folder, "S", false),
findFilesInFolder(folder, "c", false),
findFilesInFolder(folder, "cpp", false),
boardPreferences));
// other libraries should not see this library's utility/ folder
includePaths.remove(includePaths.size() - 1);
}

private List<File> compileFiles(String avrBasePath,
String buildPath, List<File> includePaths,
Expand Down
2 changes: 1 addition & 1 deletion libraries/Ethernet/Dhcp.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// DHCP Library v0.3 - April 25, 2009
// Author: Jordan Terrell - blog.jordanterrell.com

#include "w5100.h"
#include "utility/w5100.h"

#include <string.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion libraries/Ethernet/Dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// (c) Copyright 2009-2010 MCQN Ltd.
// Released under Apache License, version 2.0

#include "w5100.h"
#include "utility/w5100.h"
#include "EthernetUdp.h"
#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion libraries/Ethernet/Ethernet.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "w5100.h"
#include "utility/w5100.h"
#include "Ethernet.h"
#include "Dhcp.h"

Expand Down
4 changes: 2 additions & 2 deletions libraries/Ethernet/EthernetClient.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "w5100.h"
#include "socket.h"
#include "utility/w5100.h"
#include "utility/socket.h"

extern "C" {
#include "string.h"
Expand Down
4 changes: 2 additions & 2 deletions libraries/Ethernet/EthernetServer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "w5100.h"
#include "socket.h"
#include "utility/w5100.h"
#include "utility/socket.h"
extern "C" {
#include "string.h"
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/Ethernet/EthernetUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* [email protected] 12/30/2008
*/

#include "w5100.h"
#include "socket.h"
#include "utility/w5100.h"
#include "utility/socket.h"
#include "Ethernet.h"
#include "Udp.h"
#include "Dns.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern "C" {
#include "WiFi.h"
#include "WiFiClient.h"
#include "WiFiServer.h"
#include "server_drv.h"
#include "utility/server_drv.h"


uint16_t WiFiClient::_srcport = 1024;
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/WiFiServer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <string.h>
#include "server_drv.h"
#include "utility/server_drv.h"

extern "C" {
#include "utility/debug.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern "C" {
#include "utility/wl_definitions.h"
}

#include "Server.h"
#include "utility/Server.h"

class WiFiClient;

Expand Down
2 changes: 1 addition & 1 deletion libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "twi.h"
#include "utility/twi.h"
}

#include "Wire.h"
Expand Down