Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Compile output files #16

Merged
merged 11 commits into from
Feb 12, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Build generated
build/
DerivedData/
Fixtures/stub-env/**/*.swiftmodule

## Various settings
*.pbxuser
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ env:

script:
- rake "$RAKETASK"
- Scripts/compile-modules.sh
- Scripts/compile-output.sh
16 changes: 0 additions & 16 deletions Contexts/Colors/customname.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@
<key>rgba</key>
<string>33fe66ff</string>
</dict>
<dict>
<key>alpha</key>
<string>ff</string>
<key>blue</key>
<string>cc</string>
<key>green</key>
<string>66</string>
<key>name</key>
<string>Cyan-Color</string>
<key>red</key>
<string>ff</string>
<key>rgb</key>
<string>ff66cc</string>
<key>rgba</key>
<string>ff66ccff</string>
</dict>
<dict>
<key>alpha</key>
<string>cc</string>
Expand Down
16 changes: 0 additions & 16 deletions Contexts/Colors/defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@
<key>rgba</key>
<string>33fe66ff</string>
</dict>
<dict>
<key>alpha</key>
<string>ff</string>
<key>blue</key>
<string>cc</string>
<key>green</key>
<string>66</string>
<key>name</key>
<string>Cyan-Color</string>
<key>red</key>
<string>ff</string>
<key>rgb</key>
<string>ff66cc</string>
<key>rgba</key>
<string>ff66ccff</string>
</dict>
<dict>
<key>alpha</key>
<string>cc</string>
Expand Down
6 changes: 3 additions & 3 deletions Contexts/Storyboards-macOS/all.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<dict>
<key>extraImports</key>
<array>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
</array>
<key>modules</key>
<array>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
</array>
<key>sceneEnumName</key>
<string>StoryboardScene</string>
Expand All @@ -25,7 +25,7 @@
<key>customClass</key>
<string>DBPrefsWindowController</string>
<key>customModule</key>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
<key>identifier</key>
<string>Preferences</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions Contexts/Storyboards-macOS/customname.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<dict>
<key>extraImports</key>
<array>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
</array>
<key>modules</key>
<array>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
</array>
<key>sceneEnumName</key>
<string>XCTStoryboardsScene</string>
Expand All @@ -25,7 +25,7 @@
<key>customClass</key>
<string>DBPrefsWindowController</string>
<key>customModule</key>
<string>DBPrefsWindowController</string>
<string>PrefsWindowController</string>
<key>identifier</key>
<string>Preferences</string>
</dict>
Expand Down
Binary file modified Fixtures/Colors/colors.clr
Binary file not shown.
1 change: 0 additions & 1 deletion Fixtures/Colors/colors.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"Cyan-Color" : "0xff66ccff",
"ArticleTitle" : "#33fe66",
"ArticleBody" : "339666",
"ArticleFootnote" : "ff66ccff",
Expand Down
1 change: 0 additions & 1 deletion Fixtures/Colors/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="Cyan-Color">#ff66cc</color>
<color name="ArticleTitle">#33fe66</color>
<color name="ArticleBody">#339666</color>
<color name="ArticleFootnote">#ff66ccff</color>
Expand Down
4 changes: 2 additions & 2 deletions Fixtures/Storyboards-macOS/AdditionalImport.storyboard
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
</dependencies>
<scenes>
<!--Window Controller-->
<scene sceneID="eNa-6E-hop">
<objects>
<windowController storyboardIdentifier="Preferences" id="3Gn-1I-HiJ" customClass="DBPrefsWindowController" customModule="DBPrefsWindowController" sceneMemberID="viewController">
<windowController storyboardIdentifier="Preferences" id="3Gn-1I-HiJ" customClass="DBPrefsWindowController" customModule="PrefsWindowController" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="sw7-rd-HiT">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
Expand Down
15 changes: 15 additions & 0 deletions Fixtures/stub-env/Definitions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit

class CreateAccViewController: UIViewController {
}
class XXPickerViewController: UIViewController {
}
#elseif os(OSX)
import Cocoa

class CustomTabViewController: NSWindowController {
}
class NSControllerPlaceholder: NSWindowController {
}
#endif
4 changes: 4 additions & 0 deletions Fixtures/stub-env/Modules/CustomSegue.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import UIKit

public class CustomSegue: UIStoryboardSegue {
}
4 changes: 4 additions & 0 deletions Fixtures/stub-env/Modules/LocationPicker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import UIKit

public class LocationPickerViewController: UIViewController {
}
4 changes: 4 additions & 0 deletions Fixtures/stub-env/Modules/PrefsWindowController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Cocoa

public class DBPrefsWindowController: NSWindowController {
}
4 changes: 4 additions & 0 deletions Fixtures/stub-env/Modules/SlackTextViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import UIKit

public class SLKTextViewController: UIViewController {
}
Empty file.
Empty file.
30 changes: 30 additions & 0 deletions Scripts/compile-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
INPUT_PATH="Fixtures/stub-env/Modules"
OUTPUT_PATH="Fixtures/stub-env"

SWIFT2_TOOLCHAIN="--toolchain com.apple.dt.toolchain.Swift_2_3"
SWIFT3_TOOLCHAIN=""

# compile macos modules
SDK=$(xcrun --show-sdk-path --sdk macosx)
TARGET="x86_64-apple-macosx10.12"
MODULES=( "PrefsWindowController" )

