Skip to content

Commit 24c6f37

Browse files
CodaFiharlanhaskins
authored andcommitted
Add Linux to the Build Matrix (#13)
* Add Linux to the Build Matrix * Give a generic failure message on Linux
1 parent 54e7cec commit 24c6f37

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

.travis.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
1-
os: osx
2-
language: objective-c
3-
osx_image: xcode8
4-
before_install:
5-
- cp ./cllvm.pc /usr/local/lib/pkgconfig/cllvm.pc
6-
- brew install llvm
7-
script:
8-
- swift build
1+
env:
2+
global:
3+
- LC_CTYPE=en_US.UTF-8
4+
matrix:
5+
include:
6+
- os: osx
7+
language: objective-c
8+
osx_image: xcode8
9+
before_install:
10+
- cp ./cllvm.pc /usr/local/lib/pkgconfig/cllvm.pc
11+
- brew install llvm
12+
script:
13+
- swift build
14+
- os: linux
15+
language: generic
16+
sudo: required
17+
dist: trusty
18+
env:
19+
- LLVM_API_VERSION=3.9
20+
before_install:
21+
# Set the package config path so we can see cllvm
22+
- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:"${PKG_CONFIG_PATH}"
23+
# Pull clang and llvm
24+
- wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
25+
- sudo apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main"
26+
- sudo apt-get update
27+
- sudo apt-get install llvm-${LLVM_API_VERSION}
28+
# Work around pre-installed clang
29+
- sudo rm -rf /usr/local/clang-*/bin/llvm-config
30+
- ls -l /usr/bin/llvm-config*
31+
- sudo rm -f /usr/bin/llvm-config
32+
- sudo ln -s /usr/bin/llvm-config-${LLVM_API_VERSION} /usr/bin/llvm-config
33+
# Grab Swift
34+
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
35+
- wget https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
36+
- tar xzf swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
37+
- export PATH=${PWD}/swift-3.0.2-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
38+
# Move the package config file into place
39+
- sudo ./swift-3.0.2-RELEASE-ubuntu14.04/usr/bin/swift utils/make-pkgconfig.swift
40+
script:
41+
- swift build

utils/make-pkgconfig.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env swift
22
import Foundation
33

4+
#if os(Linux)
5+
typealias Process = Task
6+
#endif
7+
48
/// Runs the specified program at the provided path.
59
/// - parameter path: The full path of the executable you
610
/// wish to run.
@@ -103,6 +107,11 @@ func makeFile() throws {
103107
do {
104108
try makeFile()
105109
} catch {
110+
#if os(Linux)
111+
// FIXME: Printing the thrown error that here crashes on Linux.
112+
print("Unexpected error occured while writing the config file. Check permissions and try again.")
113+
#else
106114
print("error: \(error)")
115+
#endif
107116
exit(-1)
108117
}

0 commit comments

Comments
 (0)