Update to 1.10.0

This commit is contained in:
Yonas Kolb 2018-07-03 21:45:00 +10:00
parent 0b7353b909
commit 01815e7e4e
9 changed files with 52 additions and 59 deletions

View File

@ -1,6 +1,6 @@
TOOL_NAME = XcodeGen
export EXECUTABLE_NAME = xcodegen
VERSION = 1.9.0
VERSION = 1.10.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)

View File

@ -282,7 +282,7 @@ extension Target: NamedJSONDictionaryConvertible {
dependencies = try jsonDictionary.json(atKeyPath: "dependencies", invalidItemBehaviour: .fail)
}
transientlyLinkDependencies = jsonDictionary.json(atKeyPath: "transientlyLinkDependencies")
prebuildScripts = jsonDictionary.json(atKeyPath: "prebuildScripts") ?? []
postbuildScripts = jsonDictionary.json(atKeyPath: "postbuildScripts") ?? []
buildRules = jsonDictionary.json(atKeyPath: "buildRules") ?? []

View File

@ -33,7 +33,7 @@ extension PBXProductType {
public var isTest: Bool {
return fileExtension == "xctest"
}
public var isExecutable: Bool {
return isApp || isExtension || isTest
}

View File

@ -6,7 +6,7 @@ import ProjectSpec
import XcodeGenKit
import xcproj
let version = "1.9.0"
let version = "1.10.0"
func generate(spec: String, project: String, isQuiet: Bool, justVersion: Bool) {
if justVersion {

View File

@ -390,7 +390,7 @@ public class PBXProjGenerator {
var copyResourcesReferences: [String] = []
var copyWatchReferences: [String] = []
var extensions: [String] = []
let targetDependencies = (target.transientlyLinkDependencies ?? project.options.transientlyLinkDependencies) ?
getAllDependenciesPlusTransientNeedingEmbedding(target: target) : target.dependencies
@ -444,7 +444,7 @@ public class PBXProjGenerator {
)
targetFrameworkBuildFiles.append(buildFile.reference)
}
let shouldEmbed = target.type.isApp
|| (target.type.isTest && (dependencyTarget.type.isFramework || dependencyTarget.type == .bundle))
if (dependency.embed ?? shouldEmbed) && !dependencyTarget.type.isLibrary {
@ -500,7 +500,7 @@ public class PBXProjGenerator {
)
copyFrameworksReferences.append(embedFile.reference)
}
case .carthage:
var platformPath = Path(getCarthageBuildPath(platform: target.platform))
var frameworkPath = platformPath + dependency.reference
@ -747,7 +747,7 @@ public class PBXProjGenerator {
return frameworks
}
func getAllDependenciesPlusTransientNeedingEmbedding(target topLevelTarget: Target) -> [Dependency] {
// this is used to resolve cyclical target dependencies
var visitedTargets: Set<String> = []
@ -758,15 +758,15 @@ public class PBXProjGenerator {
if visitedTargets.contains(target.name) {
continue
}
let isTopLevel = target == topLevelTarget
for dependency in target.dependencies {
// don't overwrite dependencies, to allow top level ones to rule
if dependencies.contains(reference: dependency.reference) {
continue
}
// don't want a dependency if it's going to be embedded or statically linked in a non-top level target
// in .target check we filter out targets that will embed all of their dependencies
switch dependency.type {
@ -786,10 +786,10 @@ public class PBXProjGenerator {
}
}
}
visitedTargets.update(with: target.name)
}
return dependencies.sorted(by: { $0.key < $1.key }).map { $0.value }
}
}

View File

@ -70,7 +70,7 @@ public class ProjectGenerator {
}
return XCScheme.ExecutionAction(scriptText: action.script, title: action.name, environmentBuildable: environmentBuildable)
}
let target = project.getTarget(scheme.build.targets.first!.target)
let shouldExecuteOnLaunch = target?.type.isExecutable == true

View File

@ -1,71 +1,63 @@
//
// MessagesViewController.swift
// IMessage MessagesExtension
//
// Created by Yonas Kolb on 26/6/18.
//
import UIKit
import Messages
import UIKit
class MessagesViewController: MSMessagesAppViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Conversation Handling
override func willBecomeActive(with conversation: MSConversation) {
// Called when the extension is about to move from the inactive to active state.
// This will happen when the extension is about to present UI.
// Use this method to configure the extension and restore previously stored state.
}
override func didResignActive(with conversation: MSConversation) {
// Called when the extension is about to move from the active to inactive state.
// This will happen when the user dissmises the extension, changes to a different
// conversation or quits Messages.
// Use this method to release shared resources, save user data, invalidate timers,
// and store enough state information to restore your extension to its current state
// in case it is terminated later.
}
override func didReceive(_ message: MSMessage, conversation: MSConversation) {
// Called when a message arrives that was generated by another instance of this
// extension on a remote device.
// Use this method to trigger UI updates in response to the message.
}
override func didStartSending(_ message: MSMessage, conversation: MSConversation) {
// Called when the user taps the send button.
}
override func didCancelSending(_ message: MSMessage, conversation: MSConversation) {
// Called when the user deletes the message without sending it.
// Use this to clean up state related to the deleted message.
}
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
// Called before the extension transitions to a new presentation style.
// Use this method to prepare for the change in presentation style.
}
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
// Called after the extension transitions to a new presentation style.
// Use this method to finalize any behaviors associated with the change in presentation style.
}
}

