From b8b1ed73ccade4d9e5d27d0c9af311c75cfb6a38 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Sun, 20 Jan 2019 16:54:43 +0000 Subject: [PATCH] Add back private_over_fileprivate for SwiftLint (#67) General cleanups before 0.3 release and an attempt to make Jazzy run on CI (failed so far) * Cleanup SwiftLint warnings, add docs.sh with jazzy * Fix conditional checks in docs.sh * Refine docs.sh * Install jazzy from gem, not brew in docs.sh * Run jazzy from gem install path in docs.sh * Can't easily run Jazzy on Travis :( * Another attempt to make Jazzy work on Travis --- .swiftlint.yml | 1 - .travis.yml | 2 ++ .../NodeEncodingStrategyTests.swift | 12 +++++------ XMLCoder.xcodeproj/project.pbxproj | 20 +++++++++++++------ docs.sh | 19 ++++++++++++++++++ 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100755 docs.sh diff --git a/.swiftlint.yml b/.swiftlint.yml index 4b35366d..6fd5ffd3 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,7 +1,6 @@ disabled_rules: - trailing_comma - identifier_name -- private_over_fileprivate - void_return - operator_whitespace - function_parameter_count diff --git a/.travis.yml b/.travis.yml index 7582d08c..c0c16dc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,8 @@ script: # coverage reports in Swift 5.0, see this issue for more details: # https://github.com/apple/swift-package-manager/pull/1787 - swift test +# this is commented because installing Jazzy on Travis doesn't work ¯\_(ツ)_/¯ +# - ./docs.sh before_deploy: - brew outdated carthage || brew upgrade carthage - carthage build --no-skip-current diff --git a/Tests/XMLCoderTests/NodeEncodingStrategyTests.swift b/Tests/XMLCoderTests/NodeEncodingStrategyTests.swift index 0b8f52b9..9a82760d 100644 --- a/Tests/XMLCoderTests/NodeEncodingStrategyTests.swift +++ b/Tests/XMLCoderTests/NodeEncodingStrategyTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import XMLCoder -fileprivate struct SingleContainer: Encodable { +private struct SingleContainer: Encodable { let element: Element enum CodingKeys: String, CodingKey { @@ -9,7 +9,7 @@ fileprivate struct SingleContainer: Encodable { } } -fileprivate struct KeyedContainer: Encodable { +private struct KeyedContainer: Encodable { let elements: [String: Element] enum CodingKeys: String, CodingKey { @@ -17,7 +17,7 @@ fileprivate struct KeyedContainer: Encodable { } } -fileprivate struct UnkeyedContainer: Encodable { +private struct UnkeyedContainer: Encodable { let elements: [Element] enum CodingKeys: String, CodingKey { @@ -25,7 +25,7 @@ fileprivate struct UnkeyedContainer: Encodable { } } -fileprivate struct Element: Encodable { +private struct Element: Encodable { let key: String = "value" let intKey: Int = 42 let int8Key: Int8 = 42 @@ -43,7 +43,7 @@ fileprivate struct Element: Encodable { } } -fileprivate struct ComplexUnkeyedContainer: Encodable { +private struct ComplexUnkeyedContainer: Encodable { let elements: [ComplexElement] enum CodingKeys: String, CodingKey { @@ -51,7 +51,7 @@ fileprivate struct ComplexUnkeyedContainer: Encodable { } } -fileprivate struct ComplexElement: Encodable { +private struct ComplexElement: Encodable { struct Key: Encodable { let a: String let b: String diff --git a/XMLCoder.xcodeproj/project.pbxproj b/XMLCoder.xcodeproj/project.pbxproj index 8baad40d..2f2cf737 100644 --- a/XMLCoder.xcodeproj/project.pbxproj +++ b/XMLCoder.xcodeproj/project.pbxproj @@ -202,8 +202,8 @@ OBJ_37 /* RJITest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RJITest.swift; sourceTree = ""; }; OBJ_38 /* RelationshipsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelationshipsTest.swift; sourceTree = ""; }; OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; - "XMLCoder::XMLCoder::Product" /* XMLCoder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XMLCoder.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - "XMLCoder::XMLCoderTests::Product" /* XMLCoderTests.xctest */ = {isa = PBXFileReference; lastKnownFileType = file; path = XMLCoderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + "XMLCoder::XMLCoder::Product" /* XMLCoder.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = XMLCoder.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + "XMLCoder::XMLCoderTests::Product" /* XMLCoderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = XMLCoderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -471,6 +471,14 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 9999; + TargetAttributes = { + "XMLCoder::XMLCoder" = { + LastSwiftMigration = 1010; + }; + "XMLCoder::XMLCoderTests" = { + LastSwiftMigration = 1010; + }; + }; }; buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "XMLCoder" */; compatibilityVersion = "Xcode 3.2"; @@ -701,7 +709,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGET_NAME = XMLCoder; }; name = Debug; @@ -725,7 +733,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGET_NAME = XMLCoder; }; name = Release; @@ -776,7 +784,7 @@ OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGET_NAME = XMLCoderTests; }; name = Debug; @@ -797,7 +805,7 @@ OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGET_NAME = XMLCoderTests; }; name = Release; diff --git a/docs.sh b/docs.sh new file mode 100755 index 00000000..8f9dc4bd --- /dev/null +++ b/docs.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "TRAVIS_PULL_REQUEST is $TRAVIS_PULL_REQUEST" +echo "TRAVIS_BRANCH is $TRAVIS_BRANCH" +if [[ $TRAVIS_BRANCH == "master" ]]; then + PREFIX="master" +elif [[ ! -z $TRAVIS_TAG ]]; then + PREFIX=$TRAVIS_TAG +else + echo "no tag set or branch isn't 'master', no upload will happen" + exit 0 +fi + +echo "docs will be uploaded to s3://xmlcoder.org/docs/$PREFIX" + +export GEM_HOME=$HOME/.gem + +gem install --user-install jazzy && \ + ~/.gem/ruby/2.4.0/bin/jazzy && aws s3 sync docs s3://xmlcoder.org/docs/$PREFIX