From 5e91438c8264c6aecf6ed1633ec31a0194088f68 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Wed, 29 Jul 2020 20:09:21 +0800 Subject: [PATCH 1/3] Reorganises into Swift package --- .../contents.xcworkspacedata | 7 ++ Package.swift | 28 +++++++ RSTree/Info.plist | 28 ------- RSTree/RSTree.h | 19 ----- RSTreeTests/Info.plist | 24 ------ RSTreeTests/RSTreeTests.swift | 36 -------- .../RSTree}/NSOutlineView+RSTree.swift | 0 {RSTree => Sources/RSTree}/Node.swift | 0 {RSTree => Sources/RSTree}/NodePath.swift | 0 Sources/RSTree/RSTree.swift | 3 + .../RSTree}/TopLevelRepresentedObject.swift | 0 .../RSTree}/TreeController.swift | 0 Tests/LinuxMain.swift | 7 ++ Tests/RSTreeTests/RSTreeTests.swift | 15 ++++ Tests/RSTreeTests/XCTestManifests.swift | 9 ++ buildscripts/VerifyNoBuildSettings.swift | 84 ------------------- xcconfig/RSTreeTests_target.xcconfig | 18 ---- xcconfig/RSTree_project.xcconfig | 59 ------------- xcconfig/RSTree_project_debug.xcconfig | 15 ---- xcconfig/RSTree_project_release.xcconfig | 9 -- xcconfig/RSTree_target.xcconfig | 14 ---- 21 files changed, 69 insertions(+), 306 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Package.swift delete mode 100644 RSTree/Info.plist delete mode 100644 RSTree/RSTree.h delete mode 100644 RSTreeTests/Info.plist delete mode 100644 RSTreeTests/RSTreeTests.swift rename {RSTree => Sources/RSTree}/NSOutlineView+RSTree.swift (100%) rename {RSTree => Sources/RSTree}/Node.swift (100%) rename {RSTree => Sources/RSTree}/NodePath.swift (100%) create mode 100644 Sources/RSTree/RSTree.swift rename {RSTree => Sources/RSTree}/TopLevelRepresentedObject.swift (100%) rename {RSTree => Sources/RSTree}/TreeController.swift (100%) create mode 100644 Tests/LinuxMain.swift create mode 100644 Tests/RSTreeTests/RSTreeTests.swift create mode 100644 Tests/RSTreeTests/XCTestManifests.swift delete mode 100755 buildscripts/VerifyNoBuildSettings.swift delete mode 100644 xcconfig/RSTreeTests_target.xcconfig delete mode 100644 xcconfig/RSTree_project.xcconfig delete mode 100644 xcconfig/RSTree_project_debug.xcconfig delete mode 100644 xcconfig/RSTree_project_release.xcconfig delete mode 100644 xcconfig/RSTree_target.xcconfig diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..205e6af --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "RSTree", + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "RSTree", + targets: ["RSTree"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "RSTree", + dependencies: []), + .testTarget( + name: "RSTreeTests", + dependencies: ["RSTree"]), + ] +) diff --git a/RSTree/Info.plist b/RSTree/Info.plist deleted file mode 100644 index 3343335..0000000 --- a/RSTree/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2016 Ranchero Software, LLC. All rights reserved. - NSPrincipalClass - - - diff --git a/RSTree/RSTree.h b/RSTree/RSTree.h deleted file mode 100644 index a31b409..0000000 --- a/RSTree/RSTree.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// RSTree.h -// RSTree -// -// Created by Brent Simmons on 5/30/16. -// Copyright © 2016 Ranchero Software, LLC. All rights reserved. -// - -@import Foundation; - -//! Project version number for RSTree. -FOUNDATION_EXPORT double RSTreeVersionNumber; - -//! Project version string for RSTree. -FOUNDATION_EXPORT const unsigned char RSTreeVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/RSTreeTests/Info.plist b/RSTreeTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/RSTreeTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/RSTreeTests/RSTreeTests.swift b/RSTreeTests/RSTreeTests.swift deleted file mode 100644 index 57b8407..0000000 --- a/RSTreeTests/RSTreeTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// RSTreeTests.swift -// RSTreeTests -// -// Created by Brent Simmons on 5/30/16. -// Copyright © 2016 Ranchero Software, LLC. All rights reserved. -// - -import XCTest -@testable import RSTree - -class RSTreeTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/RSTree/NSOutlineView+RSTree.swift b/Sources/RSTree/NSOutlineView+RSTree.swift similarity index 100% rename from RSTree/NSOutlineView+RSTree.swift rename to Sources/RSTree/NSOutlineView+RSTree.swift diff --git a/RSTree/Node.swift b/Sources/RSTree/Node.swift similarity index 100% rename from RSTree/Node.swift rename to Sources/RSTree/Node.swift diff --git a/RSTree/NodePath.swift b/Sources/RSTree/NodePath.swift similarity index 100% rename from RSTree/NodePath.swift rename to Sources/RSTree/NodePath.swift diff --git a/Sources/RSTree/RSTree.swift b/Sources/RSTree/RSTree.swift new file mode 100644 index 0000000..ac0aa00 --- /dev/null +++ b/Sources/RSTree/RSTree.swift @@ -0,0 +1,3 @@ +struct RSTree { + var text = "Hello, World!" +} diff --git a/RSTree/TopLevelRepresentedObject.swift b/Sources/RSTree/TopLevelRepresentedObject.swift similarity index 100% rename from RSTree/TopLevelRepresentedObject.swift rename to Sources/RSTree/TopLevelRepresentedObject.swift diff --git a/RSTree/TreeController.swift b/Sources/RSTree/TreeController.swift similarity index 100% rename from RSTree/TreeController.swift rename to Sources/RSTree/TreeController.swift diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..d9dc803 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import RSTreeTests + +var tests = [XCTestCaseEntry]() +tests += RSTreeTests.allTests() +XCTMain(tests) diff --git a/Tests/RSTreeTests/RSTreeTests.swift b/Tests/RSTreeTests/RSTreeTests.swift new file mode 100644 index 0000000..9f5bbf8 --- /dev/null +++ b/Tests/RSTreeTests/RSTreeTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import RSTree + +final class RSTreeTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(RSTree().text, "Hello, World!") + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/Tests/RSTreeTests/XCTestManifests.swift b/Tests/RSTreeTests/XCTestManifests.swift new file mode 100644 index 0000000..104118b --- /dev/null +++ b/Tests/RSTreeTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(RSTreeTests.allTests), + ] +} +#endif diff --git a/buildscripts/VerifyNoBuildSettings.swift b/buildscripts/VerifyNoBuildSettings.swift deleted file mode 100755 index 82e839b..0000000 --- a/buildscripts/VerifyNoBuildSettings.swift +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/swift - -// This script is originally from github.com/olofhellman/VerifyNoBS -// The idea is that all build settings should be kept in .xcconfig files, -// rather than in the xcode pbxproj file inside an Xcode project bundle -// Having the script run as part of a regular build ensures that the project file -// doesn't accidentally accumulate build settings - -import Darwin -import Foundation - -func reportError(message: String) { - print("error message was \(message)") - let stderr = FileHandle.standardError - if let data = message.data(using: String.Encoding.utf8, allowLossyConversion: false) { - stderr.write(data) - } else { - print("there was an error. script \"VerifyNoBuildSettings\" could not convert error message to printable string") - } -} - -public enum ProcessXcodeprojResult { - case FoundBuildSettings([String]) - case Error(String) - case OK(String) -} - -public func processXcodeprojAt(url: URL) -> ProcessXcodeprojResult { - let startTime = Date() - guard let xcodeproj = try? String(contentsOf: url, encoding: String.Encoding.utf8) else { - return .Error("script \"VerifyNoBuildSettings\" failed making xcodeproj from url") - } - let lines = xcodeproj.components(separatedBy: CharacterSet.newlines) - print ("found \(lines.count) lines") - - var badLines: [String] = [] - var inBuildSettingsBlock = false - for nthLine in lines { - if inBuildSettingsBlock { - if let _ = nthLine.range(of:"\\u007d[:space:]*;", options: .regularExpression) { - inBuildSettingsBlock = false - } else if let _ = nthLine.range(of:"CODE_SIGN_IDENTITY") { - - } else if let _ = nthLine.range(of:"PRODUCT_NAME") { - - } else { - badLines.append(nthLine) - } - } else { - if let _ = nthLine.range(of:"buildSettings[:space:]*=", options: .regularExpression) { - inBuildSettingsBlock = true - } - } - } - - let timeInterval = Date().timeIntervalSince(startTime) - print ("process took \(timeInterval) seconds") - if (badLines.count > 0) { - return .FoundBuildSettings(badLines) - } - return .OK(":-)") -} -print("Verifying no buildSettings...") - -let commandLineArgs = CommandLine.arguments -print("processArgs were \(commandLineArgs)") -let xcodeprojfilepath = commandLineArgs[1] -let myUrl = URL(fileURLWithPath:xcodeprojfilepath) -let result = processXcodeprojAt(url: myUrl) - -switch result { - case .Error(let str): - reportError (message: "error script \"VerifyNoBuildSettings\" encountered an error: \(str)") - exit(EXIT_FAILURE) - case .FoundBuildSettings(let badLines): - reportError (message: "script \"VerifyNoBuildSettings\" found build settings in the project file:") - for badLine in badLines { - reportError (message: " \(badLine)\n") - } - exit(EXIT_FAILURE) - case .OK: - print ("script \"VerifyNoBuildSettings\" verified the project contained no buildSettings") - exit(EXIT_SUCCESS) -} diff --git a/xcconfig/RSTreeTests_target.xcconfig b/xcconfig/RSTreeTests_target.xcconfig deleted file mode 100644 index 6d286a3..0000000 --- a/xcconfig/RSTreeTests_target.xcconfig +++ /dev/null @@ -1,18 +0,0 @@ - -LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks -INFOPLIST_FILE = RSTreeTests/Info.plist -PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSTreeTests -PRODUCT_NAME = $(TARGET_NAME) - - - - - - - - - - - - - diff --git a/xcconfig/RSTree_project.xcconfig b/xcconfig/RSTree_project.xcconfig deleted file mode 100644 index c9bdcb0..0000000 --- a/xcconfig/RSTree_project.xcconfig +++ /dev/null @@ -1,59 +0,0 @@ -CODE_SIGN_IDENTITY = Developer ID Application -DEVELOPMENT_TEAM = M8L2WTLA8W -CODE_SIGN_STYLE = Manual -PROVISIONING_PROFILE_SPECIFIER = - -// See the notes in NetNewsWire_target.xcconfig on why the -// DeveloperSettings.xcconfig is #included here - -#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig" - -SDKROOT = macosx -MACOSX_DEPLOYMENT_TARGET = 10.13 -IPHONEOS_DEPLOYMENT_TARGET = 13.0 -SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator -CLANG_ENABLE_OBJC_WEAK = YES -SWIFT_VERSION = 5.1 -COMBINE_HIDPI_IMAGES = YES - -COPY_PHASE_STRIP = NO -MACOSX_DEPLOYMENT_TARGET = 10.13 -ALWAYS_SEARCH_USER_PATHS = NO -CURRENT_PROJECT_VERSION = 1 -VERSION_INFO_PREFIX = -VERSIONING_SYSTEM = apple-generic -GCC_NO_COMMON_BLOCKS = YES -GCC_C_LANGUAGE_STANDARD = gnu99 -CLANG_CXX_LANGUAGE_STANDARD = gnu++0x -CLANG_CXX_LIBRARY = libc++ -CLANG_ENABLE_MODULES = YES -CLANG_ENABLE_OBJC_ARC = YES -ENABLE_STRICT_OBJC_MSGSEND = YES -CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -GCC_WARN_64_TO_32_BIT_CONVERSION = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES -CLANG_WARN_INFINITE_RECURSION = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_COMMA = YES -CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -CLANG_WARN_UNREACHABLE_CODE = YES -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_VARIABLE = YES -CLANG_WARN_RANGE_LOOP_ANALYSIS = YES -CLANG_WARN_SUSPICIOUS_MOVE = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_OBJC_LITERAL_CONVERSION = YES -CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -CLANG_ANALYZER_NONNULL = YES -SWIFT_SWIFT3_OBJC_INFERENCE = Off diff --git a/xcconfig/RSTree_project_debug.xcconfig b/xcconfig/RSTree_project_debug.xcconfig deleted file mode 100644 index 23eda38..0000000 --- a/xcconfig/RSTree_project_debug.xcconfig +++ /dev/null @@ -1,15 +0,0 @@ -#include "./RSTree_project.xcconfig" - -DEBUG_INFORMATION_FORMAT = dwarf -ENABLE_TESTABILITY = YES -GCC_DYNAMIC_NO_PIC = NO -GCC_OPTIMIZATION_LEVEL = 0 -GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited) - -MTL_ENABLE_DEBUG_INFO = YES - -SWIFT_COMPILATION_MODE = singlefile -SWIFT_OPTIMIZATION_LEVEL = -Onone -ONLY_ACTIVE_ARCH = YES - - diff --git a/xcconfig/RSTree_project_release.xcconfig b/xcconfig/RSTree_project_release.xcconfig deleted file mode 100644 index 67adb7e..0000000 --- a/xcconfig/RSTree_project_release.xcconfig +++ /dev/null @@ -1,9 +0,0 @@ -#include "./RSTree_project.xcconfig" - -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym -ENABLE_NS_ASSERTIONS = NO - -MTL_ENABLE_DEBUG_INFO = NO -SWIFT_OPTIMIZATION_LEVEL = -O - -SWIFT_COMPILATION_MODE = wholemodule diff --git a/xcconfig/RSTree_target.xcconfig b/xcconfig/RSTree_target.xcconfig deleted file mode 100644 index 6f69e0f..0000000 --- a/xcconfig/RSTree_target.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ - -INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks -SKIP_INSTALL = YES -DYLIB_COMPATIBILITY_VERSION = 1 -DYLIB_CURRENT_VERSION = 1 -DYLIB_INSTALL_NAME_BASE = @rpath -LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks -DEFINES_MODULE = YES -FRAMEWORK_VERSION = A -INFOPLIST_FILE = RSTree/Info.plist -PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSTree -PRODUCT_NAME = $(TARGET_NAME) -CLANG_ENABLE_MODULES = YES -APPLICATION_EXTENSION_API_ONLY = YES From 79182caec36a5c649def7b990e3369232607b961 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Wed, 29 Jul 2020 20:10:03 +0800 Subject: [PATCH 2/3] Removes workflows --- .github/workflows/build.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index badd234..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: macOS-latest - strategy: - matrix: - destination: ['platform=macOS', 'platform=iOS Simulator,OS=13.0,name=iPhone 11'] - - steps: - - name: Checkout Project - uses: actions/checkout@v1 - - - name: Switch to Xcode 11 - run: sudo xcode-select -s /Applications/Xcode_11.app - - - name: Show Build Version - run: xcodebuild -version - - - name: Show Build Settings - run: xcodebuild -showBuildSettings - - - name: Show Build SDK - run: xcodebuild -showsdks - - - name: Show Available Destinations - run: xcodebuild -scheme RSTree -showdestinations - - - name: Run Build - env: - destination: ${{ matrix.destination }} - run: xcodebuild -scheme RSTree test -destination "${destination}" -showBuildTimingSummary CODE_SIGN_IDENTITY= From fa55832eb50cdf80ee962ca62f249a71af528857 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Thu, 30 Jul 2020 00:18:54 +0800 Subject: [PATCH 3/3] Update Package.swift --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 205e6af..30411c5 100644 --- a/Package.swift +++ b/Package.swift @@ -9,6 +9,7 @@ let package = Package( // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "RSTree", + type: .dynamic, targets: ["RSTree"]), ], dependencies: [