Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.1
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: objective-c
os: osx
osx_image: xcode9.2
osx_image: xcode9.3
env:
- TOOLCHAINS=swift
cache:
Expand Down
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
$(call build)

generate_sources:
$(call generate_sources)
bash -c "(command -v sourcery && sourcery) || echo 'warning: Sourcery is not installed'"

clean:
rm -rf .build
Expand All @@ -30,12 +30,7 @@ codecov:
bash -c "bash <(curl -s https://codecov.io/bash) -J Weaver -t eaa7c4af-5ca2-4e08-8f07-38a44671e5e0"
rm *.coverage.txt

define generate_sources
sourcery
endef

define build
$(call generate_sources)
@swift build --disable-sandbox --configuration release
endef

Expand Down
18 changes: 9 additions & 9 deletions Package.resolved

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

2 changes: 1 addition & 1 deletion 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.1
import PackageDescription

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Sources/WeaverCodeGen/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ extension ResolverModel {
RegisterModel(registerAnnotation: $0.value,
scopeAnnotation: scopeAnnotations[$0.key],
customRefAnnotation: customRefAnnotations[$0.key])
} + referenceAnnotations.flatMap {
} + referenceAnnotations.compactMap {
if let customRefAnnotation = customRefAnnotations[$0.key] {
return RegisterModel(referenceAnnotation: $0.value,
scopeAnnotation: scopeAnnotations[$0.key],
Expand Down
2 changes: 1 addition & 1 deletion Sources/WeaverCodeGen/Lexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private extension Lexer {
func tokenize(from sourceKitTokens: [SyntaxToken]) throws -> [AnyTokenBox] {

var currentLine = lines.startIndex
return try sourceKitTokens.flatMap { syntaxToken in
return try sourceKitTokens.compactMap { syntaxToken in

guard SyntaxKind(rawValue: syntaxToken.type) == .comment else {
return nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/WeaverCodeGen/SourceKitDeclaration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct SourceKitDeclaration {

let inheritedTypes: [String]
if let inheritedTypeDicts = dictionary[SwiftDocKey.inheritedtypes.rawValue] as? [[String: Any]] {
inheritedTypes = inheritedTypeDicts.flatMap { $0[SwiftDocKey.name.rawValue] as? String }
inheritedTypes = inheritedTypeDicts.compactMap { $0[SwiftDocKey.name.rawValue] as? String }
} else {
inheritedTypes = []
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/WeaverCodeGen/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private extension NSRegularExpression {
let result = self
.matches(in: string, range: NSMakeRange(0, string.utf16.count))
.flatMap { match in (1..<match.numberOfRanges).map { match.range(at: $0) } }
.flatMap { Range($0, in: string) }
.compactMap { Range($0, in: string) }
.map { String(string[$0]) }

if result.isEmpty {
Expand Down
4 changes: 2 additions & 2 deletions Sources/WeaverCommand/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let main = command(
// ---- Parse ----

Logger.log(.info, "Parsing...")
let asts: [Expr] = try inputPaths.values.flatMap { filePath in
let asts: [Expr] = try inputPaths.values.compactMap { filePath in
guard let file = File(path: filePath.string) else {
return nil
}
Expand All @@ -43,7 +43,7 @@ let main = command(

// ---- Collect ----

let dataToWrite: [(path: Path, data: String?)] = generatedData.flatMap { (file, data) in
let dataToWrite: [(path: Path, data: String?)] = generatedData.compactMap { (file, data) in

let filePath = Path(file)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion WeaverDI.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "WeaverDI"
s.version = "0.9.6"
s.swift_version = "4.0"
s.swift_version = "4.1"
s.summary = "Declarative, easy-to-use and safe Dependency Injection framework for Swift (iOS/macOS/Linux)"
s.homepage = "https://github.com/scribd/Weaver"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
23 changes: 20 additions & 3 deletions WeaverDI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@
path = Tests/WeaverCodeGenTests;
sourceTree = SOURCE_ROOT;
};
OBJ_5 /* */ = {
OBJ_5 = {
isa = PBXGroup;
children = (
OBJ_6 /* Package.swift */,
Expand All @@ -997,7 +997,6 @@
OBJ_55 /* Dependencies */,
OBJ_180 /* Products */,
);
name = "";
sourceTree = "<group>";
};
OBJ_55 /* Dependencies */ = {
Expand Down Expand Up @@ -1335,6 +1334,7 @@
isa = PBXNativeTarget;
buildConfigurationList = OBJ_325 /* Build configuration list for PBXNativeTarget "WeaverCodeGen" */;
buildPhases = (
19F3CD5620BF3851007C3076 /* Generate Sources */,
OBJ_328 /* Sources */,
OBJ_343 /* Frameworks */,
);
Expand Down Expand Up @@ -1501,7 +1501,7 @@
knownRegions = (
en,
);
mainGroup = OBJ_5 /* */;
mainGroup = OBJ_5;
productRefGroup = OBJ_180 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -1532,6 +1532,23 @@
};
/* End PBXProject section */

/* Begin PBXShellScriptBuildPhase section */
19F3CD5620BF3851007C3076 /* Generate Sources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Generate Sources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "make generate_sources";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
OBJ_198 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>