Commit 7fb111c4 authored by Drew's avatar Drew

Add importedPath to Task

collectSources now only optionally calculates relative to a task (atllbuild opts out now)
parent 23603d1a
Pipeline #906 passed with stage
......@@ -15,12 +15,13 @@ import Foundation
/**
* This function resolves wildcards in source descriptions to complete values
* - parameter sourceDescriptions: a descriptions of sources such as ["src/**.swift"] */
* - parameter taskForCalculatingPath: A task relative to which we calculate the path (to handle the import case). If nil, we return what is listed in the atpkg.
* - returns: A list of resolved sources such as ["src/a.swift", "src/b.swift"]
*/
public func collectSources(sourceDescriptions: [String], task: Task) -> [String] {
public func collectSources(sourceDescriptions: [String], taskForCalculatingPath task: Task?) -> [String] {
var sources : [String] = []
for unPrefixedDescription in sourceDescriptions {
let description = task.importedPath + unPrefixedDescription
let description = (task?.importedPath ?? "") + unPrefixedDescription
if description.hasSuffix("**.swift") {
let basepath = String(Array(description.characters)[0..<description.characters.count - 9])
let manager = NSFileManager.defaultManager()
......
......@@ -149,6 +149,8 @@ final public class Package {
appear only by qualified name. */
public var tasks: [String:Task] = [:]
public var importedPath: String
var overlays: [String: [String: ParseValue]] = [:]
var adjustedImportPath: String = ""
......@@ -172,10 +174,6 @@ final public class Package {
return pruned
}
public init(name: String) {
self.name = name
}
/**Create the package.
- parameter filepath: The path to the file to load
- parameter overlay: A list of overlays to apply globally to all tasks in the package. */
......@@ -194,8 +192,9 @@ final public class Package {
}
public init?(type: ParseType, overlay requestedGlobalOverlays: [String], pathOnDisk: String) {
self.importedPath = pathOnDisk
if type.name != "package" { return nil }
if let value = type.properties["name"]?.string { self.name = value }
else {
print("ERROR: No name specified for the package.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment