Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code sign on copy #324

Merged
merged 2 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions Sources/ProjectSpec/Dependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public struct Dependency: Equatable {
public var type: DependencyType
public var reference: String
public var embed: Bool?
public var codeSign: Bool = true
public var codeSign: Bool?
public var removeHeaders: Bool = true
public var link: Bool = true
public var implicit: Bool = false
Expand All @@ -16,12 +16,14 @@ public struct Dependency: Equatable {
type: DependencyType,
reference: String,
embed: Bool? = nil,
codeSign: Bool? = nil,
link: Bool = true,
implicit: Bool = false
) {
self.type = type
self.reference = reference
self.embed = embed
self.codeSign = codeSign
self.link = link
self.implicit = implicit
}
Expand All @@ -31,17 +33,6 @@ public struct Dependency: Equatable {
case framework
case carthage
}

public var buildSettings: [String: Any] {
var attributes: [String] = []
if codeSign {
attributes.append("CodeSignOnCopy")
}
if removeHeaders {
attributes.append("RemoveHeadersOnCopy")
}
return ["ATTRIBUTES": attributes]
}
}

extension Dependency: JSONObjectConvertible {
Expand All @@ -61,13 +52,11 @@ extension Dependency: JSONObjectConvertible {
}

embed = jsonDictionary.json(atKeyPath: "embed")
codeSign = jsonDictionary.json(atKeyPath: "codeSign")

if let bool: Bool = jsonDictionary.json(atKeyPath: "link") {
link = bool
}
if let bool: Bool = jsonDictionary.json(atKeyPath: "codeSign") {
codeSign = bool
}
if let bool: Bool = jsonDictionary.json(atKeyPath: "removeHeaders") {
removeHeaders = bool
}
Expand Down
20 changes: 17 additions & 3 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,20 @@ public class PBXProjGenerator {

for dependency in target.dependencies {

var embedAttributes: [String] = []

let embed = dependency.embed ?? target.shouldEmbedDependencies
let codeSign = dependency.codeSign ?? (dependency.type != .target)

if codeSign {
embedAttributes.append("CodeSignOnCopy")
}
if dependency.removeHeaders {
embedAttributes.append("RemoveHeadersOnCopy")
}

let embedSettings = ["ATTRIBUTES": embedAttributes]

switch dependency.type {
case .target:
let dependencyTargetName = dependency.reference
Expand Down Expand Up @@ -431,11 +444,12 @@ public class PBXProjGenerator {

if (dependency.embed ?? target.type.isApp) && !dependencyTarget.type.isLibrary {


let embedFile = createObject(
id: dependencyFileReference + target.name,
PBXBuildFile(
fileRef: dependencyFileReference,
settings: dependency.buildSettings
settings: embedSettings
)
)

Expand Down Expand Up @@ -479,7 +493,7 @@ public class PBXProjGenerator {
if embed {
let embedFile = createObject(
id: fileReference + target.name,
PBXBuildFile(fileRef: fileReference, settings: dependency.buildSettings)
PBXBuildFile(fileRef: fileReference, settings: embedSettings)
)
copyFrameworksReferences.append(embedFile.reference)
}
Expand All @@ -502,7 +516,7 @@ public class PBXProjGenerator {
if target.platform == .macOS && embed {
let embedFile = createObject(
id: fileReference + target.name,
PBXBuildFile(fileRef: fileReference, settings: dependency.buildSettings)
PBXBuildFile(fileRef: fileReference, settings: embedSettings)
)
copyFrameworksReferences.append(embedFile.reference)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x45",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x45",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "67x50",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "74x55",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
},
{
"size" : "27x20",
"idiom" : "universal",
"scale" : "2x",
"platform" : "ios"
},
{
"size" : "27x20",
"idiom" : "universal",
"scale" : "3x",
"platform" : "ios"
},
{
"size" : "32x24",
"idiom" : "universal",
"scale" : "2x",
"platform" : "ios"
},
{
"size" : "32x24",
"idiom" : "universal",
"scale" : "3x",
"platform" : "ios"
},
{
"size" : "1024x768",
"idiom" : "ios-marketing",
"scale" : "1x",
"platform" : "ios"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A278a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ObA-dk-sSI">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Messages View Controller-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController id="ObA-dk-sSI" customClass="MessagesViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
<rect key="frame" x="0.0" y="0.0" width="320" height="528"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hello World" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d1e-fi-ked">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="d1e-fi-ked" secondAttribute="centerY" id="H0s-hz-dDP"/>
<constraint firstAttribute="centerX" secondItem="d1e-fi-ked" secondAttribute="centerX" id="wFy-hW-Bib"/>
</constraints>
<viewLayoutGuide key="safeArea" id="LDy-ih-0nr"/>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="528"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// MessagesViewController.swift
// IMessage MessagesExtension
//
// Created by Yonas Kolb on 26/6/18.
//

import UIKit
import Messages

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.
}

}
Loading