             }
         }
 
+        // load external dependencies
+        if let externalDeps = type.properties["externals"]?.vector {
+            for dep in externalDeps {
+                guard let d = dep.map else { fatalError("Non-Map external dependency declaration") }
+                guard let url = d["url"]?.string else { fatalError("No URL in dependency declaration") }
+                var externalDep: ExternalDependency? = nil
+                if let version = d["version"]?.string {
+                    externalDep = ExternalDependency(url: url, version: version)
+                } else if let branch = d["branch"]?.string {
+                    externalDep = ExternalDependency(url: url, branch: branch)
+                } else if let commit = d["commit"]?.string {
+                    externalDep = ExternalDependency(url: url, commit: commit)
+                }
+                if let externalDep = externalDep {
+                    // add to external deps
+                    self.externals.append(externalDep)
+                    var importFileString = "external/" + externalDep.name + "/build.atpkg"
+                    
+                    // import the atbuild file if it is there
+                    let adjustedImportPath = (pathOnDisk.pathWithTrailingSlash + importFileString).toNSString.stringByDeletingLastPathComponent.pathWithTrailingSlash
+                    let adjustedFileName = importFileString.toNSString.lastPathComponent
+                    if let remotePackage = Package(filepath: adjustedImportPath + adjustedFileName, overlay: requestedGlobalOverlays) {
+                        remotePackage.adjustedImportPath = adjustedImportPath
+                        remotePackages.append(remotePackage)
+                    } else {
+                        print("Unsatisfied external dependency: \(externalDep.name), run atpm fetch")
+                    }
+                } else {
+                    fatalError("Could not parse external dependency declaration for \(url)")
+                }
+            }
+        }
+
+        
         //load remote overlays
         for remotePackage in remotePackages {
             for (overlayName, value) in remotePackage.overlays {

    var appliedOverlays: [String] = [] ///The overlays we did apply to this task

    var declaredOverlays: [String: [String: ParseValue]] = [:] ///The overlays this task declares
    
    public var allKeys: [String]
    
    private var kvp: [String:ParseValue]

    init?(value: ParseValue, name: String, importedPath: String) {

// limitations under the License.
import Foundation

final public class ExternalDependency {
    public enum VersioningMethod {
        case Version(major: Range<Int>, minor: Range<Int>)
        case Commit(String)
        case Branch(String)
    }

    public var gitURL: String
    public var version: VersioningMethod
    
    public var name: String {
        let lastComponent = gitURL.toNSString.lastPathComponent
        if lastComponent.hasSuffix(".git") {
            return lastComponent.substringToIndex(lastComponent.startIndex.advancedBy(lastComponent.characters.count - 4))
        }
        return lastComponent
    }

    init?(url: String, version: String) {
        print("Not implemented yet")
        self.gitURL = url
        self.version = .Version(major: 0...0, minor: 0...0)
    }

    init?(url: String, commit: String) {
        self.gitURL = url
        self.version = .Commit(commit)
    }

    init?(url: String, branch: String) {
        self.gitURL = url
        self.version = .Branch(branch)
    }
}

final public class Task {
    public var key: String = ""
    public var dependencies: [String] = []
