From 0b370de200a1850514dd2003a47a0da084957d58 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sat, 25 Jan 2025 23:49:42 -0800 Subject: [PATCH 1/6] Apply standard Swift package configuration --- .bazelversion | 1 - .github/workflows/bazel.yml | 20 -- .github/workflows/docc.yml | 20 ++ .github/workflows/swift.yml | 12 +- .gitignore | 3 - .swiftlint-rules.yml | 9 + .swiftlint.yml | 1 - BUILD.bazel | 15 -- CONTRIBUTING.md | 37 ++-- Makefile | 35 ++- Package.resolved | 85 +++++++- Package.swift | 48 ++--- Plugins/SwiftLintPlugin/SwiftLintPlugin.swift | 204 ------------------ README.md | 2 +- WORKSPACE.bazel | 35 --- 15 files changed, 179 insertions(+), 348 deletions(-) delete mode 100644 .bazelversion delete mode 100644 .github/workflows/bazel.yml create mode 100644 .github/workflows/docc.yml delete mode 100644 BUILD.bazel delete mode 100644 Plugins/SwiftLintPlugin/SwiftLintPlugin.swift delete mode 100644 WORKSPACE.bazel diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index 66ce77b..0000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -7.0.0 diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml deleted file mode 100644 index 1e35ffa..0000000 --- a/.github/workflows/bazel.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Bazel - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer - -jobs: - bazel: - name: Bazel - runs-on: macos-13 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Build - run: bazelisk build --noenable_bzlmod //:all diff --git a/.github/workflows/docc.yml b/.github/workflows/docc.yml new file mode 100644 index 0000000..09b5c56 --- /dev/null +++ b/.github/workflows/docc.yml @@ -0,0 +1,20 @@ +name: DocC + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer + +jobs: + docc: + name: DocC + runs-on: macos-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + - name: Build + run: make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)" diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index e71051c..41ab583 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -7,23 +7,22 @@ on: branches: [ main ] env: - DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer jobs: swift: name: Swift - runs-on: macos-13 + runs-on: macos-latest env: SIMULATOR: iPhone 14 steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download swiftlint binary run: swift package resolve - name: Lint - run: | - DIRECTORY_NAME=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]') - "$(find ".build/artifacts/${DIRECTORY_NAME}" -type f -name swiftlint -perm +111 -print -quit)" \ + run: > + "$(find ".build/artifacts/swiftlint" -type f -name swiftlint -perm +111 -print -quit)" lint --strict --reporter github-actions-logging - name: Resolve package dependencies run: xcodebuild -resolvePackageDependencies @@ -33,6 +32,7 @@ jobs: build-for-testing -scheme "CollectionBuilders" -destination "name=$SIMULATOR,OS=latest" + -skipPackagePluginValidation SWIFT_TREAT_WARNINGS_AS_ERRORS=YES - name: Test run: > diff --git a/.gitignore b/.gitignore index d0c91e7..7088ee8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,3 @@ # Xcode *.xcworkspace/ *.xcodeproj/ - -# Bazel -bazel-* diff --git a/.swiftlint-rules.yml b/.swiftlint-rules.yml index 8695ec8..58fa60d 100644 --- a/.swiftlint-rules.yml +++ b/.swiftlint-rules.yml @@ -33,6 +33,7 @@ only_rules: - contains_over_filter_is_empty - contains_over_first_not_nil - contains_over_range_nil_comparison +# - contrasted_opening_brace - control_statement - convenience_type - custom_rules @@ -73,6 +74,7 @@ only_rules: - file_name - file_name_no_space - file_types_order +- final_test_case - first_where - flatmap_over_map_reduce - for_where @@ -124,11 +126,13 @@ only_rules: - multiple_closures_with_trailing_closure - nesting - nimble_operator +# - no_empty_block - no_extension_access_modifier - no_fallthrough_only - no_grouping_extension # - no_magic_numbers - no_space_in_method_call +- non_optional_string_data_conversion - non_overridable_class_declaration - notification_center_detachment - ns_number_init_as_function_reference @@ -137,6 +141,7 @@ only_rules: - nsobject_prefer_isequal - number_separator # - object_literal +# - one_declaration_per_file - opening_brace - operator_usage_whitespace - operator_whitespace @@ -146,6 +151,7 @@ only_rules: - override_in_extension - pattern_matching_keywords - period_spacing +- prefer_key_path - prefer_nimble - prefer_self_in_static_references - prefer_self_type_over_type_of_self @@ -181,6 +187,7 @@ only_rules: # - return_value_from_void_function - self_binding - self_in_property_initialization +# - shorthand_argument - shorthand_operator - shorthand_optional_binding - single_test_class @@ -189,6 +196,7 @@ only_rules: - sorted_imports - statement_position - static_operator +- static_over_final_class - strict_fileprivate - strong_iboutlet - superfluous_disable_command @@ -221,6 +229,7 @@ only_rules: - unused_control_flow_label - unused_enumerated - unused_optional_binding +- unused_parameter - unused_setter_value - valid_ibinspectable - vertical_parameter_alignment diff --git a/.swiftlint.yml b/.swiftlint.yml index 6475152..94e6336 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,4 @@ included: -- Plugins - Sources - Tests diff --git a/BUILD.bazel b/BUILD.bazel deleted file mode 100644 index ba1ae32..0000000 --- a/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_build_test") -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -ios_build_test( - name = "CollectionBuilders-iOS", - minimum_os_version = "13.0", - targets = [":CollectionBuilders"], -) - -swift_library( - name = "CollectionBuilders", - srcs = glob(["Sources/CollectionBuilders/**/*.swift"]), - visibility = ["//visibility:public"], - tags = ["manual"], -) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d04eb0b..92f1121 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,15 +1,10 @@ # Contributing to CollectionBuilders -- [Dependencies](#dependencies) -- [Open Package in Xcode](#open-package-in-xcode) -- [Static Analysis](#static-analysis) -- [Testing](#testing) +- [Open Package](#open-package) +- [Lint Package](#lint-package) +- [Creating Releases](#creating-releases) -## Dependencies - -Follow the [Swift Package Resources installation instructions](https://github.com/TinderApp/Swift-Package-Resources) to install tooling dependencies. - -## Open Package in Xcode +## Open Package > The file header comment template will also be installed. @@ -17,16 +12,10 @@ Follow the [Swift Package Resources installation instructions](https://github.co make open ``` -## Static Analysis +## Lint Package > SwiftLint violations are visible in Xcode as well. -Package dependencies must be resolved to download the SwiftLint binary. - -``` -swift package resolve -``` - To run SwiftLint from the command line: ``` @@ -39,8 +28,16 @@ To run analysis rules: make analyze ``` -To enable new rules whenever SwiftLint is upgraded to a new version: +## Creating Releases -``` -make rules -``` +Releases are made [on the GitHub website](https://github.com/Tinder/CollectionBuilders/releases/new). + +In all of the following steps, `X.X.X` is a placeholder to be substituted with the actual semantic version for the release. + +- Enter a semantic version as the new tag (__WITHOUT__ `v` prefix) +- Set the `main` branch as the target (it should be the default) +- Enter the release title formatted as `CollectionBuilders vX.X.X` (__WITH__ `v` prefix) +- Click on `Generate release notes` +- Leave `Set as a pre-release` unchecked +- Leave `Set as the latest release` checked +- Click `Publish release` diff --git a/Makefile b/Makefile index 4560f87..a140bba 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,3 @@ -# -# The SwiftLint recipes require the Swift Package Resources scripts to be installed. -# -# https://github.com/TinderApp/Swift-Package-Resources#installation -# - .PHONY: open open: fix open: @@ -24,7 +18,8 @@ fix: .PHONY: lint lint: format ?= emoji lint: - @swiftlint lint --strict --progress --reporter "$(format)" + @swift package plugin \ + swiftlint lint --strict --progress --reporter "$(format)" .PHONY: analyze analyze: target ?= CollectionBuilders @@ -38,10 +33,28 @@ analyze: -destination "$(destination)" \ -derivedDataPath "$$DERIVED_DATA" \ -configuration "Debug" \ + -skipPackagePluginValidation \ CODE_SIGNING_ALLOWED="NO" \ > "$$XCODEBUILD_LOG"; \ - swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG" + swift package plugin \ + swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG" -.PHONY: rules -rules: - @swiftlint rules | lint-rules +.PHONY: docs +docs: target ?= CollectionBuilders +docs: destination ?= generic/platform=macOS +docs: open ?= OPEN +docs: DERIVED_DATA_PATH = .build/documentation/data +docs: ARCHIVE_PATH = .build/documentation/archive +docs: + @mkdir -p "$(DERIVED_DATA_PATH)" "$(ARCHIVE_PATH)" + xcodebuild docbuild \ + -scheme "$(target)" \ + -destination "$(destination)" \ + -derivedDataPath "$(DERIVED_DATA_PATH)" \ + -skipPackagePluginValidation \ + OTHER_DOCC_FLAGS="--warnings-as-errors" + @find "$(DERIVED_DATA_PATH)" \ + -type d \ + -name "$(target).doccarchive" \ + -exec cp -R {} "$(ARCHIVE_PATH)/" \; + $(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",) diff --git a/Package.resolved b/Package.resolved index 4482d29..c6f2c5a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,23 @@ { "pins" : [ + { + "identity" : "collectionconcurrencykit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git", + "state" : { + "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95", + "version" : "0.2.0" + } + }, + { + "identity" : "cryptoswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", + "state" : { + "revision" : "729e01bc9b9dab466ac85f21fb9ee2bc1c61b258", + "version" : "1.8.4" + } + }, { "identity" : "cwlcatchexception", "kind" : "remoteSourceControl", @@ -23,8 +41,71 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Quick/Nimble.git", "state" : { - "revision" : "d616f15123bfb36db1b1075153f73cf40605b39d", - "version" : "13.0.0" + "revision" : "54b4e52183f16fe806014cbfd63718a84f8ba072", + "version" : "13.4.0" + } + }, + { + "identity" : "sourcekitten", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/SourceKitten.git", + "state" : { + "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", + "version" : "0.35.0" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "41982a3656a71c768319979febd796c6fd111d5c", + "version" : "1.5.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-syntax.git", + "state" : { + "revision" : "515f79b522918f83483068d99c68daeb5116342d", + "version" : "600.0.0-prerelease-2024-08-14" + } + }, + { + "identity" : "swiftlint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/SwiftLint.git", + "state" : { + "revision" : "a24488f26e60247d8fff7bbb03d51910af3dc91c", + "version" : "0.56.2" + } + }, + { + "identity" : "swiftytexttable", + "kind" : "remoteSourceControl", + "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git", + "state" : { + "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3", + "version" : "0.9.0" + } + }, + { + "identity" : "swxmlhash", + "kind" : "remoteSourceControl", + "location" : "https://github.com/drmohundro/SWXMLHash.git", + "state" : { + "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f", + "version" : "7.0.2" + } + }, + { + "identity" : "yams", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/Yams.git", + "state" : { + "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", + "version" : "5.1.3" } } ], diff --git a/Package.swift b/Package.swift index 62b4211..6d13c81 100644 --- a/Package.swift +++ b/Package.swift @@ -1,18 +1,11 @@ -// swift-tools-version:5.9 +// swift-tools-version:5.8 import PackageDescription -let packageName = "CollectionBuilders" - -enum SwiftLint { - static let plugin = "SwiftLintPlugin-\(packageName)" - static let binary = "SwiftLintBinary-\(packageName)" -} - let package = Package( - name: packageName, + name: "CollectionBuilders", platforms: [ - .iOS(.v13) + .iOS(.v13), ], products: [ .library( @@ -20,35 +13,32 @@ let package = Package( targets: ["CollectionBuilders"]), ], dependencies: [ + .package( + url: "https://github.com/realm/SwiftLint.git", + exact: "0.56.2"), .package( url: "https://github.com/Quick/Nimble.git", - from: "13.0.0"), + exact: "13.4.0"), ], targets: [ .target( - name: "CollectionBuilders", - plugins: [ - .plugin(name: SwiftLint.plugin), - ]), + name: "CollectionBuilders"), .testTarget( name: "CollectionBuildersTests", dependencies: [ "CollectionBuilders", "Nimble", - ], - plugins: [ - .plugin(name: SwiftLint.plugin), ]), - .plugin( - name: SwiftLint.plugin, - capability: .buildTool(), - dependencies: [ - .target(name: SwiftLint.binary) - ], - path: "Plugins/SwiftLintPlugin"), - .binaryTarget( - name: SwiftLint.binary, - url: "https://github.com/realm/SwiftLint/releases/download/0.54.0/SwiftLintBinary-macos.artifactbundle.zip", - checksum: "963121d6babf2bf5fd66a21ac9297e86d855cbc9d28322790646b88dceca00f1"), ] ) + +package.targets.forEach { target in + + target.swiftSettings = [ + .enableExperimentalFeature("StrictConcurrency"), + ] + + target.plugins = [ + .plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint"), + ] +} diff --git a/Plugins/SwiftLintPlugin/SwiftLintPlugin.swift b/Plugins/SwiftLintPlugin/SwiftLintPlugin.swift deleted file mode 100644 index 9befef7..0000000 --- a/Plugins/SwiftLintPlugin/SwiftLintPlugin.swift +++ /dev/null @@ -1,204 +0,0 @@ -// -// Copyright © 2023 Tinder (Match Group, LLC) -// - -import Foundation -import PackagePlugin - -@main -internal struct SwiftLintPlugin: BuildToolPlugin { - - internal enum SwiftLintPluginError: Error, CustomStringConvertible { - - case swiftFilesNotInProjectDirectory(Path) - case swiftFilesNotInWorkingDirectory(Path) - - internal var description: String { - switch self { - case let .swiftFilesNotInProjectDirectory(directory): - return """ - Swift files are not in project directory. - Directory: \(directory) - """ - case let .swiftFilesNotInWorkingDirectory(directory): - return """ - Swift files are not in working directory. - Directory: \(directory) - """ - } - } - } - - internal func createBuildCommands( - context: PluginContext, - target: Target - ) async throws -> [Command] { - try makeCommand(executable: context.tool(named: "swiftlint"), - swiftFiles: (target as? SourceModuleTarget).flatMap(swiftFiles) ?? [], - environment: environment(context: context, target: target), - pluginWorkDirectory: context.pluginWorkDirectory) - } - - /// Collects the paths of the Swift files to be linted. - private func swiftFiles(target: SourceModuleTarget) -> [Path] { - target - .sourceFiles(withSuffix: "swift") - .map(\.path) - } - - /// Creates an environment dictionary containing a value for the `BUILD_WORKSPACE_DIRECTORY` key. - /// - /// This method locates the topmost `.swiftlint.yml` config file within the package directory for this target - /// and sets the config file's containing directory as the `BUILD_WORKSPACE_DIRECTORY` value. The package - /// directory is used if a config file is not found. - /// - /// The `BUILD_WORKSPACE_DIRECTORY` environment variable controls SwiftLint's working directory. - /// - /// Reference: [https://github.com/realm/SwiftLint/blob/0.50.3/Source/swiftlint/Commands/SwiftLint.swift#L7]( - /// https://github.com/realm/SwiftLint/blob/0.50.3/Source/swiftlint/Commands/SwiftLint.swift#L7 - /// ) - private func environment( - context: PluginContext, - target: Target - ) throws -> [String: String] { - - let workingDirectory: Path = try target - .directory - .resolveWorkingDirectory(in: context.package.directory) - - return ["BUILD_WORKSPACE_DIRECTORY": "\(workingDirectory)"] - } - - private func makeCommand( - executable: PluginContext.Tool, - swiftFiles: [Path], - environment: [String: String], - pluginWorkDirectory path: Path - ) -> [Command] { - - print("Environment:", environment) - - guard !swiftFiles.isEmpty - else { return [] } - - let arguments: [String] = ["lint", "--quiet", "--force-exclude", "--cache-path", "\(path)"] - - return [ - .prebuildCommand( - displayName: "SwiftLint", - executable: executable.path, - arguments: arguments + swiftFiles.map(\.string), - environment: environment, - outputFilesDirectory: path.appending("Output")) - ] - } -} - -#if canImport(XcodeProjectPlugin) - -import XcodeProjectPlugin - -// swiftlint:disable:next no_grouping_extension -extension SwiftLintPlugin: XcodeBuildToolPlugin { - - internal func createBuildCommands( - context: XcodePluginContext, - target: XcodeTarget - ) throws -> [Command] { - try makeCommand(executable: context.tool(named: "swiftlint"), - swiftFiles: swiftFiles(target: target), - environment: environment(context: context, target: target), - pluginWorkDirectory: context.pluginWorkDirectory) - } - - /// Collects the paths of the Swift files to be linted. - private func swiftFiles(target: XcodeTarget) -> [Path] { - target - .inputFiles - .filter { $0.type == .source && $0.path.extension == "swift" } - .map(\.path) - } - - /// Creates an environment dictionary containing a value for the `BUILD_WORKSPACE_DIRECTORY` key. - /// - /// This method locates the topmost `.swiftlint.yml` config file within the project directory for this target's - /// Swift source files and sets the config file's containing directory as the `BUILD_WORKSPACE_DIRECTORY` value. - /// The project directory is used if a config file is not found. - /// - /// The `BUILD_WORKSPACE_DIRECTORY` environment variable controls SwiftLint's working directory. - /// - /// Reference: [https://github.com/realm/SwiftLint/blob/0.50.3/Source/swiftlint/Commands/SwiftLint.swift#L7]( - /// https://github.com/realm/SwiftLint/blob/0.50.3/Source/swiftlint/Commands/SwiftLint.swift#L7 - /// ) - private func environment( - context: XcodePluginContext, - target: XcodeTarget - ) throws -> [String: String] { - - let projectDirectory: Path = context.xcodeProject.directory - let swiftFiles: [Path] = swiftFiles(target: target) - let swiftFilesNotInProjectDirectory: [Path] = swiftFiles.filter { !$0.isDescendant(of: projectDirectory) } - - guard swiftFilesNotInProjectDirectory.isEmpty - else { throw SwiftLintPluginError.swiftFilesNotInProjectDirectory(projectDirectory) } - - let directories: [Path] = try swiftFiles.map { try $0.resolveWorkingDirectory(in: projectDirectory) } - let workingDirectory: Path = directories.min { $0.depth < $1.depth } ?? projectDirectory - let swiftFilesNotInWorkingDirectory: [Path] = swiftFiles.filter { !$0.isDescendant(of: workingDirectory) } - - guard swiftFilesNotInWorkingDirectory.isEmpty - else { throw SwiftLintPluginError.swiftFilesNotInWorkingDirectory(workingDirectory) } - - return ["BUILD_WORKSPACE_DIRECTORY": "\(workingDirectory)"] - } -} - -#endif - -extension Path { - - internal enum PathError: Error, CustomStringConvertible { - - case pathNotInDirectory(path: Path, directory: Path) - - internal var description: String { - switch self { - case let .pathNotInDirectory(path, directory): - return """ - Path is not in directory. - Path: \(path) - Directory: \(directory) - """ - } - } - } - - internal var directoryContainsConfigFile: Bool { - FileManager.default.fileExists(atPath: "\(self)/.swiftlint.yml") - } - - internal var depth: Int { - URL(fileURLWithPath: "\(self)").pathComponents.count - } - - internal func isDescendant(of path: Path) -> Bool { - "\(self)".hasPrefix("\(path)") - } - - internal func resolveWorkingDirectory(in directory: Path) throws -> Path { - - guard "\(self)".hasPrefix("\(directory)") - else { throw PathError.pathNotInDirectory(path: self, directory: directory) } - - let path: Path? = sequence(first: self) { path in - let path: Path = path.removingLastComponent() - guard "\(path)".hasPrefix("\(directory)") - else { return nil } - return path - } - .reversed() - .first(where: \.directoryContainsConfigFile) - - return path ?? directory - } -} diff --git a/README.md b/README.md index 9114086..176e1d6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Swift](https://github.com/Tinder/CollectionBuilders/actions/workflows/swift.yml/badge.svg?event=push)](https://github.com/Tinder/CollectionBuilders/actions/workflows/swift.yml)   -[![Bazel](https://github.com/Tinder/CollectionBuilders/actions/workflows/bazel.yml/badge.svg?event=push)](https://github.com/Tinder/CollectionBuilders/actions/workflows/bazel.yml) +[![DocC](https://github.com/Tinder/CollectionBuilders/actions/workflows/docc.yml/badge.svg?event=push)](https://github.com/Tinder/CollectionBuilders/actions/workflows/docc.yml)   [![Artifactory](https://github.com/Tinder/CollectionBuilders/actions/workflows/artifactory.yml/badge.svg?event=push)](https://github.com/Tinder/CollectionBuilders/actions/workflows/artifactory.yml) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel deleted file mode 100644 index 4755b32..0000000 --- a/WORKSPACE.bazel +++ /dev/null @@ -1,35 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "build_bazel_rules_apple", - sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", -) - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:extras.bzl", - "swift_rules_extra_dependencies", -) - -swift_rules_extra_dependencies() - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() From 418f0bf22aa9a2968cf68e43e1c6e65303231b50 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sat, 25 Jan 2025 23:55:31 -0800 Subject: [PATCH 2/6] Add macOS platform to package manifest --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 6d13c81..c07cf7d 100644 --- a/Package.swift +++ b/Package.swift @@ -6,6 +6,7 @@ let package = Package( name: "CollectionBuilders", platforms: [ .iOS(.v13), + .macOS(.v12), ], products: [ .library( From 748c60cca99882aec5e9c99312f6eabbb97c590f Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sat, 25 Jan 2025 23:57:15 -0800 Subject: [PATCH 3/6] Set iOS platform as docs destination --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a140bba..90a1dd2 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ analyze: .PHONY: docs docs: target ?= CollectionBuilders -docs: destination ?= generic/platform=macOS +docs: destination ?= generic/platform=iOS docs: open ?= OPEN docs: DERIVED_DATA_PATH = .build/documentation/data docs: ARCHIVE_PATH = .build/documentation/archive From 4f17f2b97b109197bcb31e3e52f14e6c9e883402 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sat, 25 Jan 2025 23:59:20 -0800 Subject: [PATCH 4/6] Do not set SWIFT_TREAT_WARNINGS_AS_ERRORS --- .github/workflows/swift.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 41ab583..a942aba 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -33,7 +33,6 @@ jobs: -scheme "CollectionBuilders" -destination "name=$SIMULATOR,OS=latest" -skipPackagePluginValidation - SWIFT_TREAT_WARNINGS_AS_ERRORS=YES - name: Test run: > xcodebuild From 95719f8c4d2dbbfff84f45e3a810def50b570c5c Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sun, 26 Jan 2025 08:30:05 -0800 Subject: [PATCH 5/6] Use iPhone 15 in Swift workflow --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index a942aba..86748db 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -14,7 +14,7 @@ jobs: name: Swift runs-on: macos-latest env: - SIMULATOR: iPhone 14 + SIMULATOR: iPhone 15 steps: - name: Checkout source uses: actions/checkout@v4 From f09cf0e6490d4866b719b7b990671a37586882f8 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sun, 26 Jan 2025 08:30:24 -0800 Subject: [PATCH 6/6] Set iOS platform as analyze destination --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 90a1dd2..ef3e325 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ lint: .PHONY: analyze analyze: target ?= CollectionBuilders -analyze: destination ?= generic/platform=macOS +analyze: destination ?= generic/platform=iOS analyze: format ?= emoji analyze: @DERIVED_DATA="$$(mktemp -d)"; \