View File

@ -267,7 +267,7 @@ class ProjectGeneratorTests: XCTestCase {
try expect(dependencies[0].object.target) == nativeTargets.first { $0.object.name == framework.name }!.reference
try expect(dependencies[1].object.target) == nativeTargets.first { $0.object.name == app.name }!.reference
}
$0.it("generates targets with correct transient embeds") {
// App # Embeds it's frameworks, so shouldn't embed in tests
// dependencies:
@ -321,11 +321,11 @@ class ProjectGeneratorTests: XCTestCase {
// - target: iOSFrameworkB
// - carthage: CarthageD
//
var expectedResourceFiles: [String: Set<String>] = [:]
var expectedLinkedFiles: [String: Set<String>] = [:]
var expectedEmbeddedFrameworks: [String: Set<String>] = [:]
let app = Target(
name: "App",
type: .application,
@ -344,7 +344,7 @@ class ProjectGeneratorTests: XCTestCase {
expectedEmbeddedFrameworks[app.name] = Set([
"FrameworkA.framework",
])
let staticLibrary = Target(
name: "StaticLibrary",
type: .staticLibrary,
@ -355,7 +355,7 @@ class ProjectGeneratorTests: XCTestCase {
expectedResourceFiles[staticLibrary.name] = Set()
expectedLinkedFiles[staticLibrary.name] = Set([])
expectedEmbeddedFrameworks[staticLibrary.name] = Set()
let resourceBundle = Target(
name: "ResourceBundle",
type: .bundle,
@ -365,7 +365,7 @@ class ProjectGeneratorTests: XCTestCase {
expectedResourceFiles[resourceBundle.name] = Set()
expectedLinkedFiles[resourceBundle.name] = Set()
expectedEmbeddedFrameworks[resourceBundle.name] = Set()
let iosFrameworkA = Target(
name: "iOSFrameworkA",
type: .framework,
@ -387,7 +387,7 @@ class ProjectGeneratorTests: XCTestCase {
"CarthageB.framework",
])
expectedEmbeddedFrameworks[iosFrameworkA.name] = Set()
let iosFrameworkB = Target(
name: "iOSFrameworkB",
type: .framework,
@ -415,7 +415,7 @@ class ProjectGeneratorTests: XCTestCase {
expectedEmbeddedFrameworks[iosFrameworkB.name] = Set([
"FrameworkE.framework",
])
let appTest = Target(
name: "AppTest",
type: .unitTestBundle,
@ -443,7 +443,7 @@ class ProjectGeneratorTests: XCTestCase {
iosFrameworkB.filename,
"FrameworkD.framework",
])
var appTestWithoutTransient = appTest
appTestWithoutTransient.name = "AppTestWithoutTransient"
appTestWithoutTransient.transientlyLinkDependencies = false
@ -455,9 +455,9 @@ class ProjectGeneratorTests: XCTestCase {
expectedEmbeddedFrameworks[appTestWithoutTransient.name] = Set([
iosFrameworkB.filename,
])
let targets = [app, staticLibrary, resourceBundle, iosFrameworkA, iosFrameworkB, appTest, appTestWithoutTransient]
let project = Project(
basePath: "",
name: "test",
@ -465,7 +465,7 @@ class ProjectGeneratorTests: XCTestCase {
options: SpecOptions(transientlyLinkDependencies: true)
)
let pbxProject = try project.generatePbxProj()
for target in targets {
guard let nativeTarget = pbxProject.objects.nativeTargets.referenceValues.first(where: { $0.name == target.name }) else {
throw failure("PBXNativeTarget for \(target) not found")
@ -474,7 +474,7 @@ class ProjectGeneratorTests: XCTestCase {
let resourcesPhases = pbxProject.objects.resourcesBuildPhases.objectReferences.filter { buildPhases.contains($0.reference) }
let frameworkPhases = pbxProject.objects.frameworksBuildPhases.objectReferences.filter { buildPhases.contains($0.reference) }
let copyFilesPhases = pbxProject.objects.copyFilesBuildPhases.objectReferences.filter { buildPhases.contains($0.reference) }
// ensure only the right resources are copies, no more, no less
let expectedResourceFiles = expectedResourceFiles[target.name]!
try expect(resourcesPhases.count) == (expectedResourceFiles.isEmpty ? 0 : 1)
@ -483,7 +483,7 @@ class ProjectGeneratorTests: XCTestCase {
.compactMap { pbxProject.objects.buildFiles[$0]?.fileRef.flatMap { pbxProject.objects.fileReferences[$0]?.nameOrPath } }
try expect(Set(resourceFiles)) == expectedResourceFiles
}
// ensure only the right things are linked, no more, no less
let expectedLinkedFiles = expectedLinkedFiles[target.name]!
try expect(frameworkPhases.count) == (expectedLinkedFiles.isEmpty ? 0 : 1)
@ -492,7 +492,7 @@ class ProjectGeneratorTests: XCTestCase {
.compactMap { pbxProject.objects.buildFiles[$0]?.fileRef.flatMap { pbxProject.objects.fileReferences[$0]?.nameOrPath } }
try expect(Set(linkFrameworks)) == expectedLinkedFiles
}
// ensure only the right things are embedded, no more, no less
let expectedEmbeddedFrameworks = expectedEmbeddedFrameworks[target.name]!
try expect(copyFilesPhases.count) == (expectedEmbeddedFrameworks.isEmpty ? 0 : 1)
@ -557,10 +557,12 @@ class ProjectGeneratorTests: XCTestCase {
action: .script("do thing"),
name: "My Rule",
outputFiles: ["file1.swift", "file2.swift"],
outputFilesCompilerFlags: ["--zee", "--bee"]),
outputFilesCompilerFlags: ["--zee", "--bee"]
),
BuildRule(
fileType: .pattern("*.plist"),
action: .compilerSpec("com.apple.build-tasks.copy-plist-file"))
action: .compilerSpec("com.apple.build-tasks.copy-plist-file")
),
]
let pbxProject = try scriptSpec.generatePbxProj()
@ -585,7 +587,6 @@ class ProjectGeneratorTests: XCTestCase {
try expect(second.script).beNil()
try expect(second.outputFiles) == []
try expect(second.outputFilesCompilerFlags) == []
}
}
}

View File

@ -409,8 +409,8 @@ class SpecLoadingTests: XCTestCase {
$0.it("decodes dots in dictionary keys") {
let dictionary: [String: Any] = [
"test": [
"one.two": true
]
"one.two": true,
],
]
let booleans: [String: Bool] = try dictionary.json(atKeyPath: "test")