for m in ${MODULES[@]}; do
echo "Compiling module ${m}… (macos)"
xcrun $SWIFT3_TOOLCHAIN swiftc -emit-module "$INPUT_PATH/$m.swift" -sdk $SDK -module-name "$m" -emit-module-path "$OUTPUT_PATH/swift3" -target $TARGET
xcrun $SWIFT2_TOOLCHAIN swiftc -emit-module "$INPUT_PATH/$m.swift" -sdk $SDK -module-name "$m" -emit-module-path "$OUTPUT_PATH/swift2.3" -target $TARGET
done

#compile ios modules
SDK=$(xcrun --show-sdk-path --sdk iphoneos)
TARGET="armv7s-apple-ios10.0"
MODULES=( "CustomSegue" "LocationPicker" "SlackTextViewController" )

for m in ${MODULES[@]}; do
echo "Compiling module ${m}… (ios)"
xcrun $SWIFT3_TOOLCHAIN swiftc -emit-module "$INPUT_PATH/$m.swift" -sdk $SDK -module-name "$m" -emit-module-path "$OUTPUT_PATH/swift3" -target $TARGET
xcrun $SWIFT2_TOOLCHAIN swiftc -emit-module "$INPUT_PATH/$m.swift" -sdk $SDK -module-name "$m" -emit-module-path "$OUTPUT_PATH/swift2.3" -target $TARGET
done

# don't need this
rm $OUTPUT_PATH/*.swiftdoc
21 changes: 21 additions & 0 deletions Scripts/compile-output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
for f in `find "Tests/Expected" -name '*.swift'`
do
if [[ $f == *"swift3"* ]]; then
TOOLCHAIN=""
MODULES="Fixtures/stub-env/swift3"
else
TOOLCHAIN="--toolchain com.apple.dt.toolchain.Swift_2_3"
MODULES="Fixtures/stub-env/swift2.3"
fi

if [[ $f == *"macOS"* ]]; then
SDK="macosx"
TARGET="x86_64-apple-macosx10.12"
else
SDK="iphoneos"
TARGET="armv7s-apple-ios10.0"
fi

echo "Checking $f template-generated fixture for build errors…"
xcrun $TOOLCHAIN -sdk $SDK swiftc -parse -target $TARGET -I $MODULES "Fixtures/stub-env/Definitions.swift" "$f"
done
5 changes: 0 additions & 5 deletions Tests/Expected/Colors/default-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum XCTColors {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case ArticleTitle
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case Cyan_Color
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case Translucent
Expand All @@ -48,8 +45,6 @@ enum XCTColors {
return 0xff66ccff
case .ArticleTitle:
return 0x33fe66ff
case .Cyan_Color:
return 0xff66ccff
case .Translucent:
return 0xffffffcc
}
Expand Down
5 changes: 0 additions & 5 deletions Tests/Expected/Colors/default-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum ColorName {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case ArticleTitle
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case Cyan_Color
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case Translucent
Expand All @@ -48,8 +45,6 @@ enum ColorName {
return 0xff66ccff
case .ArticleTitle:
return 0x33fe66ff
case .Cyan_Color:
return 0xff66ccff
case .Translucent:
return 0xffffffcc
}
Expand Down
3 changes: 0 additions & 3 deletions Tests/Expected/Colors/rawValue-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum XCTColors: UInt32 {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case ArticleTitle = 0x33fe66ff
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case Cyan_Color = 0xff66ccff
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case Translucent = 0xffffffcc
Expand Down
3 changes: 0 additions & 3 deletions Tests/Expected/Colors/rawValue-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum ColorName: UInt32 {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case ArticleTitle = 0x33fe66ff
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case Cyan_Color = 0xff66ccff
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case Translucent = 0xffffffcc
Expand Down
5 changes: 0 additions & 5 deletions Tests/Expected/Colors/swift3-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum XCTColors {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case articleTitle
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case cyanColor
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case translucent
Expand All @@ -48,8 +45,6 @@ enum XCTColors {
return 0xff66ccff
case .articleTitle:
return 0x33fe66ff
case .cyanColor:
return 0xff66ccff
case .translucent:
return 0xffffffcc
}
Expand Down
5 changes: 0 additions & 5 deletions Tests/Expected/Colors/swift3-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ enum ColorName {
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
case articleTitle
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
case cyanColor
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
case translucent
Expand All @@ -48,8 +45,6 @@ enum ColorName {
return 0xff66ccff
case .articleTitle:
return 0x33fe66ff
case .cyanColor:
return 0xff66ccff
case .translucent:
return 0xffffffcc
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Expected/Images/dot-syntax-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ struct XCTImagesType: StringLiteralConvertible {
return UIImage(asset: self)
}

public init(stringLiteral value: String) {
init(stringLiteral value: String) {
self.value = value
}

public init(extendedGraphemeClusterLiteral value: String) {
init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}

public init(unicodeScalarLiteral value: String) {
init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Expected/Images/dot-syntax-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ struct AssetType: StringLiteralConvertible {
return UIImage(asset: self)
}

public init(stringLiteral value: String) {
init(stringLiteral value: String) {
self.value = value
}

public init(extendedGraphemeClusterLiteral value: String) {
init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}

public init(unicodeScalarLiteral value: String) {
init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ struct XCTImagesType: ExpressibleByStringLiteral {
return UIImage(asset: self)
}

public init(stringLiteral value: String) {
init(stringLiteral value: String) {
self.value = value
}

public init(extendedGraphemeClusterLiteral value: String) {
init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}

public init(unicodeScalarLiteral value: String) {
init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ struct AssetType: ExpressibleByStringLiteral {
return UIImage(asset: self)
}

public init(stringLiteral value: String) {
init(stringLiteral value: String) {
self.value = value
}

public init(extendedGraphemeClusterLiteral value: String) {
init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}

public init(unicodeScalarLiteral value: String) {
init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}
Expand Down
Loading