Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 5 #119

Closed
wants to merge 8 commits into from
Closed
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
32 changes: 25 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ defaults:
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
BUNDLE_PATH: vendor/bundle
macos:
xcode: "10.0.0"
xcode: "10.2.0"
shell: /bin/bash --login -eo pipefail
- &linux-config
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
BUNDLE_PATH: vendor/bundle
docker:
- image: norionomura/jazzy:swift-4.2.0
Copy link
Contributor

@AliSoftware AliSoftware Aug 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a docker image with Swift 5 support yet.

Those Docker images with Swift 5 are now since available: https://github.com/norio-nomura/docker-jazzy

shell: /bin/bash --login -eo pipefail
- &prepare-storage
run:
Expand Down Expand Up @@ -80,9 +78,11 @@ jobs:
- *fetch-xcode-logs
- *store-artifacts

spm-linux-build-and-test:
spm-linux-4.0-build-and-test:
<<: *linux-config
steps:
docker:
- image: norionomura/jazzy:swift-4.0
steps: &spm-steps
- *prepare-storage
- checkout
- *restore-gems
Expand All @@ -93,6 +93,20 @@ jobs:
command: bundle exec rake spm:test
- *store-artifacts

spm-linux-4.1-build-and-test:
<<: *linux-config
docker:
- image: norionomura/jazzy:swift-4.1
steps:
djbe marked this conversation as resolved.
Show resolved Hide resolved
*spm-steps

spm-linux-4.2-build-and-test:
<<: *linux-config
docker:
- image: norionomura/jazzy:swift-4.2
steps:
djbe marked this conversation as resolved.
Show resolved Hide resolved
*spm-steps

spm-mac-build-and-test:
<<: *macos-config
steps:
Expand Down Expand Up @@ -128,12 +142,16 @@ workflows:
lint-buildandtest-checkdeploy:
jobs:
- lint
- spm-linux-build-and-test
- spm-linux-4.0-build-and-test
- spm-linux-4.1-build-and-test
- spm-linux-4.2-build-and-test
- spm-mac-build-and-test
- xcode-build-and-test
- check-deploy:
requires:
- lint
- spm-linux-build-and-test
- spm-linux-4.0-build-and-test
- spm-linux-4.1-build-and-test
- spm-linux-4.2-build-and-test
- spm-mac-build-and-test
- xcode-build-and-test
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.7
2.4.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's no need for newest additions in latest Ruby versions we should try to keep the Ruby version shipped with latest version of macOS (don't even know which it is and if 2.3.7 was already that) so that people not wanting to use rvm/rbenv won't have to worry. Except if you saw features in more recent Ruby versions that we needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually tried that in this PR (and the other PR in SwiftGen), but it starts complaining about an unknown version of ruby, so 🤷‍♂️

4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ _None_

### New Features

_None_
* Added support for Swift 5.
[David Jennes](https://github.com/djbe)
[#119](https://github.com/SwiftGen/StencilSwiftKit/pull/119)

### Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:4.2
import PackageDescription

let package = Package(
Expand All @@ -23,5 +23,5 @@ let package = Package(
]
)
],
swiftLanguageVersions: [4]
swiftLanguageVersions: [.v4, .v4_2, .version("5")]
)
27 changes: 27 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "StencilSwiftKit",
products: [
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
],
dependencies: [
.package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMinor(from: "0.13.0"))
],
targets: [
.target(
name: "StencilSwiftKit",
dependencies: [
"Stencil"
]
),
.testTarget(
name: "StencilSwiftKitTests",
dependencies: [
"StencilSwiftKit"
]
)
],
swiftLanguageVersions: [4]
)
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
PathKit: 273f59a38e3218eb95abd9f6a61730a8bcfd2f06
Stencil: b5128a0a43ece9225db5cbd94d6569fe6fba609b
StencilSwiftKit: 9ebd42556b6c7396440f286b6c9aca1549c963ff
StencilSwiftKit: 293c1b29c4d10e1552dbef813ef832a3813a352e
SwiftLint: 7a0227733d786395817373b2d0ca799fd0093ff3

PODFILE CHECKSUM: ea156eb15e31a283c83a103d9155c8b32b3598c1
Expand Down
2 changes: 1 addition & 1 deletion Pods/Local Podspecs/StencilSwiftKit.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![CircleCI](https://circleci.com/gh/SwiftGen/StencilSwiftKit/tree/master.svg?style=svg)](https://circleci.com/gh/SwiftGen/StencilSwiftKit/tree/master)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/StencilSwiftKit.svg)](https://img.shields.io/cocoapods/v/StencilSwiftKit.svg)
[![Platform](https://img.shields.io/cocoapods/p/StencilSwiftKit.svg?style=flat)](http://cocoadocs.org/docsets/StencilSwiftKit)
![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg)
![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg)

`StencilSwiftKit` is a framework bringing additional [Stencil](https://github.com/stencilproject/Stencil) nodes & filters dedicated to Swift code generation.

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WORKSPACE = 'StencilSwiftKit'.freeze
SCHEME_NAME = 'Tests'.freeze
CONFIGURATION = 'Debug'.freeze
POD_NAME = 'StencilSwiftKit'.freeze
MIN_XCODE_VERSION = 10.0
MIN_XCODE_VERSION = 10.2

## [ Generate SPM files ] #####################################################

Expand Down
2 changes: 1 addition & 1 deletion Sources/StencilSwiftKit/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Stencil

public extension Extension {
public func registerStencilSwiftExtensions() {
func registerStencilSwiftExtensions() {
registerTags()
registerStringsFilters()
registerNumbersFilters()
Expand Down
3 changes: 2 additions & 1 deletion Sources/StencilSwiftKit/Filters+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ extension Filters.Strings {
while idx < scalars.endIndex, let scalar = UnicodeScalar(scalars[idx].value), characterSet.contains(scalar) {
idx = scalars.index(after: idx)
}
if idx > scalars.index(after: start) && idx < scalars.endIndex,
if !string.isEmpty,
djbe marked this conversation as resolved.
Show resolved Hide resolved
idx > scalars.index(after: start) && idx < scalars.endIndex,
let scalar = UnicodeScalar(scalars[idx].value),
CharacterSet.lowercaseLetters.contains(scalar) {
idx = scalars.index(before: idx)
Expand Down
2 changes: 1 addition & 1 deletion StencilSwiftKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.social_media_url = 'https://twitter.com/aligatr'

s.platform = :osx, '10.9'
s.swift_version = '4.2'
s.swift_version = '5'
s.cocoapods_version = '>= 1.4.0'

s.source = {
Expand Down
6 changes: 3 additions & 3 deletions StencilSwiftKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
TargetAttributes = {
09A87B4F1BCCA2C600D9B9F5 = {
CreatedOnToolsVersion = 7.0.1;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
};
};
Expand Down Expand Up @@ -418,7 +418,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.SwiftGenKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -432,7 +432,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.SwiftGenKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down