Skip to content

Commit 9fa1f95

Browse files
authored
Merge pull request #120 from noppoMan/swift5.1
Swift5.1
2 parents 62a5a15 + 62892d8 commit 9fa1f95

15 files changed

Lines changed: 393 additions & 379 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ os:
44
language: generic
55
sudo: required
66
dist: trusty
7-
osx_image: xcode10.1
7+
osx_image: xcode11
88

99
install:
1010
- source Scripts/install-swift.sh

Package.resolved

Lines changed: 4 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.2
1+
// swift-tools-version:5.1
22
import PackageDescription
33

44
let package = Package(
@@ -8,13 +8,11 @@ let package = Package(
88
.executable(name: "hexaville", targets: ["Hexaville"])
99
],
1010
dependencies: [
11-
.package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", .upToNextMajor(from: "17.0.1")),
1211
.package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMajor(from: "5.0.0")),
13-
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "1.0.1"))
12+
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMajor(from: "2.0.0"))
1413
],
1514
targets: [
1615
.target(name: "HexavilleCore", dependencies: [
17-
"SwiftyJSON",
1816
"SwiftCLI",
1917
"Yams"
2018
]),

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ hexaville generate Hello --dest /path/to/your/app
7878

7979
### swift-tools-version
8080
You can specify swift-tools-version for the new project with `--swift-tools-version` option.
81-
Current default tool version is `4.0`
81+
Current default tool version is `5.1`
8282

8383
If the tool version is higher than 3.1, layouts and definiations of `Package.swift` are refined.
8484

8585
**e.g.**
8686
```sh
87-
# swift.version will be 4.2
87+
# swift.version will be 5.1
8888
hexaville generate Hello
8989

90-
# swift.version will be 3.1
91-
hexaville generate Hello --swift-tools-version 3.1
90+
# swift.version will be 5.0
91+
hexaville generate Hello --swift-tools-version 5.0
9292

9393
# swift.version will be swift-4.0-DEVELOPMENT-SNAPSHOT-2017-08-04-a
9494
hexaville generate Hello --swift-tools-version swift-4.0-DEVELOPMENT-SNAPSHOT-2017-08-04-a
@@ -240,12 +240,12 @@ See: https://serverless.com/framework/docs/providers/aws/guide/functions#vpc-con
240240

241241
You can configure swift versioning and build configuration in `swift` directive
242242

243-
* default swift version is `4.2`
243+
* default swift version is `5.1`
244244
* default build configuration is `debug`
245245

246246
```yaml
247247
swift:
248-
version: 4.2 #format should be major.minor.[patch] or valid SWIFT DEVELOPMENT-SNAPSHOT name
248+
version: 5.1 #format should be major.minor.[patch] or valid SWIFT DEVELOPMENT-SNAPSHOT name
249249
buildOptions:
250250
configuration: release
251251
```

Scripts/build-swift.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,33 @@ set -e
55
DEST=${DEST}/${BUILD_CONFIGURATION}
66
swift package update
77
swift build -c ${BUILD_CONFIGURATION}
8-
cp -r /${SWIFTFILE}/usr/lib/swift/linux/*.so $DEST
9-
cp /usr/lib/x86_64-linux-gnu/libicudata.so $DEST/libicudata.so.52
8+
9+
# swift libraries
10+
if [ -f "$DEST/libicudataswift.so.61" ]; then
11+
rm $DEST/libicudataswift.so.61
12+
fi
13+
if [ -f "$DEST/libicui18nswift.so.61" ]; then
14+
rm $DEST/libicui18nswift.so.61
15+
fi
16+
if [ -f "$DEST/libicuucswift.so.61" ]; then
17+
rm $DEST/libicuucswift.so.61
18+
fi
19+
cp -rL /${SWIFTFILE}/usr/lib/swift/linux/*.so $DEST
20+
mv $DEST/libicudataswift.so $DEST/libicudataswift.so.61
21+
mv $DEST/libicui18nswift.so $DEST/libicui18nswift.so.61
22+
mv $DEST/libicuucswift.so $DEST/libicuucswift.so.61
23+
24+
# other sysytem libraries
1025
cp /usr/lib/x86_64-linux-gnu/libicui18n.so $DEST/libicui18n.so.52
1126
cp /usr/lib/x86_64-linux-gnu/libicuuc.so $DEST/libicuuc.so.52
1227
cp /usr/lib/x86_64-linux-gnu/libbsd.so $DEST/libbsd.so.0
1328
cp /lib/x86_64-linux-gnu/libssl.so.1.0.0 $DEST/libssl.so.1.0.0
1429
cp /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 $DEST/libcrypto.so.1.0.0
1530

16-
id -u $VOLUME_USER &>/dev/null || useradd -ms /bin/bash $VOLUME_USER
17-
chown -R $VOLUME_USER:$VOLUME_GROUP $DEST
31+
if [ -z "${VOLUME_USER}" ] && [ -z "${VOLUME_GROUP}" ]; then
32+
echo "swift build is finished."
33+
else
34+
id -u $VOLUME_USER &>/dev/null || useradd -ms /bin/bash $VOLUME_USER
35+
chown -R $VOLUME_USER:$VOLUME_GROUP $DEST
36+
echo "swift build is finished."
37+
fi

Scripts/install-swift.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
VERSION="4.2"
5+
VERSION="5.1"
66

77
# Determine OS
88
UNAME=`uname`;

Scripts/zip.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ DEST=.build/${BUILD_CONFIGURATION}
77
swift package update
88
swift build -c ${BUILD_CONFIGURATION}
99
cp -r /${SWIFTFILE}/usr/lib/swift/linux/*.so $DEST
10+
mv $DEST/libicudataswift.so $DEST/libicudataswift.so.61
11+
mv $DEST/libicui18nswift.so $DEST/libicui18nswift.so.61
12+
mv $DEST/libicuucswift.so $DEST/libicuucswift.so.61
1013
cp /usr/lib/x86_64-linux-gnu/libicudata.so $DEST/libicudata.so.52
1114
cp /usr/lib/x86_64-linux-gnu/libicui18n.so $DEST/libicui18n.so.52
1215
cp /usr/lib/x86_64-linux-gnu/libicuuc.so $DEST/libicuuc.so.52

Sources/Hexaville/main.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Darwin.C
55
#endif
66

77
import Foundation
8-
import SwiftyJSON
98
import SwiftCLI
109
import Yams
1110
import HexavilleCore
@@ -33,7 +32,7 @@ class GenerateProject: Command {
3332
let name = "generate"
3433
let shortDescription = "Generate initial project"
3534
let projectName = Parameter()
36-
let swiftToolVersion = Key<String>("--swift-tools-version", description: "Major Swift Tool Version for this project. default is 4.2")
35+
let swiftToolVersion = Key<String>("--swift-tools-version", description: "Major Swift Tool Version for this project. default is 5.1")
3736
let dest = Key<String>("-o", "--dest", description: "Destination for the project")
3837

3938
private func resolveSwiftVersion() throws -> SwiftVersion {
@@ -133,7 +132,7 @@ class BuildCommand: Command {
133132
print("Your application package was successfully created at \(package.destination)")
134133
print("next step.")
135134
print("")
136-
print(" serverless deploy --stage staging or production")
135+
print(" serverless deploy --stage your-stage-name")
137136
print("")
138137
print("guide: https://serverless.com/framework/docs/providers/aws/guide/deploying/")
139138
print("###########################################################################")

Sources/HexavilleCore/Constant.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public struct Constant {
1313
]
1414

1515
public static var supportedSwiftVersionsRange: CountableClosedRange<Int> {
16-
return 3...4
16+
return 5...5
1717
}
1818

1919
public static var defaultSwiftVersion: SwiftVersion {
20-
return .release(Version(major: 4, minor: 2))
20+
return .release(Version(major: 5, minor: 1))
2121
}
2222

2323
public static let appPrefix = "hexaville"

Sources/HexavilleCore/HexavilleFile/Version.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extension Version {
7272
throw VersionError.notEmpty
7373
}
7474

75-
var intCastedComponents: [Int] = try components.map({
75+
let intCastedComponents: [Int] = try components.map({
7676
guard let int = Int($0) else {
7777
throw VersionError.invalidVersion(string)
7878
}

0 commit comments

Comments
 (0)