Commit 3aae84b1 authored by Drew's avatar Drew

Convert to atfoundation

parent 20305250
Subproject commit 80d55a942bc24e9f0b6ccfd9470ea9a125794bc5
Subproject commit c42d4e01d7bd3cc93bdb0b122ae11bd8f67017f7
......@@ -24,8 +24,10 @@
:sources ["src/**.swift"]
:name "xcode_emit"
:output-type "executable"
:dependencies ["atpkg.atpkg"]
:link-with ["atpkg.a"]
:dependencies ["atpkg.atpkg" "atfoundation.atfoundation"]
:link-with ["atpkg.a" "atfoundation.a"]
:link-options ["-static-stdlib"]
:publish-product true
}
:default {
......
......@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
import atfoundation
enum OutputType {
case Executable
......@@ -25,12 +25,11 @@ func emit(task: Task, package: Package) {
precondition(task.tool == "atllbuild", "Unsupported tool \(task.tool)")
//make the xcodeproj directory
guard let taskname = task["name"]?.string else { fatalError("No task name.")}
let xcodeproj = taskname+".xcodeproj"
let manager = NSFileManager.defaultManager()
let _ = try? manager.removeItem(atPath: xcodeproj)
try! manager.createDirectory(atPath: xcodeproj, withIntermediateDirectories: false, attributes: nil)
let xcodeproj = Path(taskname+".xcodeproj")
let _ = try? FS.removeItem(path: xcodeproj, recursive: true)
try! FS.createDirectory(path: xcodeproj)
let str = pbxproj(task: task, package: package)
try! str.write(toFile: "\(xcodeproj)/project.pbxproj", atomically: false, encoding: NSUTF8StringEncoding)
try! str.write(to: Path("\(xcodeproj)/project.pbxproj"))
}
func process(tasks: [Task], package: Package) -> [PbxprojSerializable] {
......@@ -93,7 +92,7 @@ func process(tasks: [Task], package: Package) -> [PbxprojSerializable] {
type = PbxProductReference.ReferenceType.Executable
}
let product = PbxProductReference(name: taskname, type:type)
let sourceRefs = sources.map() {PbxSourceFileReference(path:$0)}
let sourceRefs = sources.map() {PbxSourceFileReference(path:$0.description)}
......
......@@ -14,9 +14,11 @@
let version = "0.3.0-dev"
import Foundation
import atfoundation
import atpkg
setbuf(stdout, nil)
func usage() {
print("xcode-emit \(version)")
print("© 2016 Anarchy Tools Contributors.")
......@@ -41,7 +43,7 @@ for (x,arg) in Process.arguments.enumerated() {
let taskName = Process.arguments[1]
let package = try! Package(filepath:"build.atpkg", overlay: [], focusOnTask:taskName)
let package = try! Package(filepath:Path("build.atpkg"), overlay: [], focusOnTask:taskName)
guard let task = package.tasks[taskName] else { fatalError("Can't find task named \(taskName)")}
......
......@@ -11,9 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
var iosPlatform = false
import Darwin
import atfoundation
......@@ -321,7 +321,7 @@ struct PbxNativeTarget: PbxprojSerializable {
s += "</dict>\n"
s += "</plist>\n"
let plistName = "\(productReference.name)-xcode-emit-Info.plist"
try! s.write(toFile: plistName, atomically: false, encoding: NSUTF8StringEncoding)
try! s.write(to: Path(plistName))
self.otherFiles = [PbxPlistFileReference(path: plistName)]
self.configurationList = PbxTargetConfigurations(plistPath: plistName)
}
......
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