Skip to content

Commit

Permalink
Merge pull request #516 from realm/nn-swift-build-no-flags
Browse files Browse the repository at this point in the history
Change approach for SPM support, requiring no llbuild flags
  • Loading branch information
jpsim committed Feb 9, 2016
2 parents b1ee029 + 5f92aa5 commit 50424e5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ matrix:
env: JOB=SPM
before_install:
- make swift_snapshot_install
- make spm_bootstrap
exclude:
- script: placeholder # workaround for https://github.com/travis-ci/travis-ci/issues/4681

Expand Down
32 changes: 10 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,7 @@ VERSION_STRING=$(shell agvtool what-marketing-version -terse1)
COMPONENTS_PLIST=Source/swiftlint/Supporting Files/Components.plist

SWIFT_SNAPSHOT=swift-DEVELOPMENT-SNAPSHOT-2016-02-03-a

SPM=/Library/Developer/Toolchains/$(SWIFT_SNAPSHOT).xctoolchain/usr/bin/swift build
SPM_INCLUDE=/Library/Developer/Toolchains/$(SWIFT_SNAPSHOT).xctoolchain/usr/local/include
SPM_LIB=/Library/Developer/Toolchains/$(SWIFT_SNAPSHOT).xctoolchain/usr/lib

SPMFLAGS=--configuration debug
# for including "clang-c"
SPMFLAGS+=-Xcc -ISource/Clang_C -Xcc -I$(SPM_INCLUDE)
# for linking sourcekitd and clang-c
SPMFLAGS+= -Xcc -F$(SPM_LIB) -Xlinker -F$(SPM_LIB) -Xlinker -L$(SPM_LIB)
# for loading sourcekitd and clang-c
SPMFLAGS+= -Xlinker -rpath -Xlinker $(SPM_LIB)
SWIFT_BUILD_COMMAND=/Library/Developer/Toolchains/$(SWIFT_SNAPSHOT).xctoolchain/usr/bin/swift build

.PHONY: all bootstrap clean install package test uninstall

Expand Down Expand Up @@ -92,21 +81,20 @@ swift_snapshot_install:
curl https://swift.org/builds/development/xcode/$(SWIFT_SNAPSHOT)/$(SWIFT_SNAPSHOT)-osx.pkg -o swift.pkg
sudo installer -pkg swift.pkg -target /

spm_bootstrap: spm_teardown
curl https://raw.githubusercontent.com/jpsim/SourceKitten/master/script/spm_bootstrap | bash -s $(SWIFT_SNAPSHOT)

spm_teardown:
curl https://raw.githubusercontent.com/jpsim/SourceKitten/master/script/spm_teardown | bash

spm:
sed -i "" "s/swift-latest/$(SWIFT_SNAPSHOT)/" Source/Clang_C/module.modulemap
$(SPM) $(SPMFLAGS) || (\
echo "SPM does not use Package.swift. So now removing unnecesory directories in 'Packages/*' that cause build error.";\
rm -rf Packages/SourceKitten-*/Source/sourcekitten;\
rm -rf Packages/SourceKitten-*/Source/SourceKittenFrameworkTests;\
echo "Runs SPM again.";\
) && $(SPM) $(SPMFLAGS)
sed -i "" "s/$(SWIFT_SNAPSHOT)/swift-latest/" Source/Clang_C/module.modulemap
$(SWIFT_BUILD_COMMAND)

spm_test: spm
.build/Debug/SwiftLintFrameworkTests

spm_clean:
$(SPM) --clean
$(SWIFT_BUILD_COMMAND) --clean

spm_clean_dist:
$(SPM) --clean=dist
$(SWIFT_BUILD_COMMAND) --clean=dist
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
]),
],
dependencies: [
.Package(url: "https://github.com/jpsim/SourceKitten.git", majorVersion: 0, minor: 9),
.Package(url: "https://github.com/jpsim/SourceKitten.git", majorVersion: 0, minor: 10),
.Package(url: "https://github.com/behrang/YamlSwift.git", majorVersion: 1),
.Package(url: "https://github.com/norio-nomura/swift-corelibs-xctest.git", majorVersion: 0),
.Package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", majorVersion: 0, minor: 2),
Expand Down
5 changes: 0 additions & 5 deletions Source/Clang_C/module.modulemap

This file was deleted.

0 comments on commit 50424e5

Please sign in to comment.