Unverified Commit d7c0b2b3 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #6966 from CocoaPods/dani_static_swift

Swift Static Library support
parents 8307a689 11c9226f
......@@ -40,6 +40,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[iv-mexx](https://github.com/iv-mexx)
[#7372](https://github.com/CocoaPods/CocoaPods/issues/7372)
* Add support for integrating swift pods as static libraries.
[Danielle Tomlinson](https://github.com/dantoml)
[Samuel Giddins](https://github.com/segiddins)
[#6899](https://github.com/CocoaPods/CocoaPods/issues/6899)
##### Bug Fixes
* Clear input/output paths if they exceed an arbitrary limit
......
......@@ -152,8 +152,6 @@
F8129BF71591061B009BFE23 /* Sources */,
F8129BF81591061B009BFE23 /* Frameworks */,
F8129BF91591061B009BFE23 /* Resources */,
CC1632E381344B54BA63986B /* [CP] Copy Pods Resources */,
F0DC30B6798CF042746A5614 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
......@@ -220,36 +218,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
CC1632E381344B54BA63986B /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking Example/Pods-AFNetworking Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F0DC30B6798CF042746A5614 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking Example/Pods-AFNetworking Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......
......@@ -227,8 +227,6 @@
F8E4695C1395739C00DB05C8 /* Sources */,
F8E4695D1395739C00DB05C8 /* Frameworks */,
F8E4695E1395739C00DB05C8 /* Resources */,
226FE837057C4F98AD9FFB32 /* [CP] Copy Pods Resources */,
CB0CF751F97DB411456460D5 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
......@@ -284,36 +282,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
226FE837057C4F98AD9FFB32 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking iOS Example/Pods-AFNetworking iOS Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CB0CF751F97DB411456460D5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking iOS Example/Pods-AFNetworking iOS Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E4419DF1E8B742E49777FFE0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
......@@ -109,7 +109,6 @@
F8111E0219A951050040E7D1 /* Frameworks */,
F8111E0319A951050040E7D1 /* Resources */,
232F8168EB8673C9D2405BA7 /* [CP] Embed Pods Frameworks */,
B81850C1CB84CCCCFC8FFC52 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -202,21 +201,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
B81850C1CB84CCCCFC8FFC52 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOS Example/Pods-iOS Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......
......@@ -91,7 +91,6 @@
295BB55B1CEA95DE00E79F82 /* Frameworks */,
295BB55C1CEA95DE00E79F82 /* Resources */,
6E2B4891468DB661A63F8065 /* [CP] Embed Pods Frameworks */,
0B71E1EA08FB405324201E97 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -147,21 +146,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0B71E1EA08FB405324201E97 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-App/Pods-App-resources.sh\"\n";
showEnvVarsInLog = 0;
};
62E9CD52D31153978437D4C2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
Pod::Spec.new do |s|
s.name = "CustomModuleMapPod"
s.version = "0.0.1"
s.summary = "A long description of CustomModuleMapPod."
s.source = { :git => "http://foo/CustomModuleMapPod.git", :tag => "#{s.version}" }
s.authors = ['me']
s.homepage = 'http://example.com'
s.license = 'proprietary'
s.source_files = "src/**/*.{h,m,swift}"
s.private_header_files = "src/Private/*.h"
s.module_map = "src/CustomModuleMapPod.modulemap"
s.ios.deployment_target = '9.0'
s.macos.deployment_target = '10.10'
end
#import <CustomModuleMapPod/CMMFunctions.h>
@import Foundation;
@interface CMM : NSObject
+ (void)log;
@end
#import <CustomModuleMapPod/CMM.h>
#import <CustomModuleMapPod/CMM+Private.h>
#import <CustomModuleMapPod/CMMFunctions.h>
#import <Foundation/Foundation.h>
@implementation CMM
+ (void)log { NSLog(@"module maps are the wurst"); }
@end
void CMM_doThing(void) {
NSLog(@"CMM doing thing");
}
extern void CMM_doThing(void);
\ No newline at end of file
framework module CustomModuleMapPod {
umbrella header "CMM.h"
explicit module Private {
header "CMM+Private.h"
}
export *
module * { export * }
}
#import <CustomModuleMapPod/CMM.h>
@interface CMM (PrivateExtension)
@end
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:iOS Modules.xcodeproj">
</FileRef>
<FileRef
location = "group:macOS Modules.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
Pod::Spec.new do |s|
s.name = "MixedPod"
s.version = "0.0.1"
s.summary = "A long description of objc."
s.source = { :git => "http://foo/objc.git", :tag => "#{s.version}" }
s.authors = ['me']
s.homepage = 'http://example.com'
s.license = 'proprietary'
s.source_files = "src/**/*.{h,m,swift}"
s.public_header_files = "src/**/*.h"
s.dependency 'ObjCPod'
s.dependency 'SwiftPod'
s.ios.deployment_target = '9.0'
s.macos.deployment_target = '10.10'
end
@import Foundation;
@interface BCE : NSObject
+ (void)meow;
@end
#import <MixedPod/bce.h>
#if __has_include(<MixedPod/MixedPod-Swift.h>)
# import <MixedPod/MixedPod-Swift.h>
#else
// This really shouldn't be neccessary (ideally the first would just work)
// Additionally, it shouldn't show as "not found" in the navigator
# import "MixedPod-Swift.h"
#endif
@import ObjCPod;
@import SwiftPod;
#import <Foundation/Foundation.h>
@implementation BCE
+ (void)meow {
id a = [ABC new]; // from ObjCPod
[[XYZ new] doThing:@"in bce.m"]; // from SwiftPod
NSLog(@"meow meow");
(void)[[Foo alloc] initWithS:a]; // from MixedPod
}
@end
import SwiftPod
import ObjCPod
func testImportedThings() {
print(XYZStruct(name: "string"))
print(ABC())
}
public func superMeow() -> BCE {
testImportedThings()
BCE.meow()
return BCE()
}
@objc public
class Foo: NSObject {
@objc public
init(s: AnyObject) {
print("Initializing with \(s)")
}
}
Pod::Spec.new do |s|
s.name = "ObjCPod"
s.version = "0.0.1"
s.summary = "A long description of objc."
s.source = { :git => "http://foo/objc.git", :tag => "#{s.version}" }
s.authors = ['me']
s.homepage = 'http://example.com'
s.license = 'proprietary'
s.source_files = "src/**/*.{h,m,swift}"
s.private_header_files = "src/Private/*.h"
s.public_header_files = "src/**/*.h"
s.ios.deployment_target = '9.0'
s.macos.deployment_target = '10.10'
end
@interface ABC (Private)
+ (void)barkSuperLoudly;
@end
\ No newline at end of file
@interface ABC : NSObject
+ (void)bark;
@end
\ No newline at end of file
#import <ObjCPod/abc.h>
#import "abc_private.h"
#import <Foundation/Foundation.h>
@implementation ABC
+ (void)bark { NSLog(@"woof woof"); }
+ (void)barkSuperLoudly { NSLog(@"WOOF WOOF"); }
@end
workspace 'Examples.xcworkspace'
abstract_target 'Abstract Target' do
use_modular_headers!
pod 'ObjCPod', path: 'ObjCPod'
pod 'SwiftPod', path: 'SwiftPod'
pod 'MixedPod', path: 'MixedPod'
pod 'CustomModuleMapPod', path: 'CustomModuleMapPod'
pod 'Alamofire', path: '../Alamofire Example/Alamofire'
%w[iOS macOS].each do |platform|
abstract_target "#{platform} Pods" do
project "#{platform} Modules.xcodeproj"
case platform
when 'iOS' then self.platform :ios, '10.0'
when 'macOS' then self.platform :macos, '10.10'
end
target 'Static' do
use_frameworks!(false)
end
target 'Dynamic' do
use_frameworks!(true)
end
end
end
end
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
#if os(iOS)
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
}
#elseif os(macOS)
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
}
}
#endif
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<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>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<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>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
//
// ModelThing.h
// Static Swift
//
// Created by Samuel Giddins on 1/23/18.
// Copyright © 2018 Samuel Giddins. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ModelThing : NSObject
+ (instancetype)copy;
@end
//
// ModelThing.m
// Static Swift
//
// Created by Samuel Giddins on 1/23/18.
// Copyright © 2018 Samuel Giddins. All rights reserved.
//
#import "ModelThing.h"
@import MixedPod;
@import SwiftPod;
@import ObjCPod;
@import CustomModuleMapPod;
@import CustomModuleMapPod.Private;
@implementation ModelThing
+ (instancetype)copy {
[CMM log]; // CustomModuleMapPod
CMM_doThing(); // CustomModuleMapPod.Private
[BCE meow]; // MixedPod
[ABC bark]; // ObjCPod
[XYZ.new doThing:@"objc thing?"]; // from SwiftPod
return [self.class new];
}
@end
#if os(iOS)
import UIKit
typealias BaseViewController = UIViewController
#elseif os(macOS)
import AppKit
typealias BaseViewController = NSViewController
#endif
import ObjCPod
import SwiftPod
import MixedPod
import Alamofire
class ViewController: BaseViewController {
#if os(iOS)
override func viewDidAppear(_ animated: Bool) {
doThings()
}
#endif
func doThings() {
ABC.bark() // ObjCPod
print(XYZStruct(name: "")) // SwiftPod
XYZ().doThing("thiiiing") // SwiftPod
print(superMeow()) // MixedPod
BCE.meow() // MixedPod
print(NSClassFromString("ModelThing")?.copy() as Any) // App, done this way to avoid using a bridging header
networkRequest()
}
func networkRequest() {
Alamofire.request("https://httpbin.org/get").responseJSON { response in
print("\n\nAlamofire:\n")
print("Request: \(String(describing: response.request))") // original url request
if let json = response.result.value {
print("JSON: \(json)") // serialized json response
}
}
}
}
Pod::Spec.new do |s|
s.name = "SwiftPod"
s.version = "0.0.1"
s.summary = "A long description of objc."
s.source = { :git => "http://foo/objc.git", :tag => "#{s.version}" }
s.authors = ['me']
s.homepage = 'http://example.com'
s.license = 'proprietary'
s.source_files = "src/**/*.{h,m,swift}"
s.public_header_files = "src/**/*.h"
s.ios.deployment_target = '9.0'
s.macos.deployment_target = '10.10'
end
import Foundation
private func doTheThing() {
print("doing the thing!")
}
@objc public
class XYZ : NSObject {
@objc public
func doThing(_ x: String) {
print("do thing \(x):")
doTheThing()
}
}
public struct XYZStruct {
public let name: String
public init(name: String) { self.name = name }
}
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:iOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248FA2016AE3A009EF3DE"
BuildableName = "Dynamic.app"
BlueprintName = "Dynamic"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C06248E42016A708009EF3DE"
BuildableName = "Static.app"
BlueprintName = "Static"
ReferencedContainer = "container:macOS Modules.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -115,7 +115,6 @@
A8C77C4C1C9DA931000AFF69 /* Frameworks */,
A8C77C4D1C9DA931000AFF69 /* Resources */,
E1D153F1317B0ED8A0A98DE0 /* [CP] Embed Pods Frameworks */,
41F27F05FA87A7FE9EA1A2BF /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -172,21 +171,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
41F27F05FA87A7FE9EA1A2BF /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Resource Bundle Example/Pods-Resource Bundle Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8FB5EE32BFE997FC437DE638 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
......@@ -154,7 +154,6 @@
F58833CB1CBBC0C9007D4DA4 /* Sources */,
F58833CC1CBBC0C9007D4DA4 /* Frameworks */,
F58833CD1CBBC0C9007D4DA4 /* Resources */,
2D7DA37C114DD6E56D290D94 /* [CP] Embed Pods Frameworks */,
BEB56E0CAF877FA9577BF299 /* [CP] Copy Pods Resources */,
);
buildRules = (
......@@ -174,7 +173,6 @@
F58833E41CBBC0C9007D4DA4 /* Sources */,
F58833E51CBBC0C9007D4DA4 /* Frameworks */,
F58833E61CBBC0C9007D4DA4 /* Resources */,
6D3C9E5647F2F9BE1B8CA805 /* [CP] Embed Pods Frameworks */,
23FBFF6CF467540E5F102610 /* [CP] Copy Pods Resources */,
);
buildRules = (
......@@ -347,36 +345,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TestInclusionsPods-TestInclusionsTests/Pods-TestInclusionsPods-TestInclusionsTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
2D7DA37C114DD6E56D290D94 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TestInclusionsPods-TestInclusions/Pods-TestInclusionsPods-TestInclusions-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
6D3C9E5647F2F9BE1B8CA805 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TestInclusionsPods-TestInclusionsTests/Pods-TestInclusionsPods-TestInclusionsTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BEB56E0CAF877FA9577BF299 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
......@@ -100,7 +100,6 @@
5CAF4FE51CC1125900B44520 /* Frameworks */,
5CAF4FE61CC1125900B44520 /* Resources */,
4697BF2DD055B93C3DE0E375 /* [CP] Embed Pods Frameworks */,
9C2933733E94154FB1F30218 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -196,21 +195,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Vendored Framework Example/Pods-Vendored Framework Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9C2933733E94154FB1F30218 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Vendored Framework Example/Pods-Vendored Framework Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......
......@@ -206,7 +206,6 @@
A129F8BE1B2CA81600EBC1DD /* Resources */,
A129F8F61B2CA81700EBC1DD /* Embed Watch Content */,
B55D105F75FDCEAD4A12BE64 /* [CP] Embed Pods Frameworks */,
1E232F64274BFFA8F587E155 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -245,7 +244,6 @@
A865B2771CAF18FF0031EFC6 /* Frameworks */,
A865B2781CAF18FF0031EFC6 /* Resources */,
766BB1279F3F20E30F8D82AC /* [CP] Embed Pods Frameworks */,
9404B5E651690A16E40B8F95 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -328,21 +326,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1E232F64274BFFA8F587E155 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOSsample/Pods-watchOSsample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
1E8987D060C89B71B6F2E504 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -397,21 +380,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9404B5E651690A16E40B8F95 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOSsample WatchKit Extension/Pods-watchOSsample WatchKit Extension-resources.sh\"\n";
showEnvVarsInLog = 0;
};
B55D105F75FDCEAD4A12BE64 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
......@@ -57,6 +57,7 @@ module Pod
autoload :Markdown, 'cocoapods/generator/acknowledgements/markdown'
autoload :Plist, 'cocoapods/generator/acknowledgements/plist'
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
autoload :Constant, 'cocoapods/generator/constant'
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
autoload :DummySource, 'cocoapods/generator/dummy_source'
autoload :EmbedFrameworksScript, 'cocoapods/generator/embed_frameworks_script'
......
module Pod
module Generator
# Generates a constant file.
#
class Constant
def initialize(contents)
@generate = contents
end
attr_reader :generate
def save_as(path)
path.open('w') do |f|
f.write(generate)
end
end
end
end
end
......@@ -10,12 +10,41 @@ module Pod
#
attr_reader :target
attr_reader :headers
Header = Struct.new(:path, :umbrella, :private, :textual, :exclude, :size, :mtime) do
alias_method :private?, :private
def to_s
[
(:private if private?),
(:textual if textual),
(:umbrella if umbrella),
(:exclude if exclude),
'header',
%("#{path}"),
attrs,
].compact.join(' ')
end
def attrs
attrs = {
'size' => size,
'mtime' => mtime,
}.reject { |_k, v| v.nil? }
return nil if attrs.empty?
attrs.to_s
end
end
# Initialize a new instance
#
# @param [PodTarget] target @see target
#
def initialize(target)
@target = target
@headers = [
Header.new(target.umbrella_header_path.basename, true),
]
end
# Generates and saves the Info.plist to the given path.
......@@ -38,14 +67,36 @@ module Pod
#
def generate
<<-MODULE_MAP.strip_heredoc
framework module #{target.product_module_name} {
umbrella header "#{target.umbrella_header_path.basename}"
#{module_specifier_prefix}module #{target.product_module_name}#{module_declaration_attributes} {
#{headers.join("\n ")}
export *
module * { export * }
}
export *
module * { export * }
}
MODULE_MAP
end
private
# The prefix to `module` to prepend in the module map.
# Ensures that only framework targets have `framework` prepended.
#
def module_specifier_prefix
if target.requires_frameworks?
'framework '
else
''
end
end
# The suffix attributes to `module`.
# Ensures that library module maps are treated as `system` modules,
# supressing warnings when imported, as is done for header imports given via `-isystem`.
#
def module_declaration_attributes
return '' if target.requires_frameworks?
' [system]'
end
end
end
end
......@@ -55,12 +55,16 @@ module Pod
includes_static_libs = !target.requires_frameworks?
includes_static_libs ||= pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_static_artifacts.empty? }
config = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'HEADER_SEARCH_PATHS' => '$(inherited) ',
'LIBRARY_SEARCH_PATHS' => '$(inherited) ',
'OTHER_CFLAGS' => '$(inherited) ',
'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
'OTHER_SWIFT_FLAGS' => '$(inherited) ',
'PODS_PODFILE_DIR_PATH' => target.podfile_dir_relative_path,
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
'LIBRARY_SEARCH_PATHS' => '$(inherited) ',
'SWIFT_INCLUDE_PATHS' => '$(inherited) ',
}.merge(embedded_content_settings)
@xcconfig = Xcodeproj::Config.new(config)
......@@ -140,12 +144,12 @@ module Pod
end
build_settings = {
# Make framework headers discoverable by `import "…"`
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(framework_header_search_paths, '-iquote'),
'OTHER_CFLAGS' => XCConfigHelper.quote(framework_header_search_paths, '-iquote'),
}
if pod_targets.any? { |t| !t.should_build? }
# Make library headers discoverable by `#import "…"`
library_header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ' + XCConfigHelper.quote(library_header_search_paths)
build_settings['HEADER_SEARCH_PATHS'] = XCConfigHelper.quote(library_header_search_paths)
build_settings['OTHER_CFLAGS'] += ' ' + XCConfigHelper.quote(library_header_search_paths, '-isystem')
end
build_settings
......@@ -154,9 +158,9 @@ module Pod
header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
{
# by `#import "…"`
'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths),
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(header_search_paths),
# by `#import <…>`
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'),
'OTHER_CFLAGS' => XCConfigHelper.quote(header_search_paths, '-isystem'),
}
end
end
......
......@@ -47,15 +47,17 @@ module Pod
config = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.header_search_paths(@test_xcconfig)),
'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(target.header_search_paths(@test_xcconfig)),
'LIBRARY_SEARCH_PATHS' => '$(inherited) ',
'OTHER_CFLAGS' => '$(inherited) ',
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target, @test_xcconfig),
'OTHER_SWIFT_FLAGS' => '$(inherited) ',
'PODS_ROOT' => '${SRCROOT}',
'PODS_TARGET_SRCROOT' => target.pod_target_srcroot,
'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
'SKIP_INSTALL' => 'YES',
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => '$(inherited) ',
# 'USE_HEADERMAP' => 'NO'
'SWIFT_INCLUDE_PATHS' => '$(inherited) ',
}
@xcconfig = Xcodeproj::Config.new(config)
......
......@@ -329,19 +329,43 @@ module Pod
build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
end
module_map_files = []
unless dependent_targets.empty?
framework_search_paths = []
library_search_paths = []
swift_import_paths = []
dependent_targets.each do |dependent_target|
if dependent_target.requires_frameworks?
framework_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
else
library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
if dependent_target.defines_module?
module_map_file = if dependent_target.uses_swift?
# for swift, we have a custom build phase that copies in the module map, appending the .Swift module
"${PODS_CONFIGURATION_BUILD_DIR}/#{dependent_target.label}/#{dependent_target.product_module_name}.modulemap"
else
"${PODS_ROOT}/#{dependent_target.module_map_path.relative_path_from(dependent_target.sandbox.root)}"
end
module_map_files << %(-fmodule-map-file="#{module_map_file}")
end
end
swift_import_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
end
build_settings['FRAMEWORK_SEARCH_PATHS'] = XCConfigHelper.quote(framework_search_paths.uniq)
build_settings['LIBRARY_SEARCH_PATHS'] = XCConfigHelper.quote(library_search_paths.uniq)
build_settings['SWIFT_INCLUDE_PATHS'] = XCConfigHelper.quote(swift_import_paths.uniq)
end
other_swift_flags = module_map_files.tap(&:uniq!).flat_map { |f| ['-Xcc', f] }
if target.is_a?(PodTarget) && !target.requires_frameworks? && target.defines_module?
# make it possible for a mixed swift/objc static library to be able to import the objc from within swift
other_swift_flags += ['-import-underlying-module', '-Xcc', '-fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"']
end
# unconditionally set these, because of (the possibility of) having to add the pod targets own module map file
build_settings['OTHER_CFLAGS'] = module_map_files.join(' ')
build_settings['OTHER_SWIFT_FLAGS'] = other_swift_flags.join(' ')
build_settings
end
......
......@@ -165,8 +165,14 @@ module Pod
def install_libraries
UI.message '- Installing targets' do
umbrella_headers_by_dir = pod_targets.map do |pod_target|
next unless pod_target.should_build? && pod_target.defines_module?
pod_target.umbrella_header_path
end.compact.group_by(&:dirname)
pod_targets.sort_by(&:name).each do |pod_target|
target_installer = PodTargetInstaller.new(sandbox, pod_target)
target_installer.umbrella_headers_by_dir = umbrella_headers_by_dir
target_installer.install!
end
......
......@@ -20,6 +20,9 @@ module Pod
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
create_module_map
create_umbrella_header
elsif target.uses_swift?
create_module_map
create_umbrella_header
end
# Because embedded targets live in their host target, CocoaPods
# copies all of the embedded target's pod_targets to its host
......@@ -60,6 +63,12 @@ module Pod
'PODS_ROOT' => '$(SRCROOT)',
'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
'SKIP_INSTALL' => 'YES',
# Needed to ensure that static libraries won't try to embed the swift stdlib,
# since there's no where to embed in for a static library.
# Not necessary for dynamic frameworks either, since the aggregate targets are never shipped
# on their own, and are always further embedded into an app target.
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => 'NO',
}
super.merge(settings)
end
......
......@@ -27,11 +27,11 @@ module Pod
add_files_to_build_phases
create_xcconfig_file
create_test_xcconfig_files if target.contains_test_specifications?
if target.requires_frameworks?
unless target.static_framework?
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
if target.defines_module?
create_module_map do |generator|
generator.headers.concat module_map_additional_headers
end
create_module_map
create_umbrella_header do |generator|
file_accessors = target.file_accessors
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } if target.contains_test_specifications?
......@@ -41,13 +41,22 @@ module Pod
end
else
file_accessors.flat_map(&:public_headers).map(&:basename)
end
end
end
end
if target.requires_frameworks?
unless target.static_framework?
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
end
create_build_phase_to_symlink_header_folders
if target.static_framework?
create_build_phase_to_move_static_framework_archive
end
elsif target.uses_swift?
add_swift_static_library_compatibility_header_phase
end
unless skip_pch?(target.non_test_specs)
path = target.prefix_header_path
file_accessors = target.file_accessors.reject { |f| f.spec.test_specification? }
......@@ -64,6 +73,11 @@ module Pod
end
end
# @return [Hash<Pathname,Pathname>] A hash of all umbrella headers, grouped by the directory
# the are stored in
#
attr_accessor :umbrella_headers_by_dir
private
# @param [Array<Specification>] specs
......@@ -87,6 +101,9 @@ module Pod
settings['PUBLIC_HEADERS_FOLDER_PATH'] = ''
end
settings['PRODUCT_NAME'] = target.product_basename
settings['PRODUCT_MODULE_NAME'] = target.product_module_name
settings['CODE_SIGN_IDENTITY[sdk=appletvos*]'] = ''
settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = ''
settings['CODE_SIGN_IDENTITY[sdk=watchos*]'] = ''
......@@ -96,6 +113,7 @@ module Pod
if target.swift_version
settings['SWIFT_VERSION'] = target.swift_version
end
settings
end
......@@ -586,10 +604,7 @@ module Pod
# @return [PBXFileReference] the file reference of the added file.
#
def add_file_to_support_group(path)
pod_name = target.pod_name
dir = target.support_files_dir
group = project.pod_support_files_group(pod_name, dir)
group.new_file(path)
support_files_group.new_file(path)
end
def apply_xcconfig_file_ref_to_resource_bundle_targets(resource_bundle_targets, xcconfig_file_ref)
......@@ -602,11 +617,15 @@ module Pod
def create_module_map
return super unless custom_module_map
path = target.module_map_path
UI.message "- Copying module map file to #{UI.path(path)}" do
unless path.exist? && FileUtils.identical?(custom_module_map, path)
FileUtils.cp(custom_module_map, path)
contents = custom_module_map.read
unless target.requires_frameworks?
contents.gsub!(/^(\s*)framework\s+(module[^{}]+){/, '\1\2[system] {')
end
generator = Generator::Constant.new(contents)
update_changed_file(generator, path)
add_file_to_support_group(path)
native_target.build_configurations.each do |c|
......@@ -616,6 +635,17 @@ module Pod
end
end
def module_map_additional_headers
return [] unless umbrella_headers_by_dir
other_paths = umbrella_headers_by_dir[target.module_map_path.dirname] - [target.umbrella_header_path]
other_paths.map do |module_map_path|
# exclude other targets umbrella headers, to avoid
# incomplete umbrella warnings
Generator::ModuleMap::Header.new(module_map_path.basename, nil, nil, nil, true)
end
end
def create_umbrella_header
return super unless custom_module_map
end
......@@ -667,6 +697,39 @@ module Pod
end
end
def support_files_group
pod_name = target.pod_name
dir = target.support_files_dir
project.pod_support_files_group(pod_name, dir)
end
# Adds a shell script phase, intended only for static library targets that contain swift,
# to copy the ObjC compatibility header (the -Swift.h file that the swift compiler generates)
# to the built products directory. Additionally, the script phase copies the module map, appending a `.Swift`
# submodule that references the (moved) compatibility header.
#
# @return [Void]
#
def add_swift_static_library_compatibility_header_phase
build_phase = native_target.new_shell_script_build_phase('Copy generated compatibility header')
build_phase.shell_script = <<-SH.strip_heredoc
COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
ditto "${PODS_ROOT}/#{target.module_map_path.relative_path_from(target.sandbox.root)}" "${MODULE_MAP_PATH}"
printf "\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\"${COMPATIBILITY_HEADER_PATH}\\"\\n requires objc\\n}\\n" >> "${MODULE_MAP_PATH}"
SH
build_phase.input_paths = %W(
${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
${PODS_ROOT}/#{target.module_map_path.relative_path_from(target.sandbox.root)}
)
build_phase.output_paths = %w(
${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
${BUILT_PRODUCTS_DIR}/Swift\ Compatibility\ Header/${PRODUCT_MODULE_NAME}-Swift.h
)
end
#-----------------------------------------------------------------------#
end
end
......
......@@ -82,7 +82,6 @@ module Pod
if target.requires_frameworks?
framework_name = target.product_module_name
settings['PRODUCT_NAME'] = framework_name
if target.static_framework?
settings['PUBLIC_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/Headers'
settings['PRIVATE_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/PrivateHeaders'
......@@ -105,6 +104,7 @@ module Pod
# @return [Void]
#
def update_changed_file(generator, path)
path.dirname.mkpath
if path.exist?
generator.save_as(support_files_temp_dir)
unless FileUtils.identical?(support_files_temp_dir, path)
......@@ -169,9 +169,6 @@ module Pod
# Creates the module map file which ensures that the umbrella header is
# recognized with a customized path
#
# @yield_param [Generator::ModuleMap]
# yielded once to configure the private headers
#
# @return [void]
#
def create_module_map
......
......@@ -35,7 +35,7 @@ module Pod
verify_no_duplicate_framework_and_library_names
verify_no_static_framework_transitive_dependencies
verify_no_pods_used_with_multiple_swift_versions
verify_framework_usage
verify_swift_pods_have_module_dependencies
end
private
......@@ -106,26 +106,34 @@ module Pod
unless error_messages.empty?
raise Informative, 'The following pods are integrated into targets ' \
"that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
"that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
end
end
def verify_framework_usage
aggregate_targets.each do |aggregate_target|
next if aggregate_target.requires_frameworks?
aggregate_target.user_build_configurations.keys.each do |config|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
def verify_swift_pods_have_module_dependencies
error_messages = []
pod_targets.each do |pod_target|
next unless pod_target.uses_swift?
swift_pods = pod_targets.select(&:uses_swift?)
unless swift_pods.empty?
raise Informative, 'Pods written in Swift can only be integrated as frameworks; ' \
'add `use_frameworks!` to your Podfile or target to opt into using it. ' \
"The Swift #{swift_pods.size == 1 ? 'Pod being used is' : 'Pods being used are'}: " +
swift_pods.map(&:name).to_sentence
end
non_module_dependencies = []
pod_target.dependent_targets.each do |dependent_target|
next if !dependent_target.should_build? || dependent_target.defines_module?
non_module_dependencies << dependent_target.name
end
next if non_module_dependencies.empty?
error_messages << "The swift pod `#{pod_target.name}` depends upon #{non_module_dependencies.map { |d| "`#{d}`" }.to_sentence}, " \
'which do not define modules. ' \
'To opt into those targets generating module maps '\
'(which is necessary to import them from swift when building as static libraries), ' \
'you may set `use_modular_header!` globally in your Podfile, '\
'or specify `:modular_headers => true` for particular dependencies.'
end
return if error_messages.empty?
raise Informative, 'The following swift pods cannot yet be integrated '\
"as static libraries:\n\n#{error_messages.join("\n\n")}"
end
end
end
......
......@@ -95,7 +95,9 @@ module Pod
# @return [Boolean] Whether the target should build a static framework.
#
def static_framework?
!is_a?(Pod::AggregateTarget) && specs.any? && specs.flat_map(&:root).all?(&:static_framework)
return if is_a?(Pod::AggregateTarget)
return if specs.empty?
specs.all? { |spec| spec.root.static_framework }
end
#-------------------------------------------------------------------------#
......@@ -148,14 +150,15 @@ module Pod
# module map.
#
def umbrella_header_path
support_files_dir + "#{label}-umbrella.h"
module_map_path.parent + "#{label}-umbrella.h"
end
# @return [Pathname] the absolute path of the LLVM module map file that
# defines the module structure for the compiler.
#
def module_map_path
support_files_dir + "#{label}.modulemap"
basename = "#{label}.modulemap"
support_files_dir + basename
end
# @return [Pathname] the absolute path of the bridge support file.
......
......@@ -377,6 +377,20 @@ module Pod
root_spec.name
end
# @return [Pathname] the absolute path of the LLVM module map file that
# defines the module structure for the compiler.
#
def module_map_path
basename = "#{label}.modulemap"
if requires_frameworks?
super
elsif file_accessors.any?(&:module_map)
build_headers.root + product_module_name + basename
else
sandbox.public_headers.root + product_module_name + basename
end
end
# @param [String] bundle_name
# The name of the bundle product, which is given by the +spec+.
#
......
Subproject commit b21c05141a790ac307a0ff605d2015e58c173889
Subproject commit ce9fcea6cbeb3d1f2cdc000c204569182cce92b9
......@@ -313,6 +313,11 @@ describe_cli 'pod' do
'install --no-repo-update'
end
describe 'Integrates a pod with static swift libraries and objective c modules' do
behaves_like cli_spec 'install_static_swift_modules',
'install --no-repo-update'
end
describe 'Integrates a Pod with circular subspec dependencies' do
behaves_like cli_spec 'install_circular_subspec_dependency',
'install --no-repo-update'
......
......@@ -10,6 +10,7 @@ module Pod
it 'writes the module map to the disk' do
path = temporary_directory + 'BananaLib.modulemap'
@pod_target.stubs(:requires_frameworks?).returns(true)
@gen.save_as(path)
path.read.should == <<-EOS.strip_heredoc
framework module BananaLib {
......@@ -20,5 +21,19 @@ module Pod
}
EOS
end
it 'writes the module map to the disk for a library' do
path = temporary_directory + 'BananaLib.modulemap'
@pod_target.stubs(:requires_frameworks?).returns(false)
@gen.save_as(path)
path.read.should == <<-EOS.strip_heredoc
module BananaLib [system] {
umbrella header "BananaLib-umbrella.h"
export *
module * { export * }
}
EOS
end
end
end
......@@ -146,7 +146,14 @@ module Pod
end
it 'adds the sandbox public headers search paths to the xcconfig, with quotes, as system headers' do
expected = '$(inherited) -isystem "${PODS_ROOT}/Headers/Public/BananaLib"'
expected = "$(inherited) -isystem \"#{config.sandbox.public_headers.search_paths(Platform.ios).join('" -isystem "')}\""
@xcconfig.to_hash['OTHER_CFLAGS'].should == expected
end
it 'adds the dependent pods module map file to OTHER_CFLAGS' do
@pod_targets.each { |pt| pt.stubs(:defines_module? => true) }
@xcconfig = @generator.generate
expected = '$(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Private/BananaLib/BananaLib.modulemap" -isystem "${PODS_ROOT}/Headers/Public/BananaLib"'
@xcconfig.to_hash['OTHER_CFLAGS'].should == expected
end
......
......@@ -138,7 +138,7 @@ module Pod
end
it 'does not add root public or private header search paths to the xcconfig' do
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.be.empty
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.be.nil
end
it 'adds the COCOAPODS macro definition' do
......@@ -270,7 +270,7 @@ module Pod
@coconut_pod_target.dependent_targets = [@banana_pod_target]
generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate
xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == '"${PODS_ROOT}/Headers/Private/CoconutLib"' \
xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == '$(inherited) "${PODS_ROOT}/Headers/Private/CoconutLib"' \
' "${PODS_ROOT}/Headers/Public/BananaLib" "${PODS_ROOT}/Headers/Public/BananaLib/BananaLib"' \
' "${PODS_ROOT}/Headers/Public/CoconutLib" "${PODS_ROOT}/Headers/Public/CoconutLib/CoconutLib"' \
' "${PODS_ROOT}/Headers/Public/monkey" "${PODS_ROOT}/Headers/Public/monkey/monkey"'
......@@ -288,7 +288,7 @@ module Pod
# This is not an test xcconfig so it should exclude header search paths for the 'monkey' pod
generator = PodXCConfig.new(@coconut_pod_target, false)
xcconfig = generator.generate
xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == '"${PODS_ROOT}/Headers/Private/CoconutLib"' \
xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == '$(inherited) "${PODS_ROOT}/Headers/Private/CoconutLib"' \
' "${PODS_ROOT}/Headers/Public/BananaLib" "${PODS_ROOT}/Headers/Public/BananaLib/BananaLib"' \
' "${PODS_ROOT}/Headers/Public/CoconutLib" "${PODS_ROOT}/Headers/Public/CoconutLib/CoconutLib"'
end
......
......@@ -503,6 +503,18 @@ module Pod
]
end
it 'adds the module map when the target defines a module' do
@pod_target.stubs(:defines_module?).returns(true)
@installer.install!
group = @project['Pods/BananaLib/Support Files']
group.children.map(&:display_name).sort.should == [
'BananaLib-Pods-SampleProject-dummy.m',
'BananaLib-Pods-SampleProject-prefix.pch',
'BananaLib-Pods-SampleProject.modulemap',
'BananaLib-Pods-SampleProject.xcconfig',
]
end
it 'adds the target for the static library to the project' do
@installer.install!
@project.targets.count.should == 1
......@@ -581,6 +593,18 @@ module Pod
]
end
it 'adds the module map when the target defines a module' do
@pod_target.stubs(:defines_module?).returns(true)
@installer.install!
group = @project['Pods/BananaLib/Support Files']
group.children.map(&:display_name).sort.should == [
'BananaLib-dummy.m',
'BananaLib-prefix.pch',
'BananaLib.modulemap',
'BananaLib.xcconfig',
]
end
it 'adds the target for the static library to the project' do
@installer.install!
@project.targets.count.should == 1
......
......@@ -305,8 +305,8 @@ module Pod
# when the swift version is unset at the project level, but set in one target, swift_version is nil
podfile.target_definitions['TestRunner'].stubs(:swift_version).returns(nil)
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => nil)
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => nil)
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => nil, :dependent_targets => [])
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => nil, :dependent_targets => [])
@validator = TargetValidator.new([], [orangeframework_pod_target, matryoshka_pod_target])
lambda { @validator.validate! }.should.not.raise
......@@ -352,31 +352,62 @@ module Pod
podfile.target_definitions['SampleProject'].stubs(:swift_version).returns('3.0')
podfile.target_definitions['TestRunner'].stubs(:swift_version).returns('2.3')
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => '4.0')
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => '3.2')
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => '4.0', :dependent_targets => [])
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => true, :target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']], :spec_swift_version => '3.2', :dependent_targets => [])
@validator = TargetValidator.new([], [orangeframework_pod_target, matryoshka_pod_target])
lambda { @validator.validate! }.should.not.raise
end
end
#-------------------------------------------------------------------------#
it 'raises when a swift target depends upon a target that does not define a module' do
fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Podfile.new do
project 'SampleProject/SampleProject'
platform :ios, '10.0'
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'matryoshka', :path => (fixture_path + 'matryoshka').to_s
target 'SampleProject'
target 'TestRunner'
end
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => false,
:target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']],
:should_build? => true, :defines_module? => false, :dependent_targets => [])
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true,
:target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']],
:should_build? => true, :defines_module? => true, :dependent_targets => [matryoshka_pod_target], :spec_swift_version => '4.0')
describe '#verify_framework_usage' do
it 'raises when Swift pods are used without explicit `use_frameworks!`' do
@validator = TargetValidator.new([], [orangeframework_pod_target, matryoshka_pod_target])
e = lambda { @validator.validate! }.should.raise Informative
e.message.should.include <<-EOS.strip_heredoc.strip
[!] The following swift pods cannot yet be integrated as static libraries:
The swift pod `OrangeFramework` depends upon `matryoshka`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from swift when building as static libraries), you may set `use_modular_header!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
EOS
end
it 'does not raise when a swift target depends upon a target thatis not built' do
fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Pod::Podfile.new do
platform :ios, '8.0'
podfile = Podfile.new do
project 'SampleProject/SampleProject'
platform :ios, '10.0'
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'matryoshka', :path => (fixture_path + 'matryoshka').to_s
target 'SampleProject'
target 'TestRunner'
end
lockfile = generate_lockfile
@validator = create_validator(config.sandbox, podfile, lockfile)
should.raise(Informative) { @validator.validate! }.message.should.match /use_frameworks/
matryoshka_pod_target = stub(:name => 'matryoshka', :uses_swift? => false,
:target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']],
:should_build? => false, :defines_module? => false, :dependent_targets => [])
orangeframework_pod_target = stub(:name => 'OrangeFramework', :uses_swift? => true,
:target_definitions => [podfile.target_definitions['SampleProject'], podfile.target_definitions['TestRunner']],
:should_build? => true, :defines_module? => true, :dependent_targets => [matryoshka_pod_target], :spec_swift_version => '4.0')
@validator = TargetValidator.new([], [orangeframework_pod_target, matryoshka_pod_target])
lambda { @validator.validate! }.should.not.raise
end
end
end
......
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