Skip to content

Commit 210a026

Browse files
committed
Upgrade the R.swift binary itself to Swift 2.3
1 parent eef9249 commit 210a026

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

R.swift.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,11 @@
380380
TargetAttributes = {
381381
D5C4227C1B711FDF004EA9B9 = {
382382
CreatedOnToolsVersion = 7.0;
383+
LastSwiftMigration = 0800;
383384
};
384385
D5EA0DF31A3DF45600FFEBC4 = {
385386
CreatedOnToolsVersion = 6.1.1;
387+
LastSwiftMigration = 0800;
386388
};
387389
};
388390
};
@@ -562,6 +564,7 @@
562564
PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.rswiftTests;
563565
PRODUCT_NAME = "$(TARGET_NAME)";
564566
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
567+
SWIFT_VERSION = 2.3;
565568
};
566569
name = Debug;
567570
};
@@ -576,6 +579,7 @@
576579
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
577580
PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.rswiftTests;
578581
PRODUCT_NAME = "$(TARGET_NAME)";
582+
SWIFT_VERSION = 2.3;
579583
};
580584
name = Release;
581585
};
@@ -659,13 +663,15 @@
659663
isa = XCBuildConfiguration;
660664
buildSettings = {
661665
PRODUCT_NAME = "$(TARGET_NAME)";
666+
SWIFT_VERSION = 2.3;
662667
};
663668
name = Debug;
664669
};
665670
D5EA0DFD1A3DF45600FFEBC4 /* Release */ = {
666671
isa = XCBuildConfiguration;
667672
buildSettings = {
668673
PRODUCT_NAME = "$(TARGET_NAME)";
674+
SWIFT_VERSION = 2.3;
669675
};
670676
name = Release;
671677
};

R.swift/ResourceTypes/Font.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ struct Font: WhiteListedExtensionsResourceType {
1616
init(url: NSURL) throws {
1717
try Font.throwIfUnsupportedExtension(url.pathExtension)
1818

19-
let dataProvider = CGDataProviderCreateWithURL(url)
19+
guard let dataProvider = CGDataProviderCreateWithURL(url) else {
20+
throw ResourceParsingError.ParsingFailed("Unable to create data provider for font at \(url)")
21+
}
2022
let font = CGFontCreateWithDataProvider(dataProvider)
2123

2224
guard let postScriptName = CGFontCopyPostScriptName(font) else {

R.swift/input.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ struct CallInformation {
142142
let outputURL = NSURL(fileURLWithPath: outputPath)
143143

144144
var resourceValue: AnyObject?
145-
try! outputURL.getResourceValue(&resourceValue, forKey: NSURLIsDirectoryKey)
145+
try outputURL.getResourceValue(&resourceValue, forKey: NSURLIsDirectoryKey)
146146
if let isDirectory = (resourceValue as? NSNumber)?.boolValue where isDirectory {
147-
self.outputURL = outputURL.URLByAppendingPathComponent(ResourceFilename, isDirectory: false)
147+
self.outputURL = outputURL.URLByAppendingPathComponent(ResourceFilename, isDirectory: false)!
148148
} else {
149149
self.outputURL = outputURL
150150
}
@@ -203,7 +203,7 @@ private func getFirstArgumentFromOptionData(options: [Option:[String]], helpStri
203203
}
204204
}
205205

206-
func pathResolverWithSourceTreeFolderToURLConverter(URLForSourceTreeFolder: SourceTreeFolder -> NSURL) -> (path: Path) -> NSURL {
206+
func pathResolverWithSourceTreeFolderToURLConverter(URLForSourceTreeFolder: SourceTreeFolder -> NSURL) -> (path: Path) -> NSURL? {
207207
return { path in
208208
switch path {
209209
case let .Absolute(absolutePath):

R.swift/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ do {
2424
let xcodeproj = try Xcodeproj(url: callInformation.xcodeprojURL)
2525
let resourceURLs = try xcodeproj.resourcePathsForTarget(callInformation.targetName)
2626
.map(pathResolverWithSourceTreeFolderToURLConverter(callInformation.URLForSourceTreeFolder))
27+
.flatMap { $0 }
2728

2829
let resources = Resources(resourceURLs: resourceURLs, fileManager: NSFileManager.defaultManager())
2930

Xcode.swift

0 commit comments

Comments
 (0)