GradleFx/GradleFx — Issue #18: GradleFx should support adding folders as dependencies
Author: Taytay
Created: 2012-02-13 21:02:50+00:00
State: open

I was trying to do the following in my swc library compilations:

```Groovy
dependencies{
external files("$flexHome/frameworks/libs")
external files("$flexHome/frameworks/libs/mx")
}
```

That's because I wanted to use external linking with the Flex libs when compiling my swcs. It's not until I build my main air project that I use "merged" linking.

However, I was not allowed to add dependencies that were directories, and that was because of AbstractCompileTask.groovy::addLibraries.

Below are the changes I made:

```Groovy
protected void addLibraries(Set libraryFiles, Configuration configuration, String compilerArgument, List compilerArguments) {
libraryFiles.each { dependency ->
//only add swc dependencies, no use in adding pom dependencies

//I removed this line:
// if (dependency.name.endsWith(FlexType.swc.toString())) {
//And I replaced it with this line:
if (dependency.name.endsWith(FlexType.swc.toString()) || dependency.isDirectory()) {
if (!dependency.exists()) {
String errorMessage = "Couldn't find the ${dependency.name} file - are you sure the path is correct? "
errorMessage += "Dependency path: " + dependency.path
throw new ResolveException(configuration, new Throwable(errorMessage))
}

compilerArguments.add(compilerArgument + "+=" + dependency.path);
}
}
}
```

It has worked quite well for me in my build.