diff --git a/Makefile b/Makefile index b7009b84..c548594a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ VERSION := $(shell /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" WeaverDI.xcodeproj/WeaverCodeGen_Info.plist) -PREFIX = /usr/local +PREFIX=/usr/local +SWIFT_BUILD_FLAGS=--configuration release .PHONY: clean build install package generate_sources codecov build: - $(call build) + @swift build --disable-sandbox $(SWIFT_BUILD_FLAGS) generate_sources: bash -c "(command -v sourcery && sourcery) || echo 'warning: Sourcery is not installed'" @@ -12,29 +13,22 @@ generate_sources: clean: rm -rf .build -install: - $(call build) +install: build $(call install_files,$(PREFIX)) uninstall: rm "$(PREFIX)/bin/weaver" rm -rf "$(PREFIX)/share/weaver" -package: - $(call build) +package: build $(call install_files,./build/package/weaver) cd ./build/package/ && zip -r ../../weaver-$(VERSION).zip ./weaver -codecov: - $(call build) +codecov: build xcodebuild test -scheme Tests -enableCodeCoverage YES bash -c "bash <(curl -s https://codecov.io/bash) -J Weaver -t eaa7c4af-5ca2-4e08-8f07-38a44671e5e0" rm *.coverage.txt -define build - @swift build --disable-sandbox --configuration release -endef - define install_files install -d $(1)/bin install -d $(1)/share/weaver/Resources diff --git a/Package.resolved b/Package.resolved index e54015ba..86d18175 100644 --- a/Package.resolved +++ b/Package.resolved @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/jpsim/SourceKitten.git", "state": { "branch": null, - "revision": "b6b10419ee439167ba6f7bd928ad30754ff5eb5d", - "version": "0.20.0" + "revision": "7c09176766d4bbc5da377ad857953fb49510a6aa", + "version": "0.21.0" } }, { diff --git a/Package.swift b/Package.swift index 1b861f09..990d69ea 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.1 +// swift-tools-version:4.0 import PackageDescription let package = Package( @@ -7,9 +7,9 @@ let package = Package( .library(name: "WeaverDI", targets: ["WeaverDI"]) ], dependencies: [ - .package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.19.1"), + .package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.21.0"), .package(url: "https://github.com/kylef/Commander.git", from: "0.6.0"), - .package(url: "https://github.com/kylef/Stencil.git", from: "0.10.1") + .package(url: "https://github.com/kylef/Stencil.git", from: "0.11.0") ], targets: [ .target(name: "WeaverDI"), diff --git a/Sources/WeaverCodeGen/shim-swift-4.1.swift b/Sources/WeaverCodeGen/shim-swift-4.1.swift new file mode 100644 index 00000000..a4164882 --- /dev/null +++ b/Sources/WeaverCodeGen/shim-swift-4.1.swift @@ -0,0 +1,17 @@ +// +// shim-swift-4.2.swift +// WeaverCodeGen +// +// Created by Théophane Rupin on 6/3/18. +// + +import Foundation + +#if swift(>=4.1) +#else +extension Collection { + public func compactMap(_ transform: (Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] { + return try flatMap(transform) + } +} +#endif diff --git a/WeaverDI.xcodeproj/project.pbxproj b/WeaverDI.xcodeproj/project.pbxproj index 38a9624b..8def95b3 100644 --- a/WeaverDI.xcodeproj/project.pbxproj +++ b/WeaverDI.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 19F3CD6820C43F32007C3076 /* shim-swift-4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F3CD6720C43F32007C3076 /* shim-swift-4.1.swift */; }; OBJ_199 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; OBJ_205 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_57 /* Package.swift */; }; OBJ_211 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_78 /* Package.swift */; }; @@ -457,6 +458,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 19F3CD6720C43F32007C3076 /* shim-swift-4.1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "shim-swift-4.1.swift"; sourceTree = ""; }; "Commander::Commander::Product" /* Commander.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Commander.framework; sourceTree = BUILT_PRODUCTS_DIR; }; OBJ_10 /* Dependencies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dependencies.swift; sourceTree = ""; }; OBJ_100 /* Reporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reporter.swift; sourceTree = ""; }; @@ -885,6 +887,7 @@ OBJ_17 /* WeaverCodeGen */ = { isa = PBXGroup; children = ( + 19F3CD6720C43F32007C3076 /* shim-swift-4.1.swift */, OBJ_18 /* AccessLevel.swift */, OBJ_19 /* AutoEquatable.generated.swift */, OBJ_20 /* AutoHashable.generated.swift */, @@ -1657,6 +1660,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 0; files = ( + 19F3CD6820C43F32007C3076 /* shim-swift-4.1.swift in Sources */, OBJ_329 /* AccessLevel.swift in Sources */, OBJ_330 /* AutoEquatable.generated.swift in Sources */, OBJ_331 /* AutoHashable.generated.swift in Sources */,