Skip to content

Commit

Permalink
Merge branch 'develop' into fix/consent-to-share-user-data-WPB-12018
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterinaWire authored Nov 15, 2024
2 parents 6674a7d + edb2162 commit a983779
Show file tree
Hide file tree
Showing 300 changed files with 3,889 additions and 864 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/swiftformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: GitHub Action for SwiftFormat
run: >
swiftformat --lint
./SourceryPlugin
./WirePlugins
./WireAPI
./WireAnalytics
./WireDomain
Expand Down
24 changes: 0 additions & 24 deletions SourceryPlugin/Package.swift

This file was deleted.

4 changes: 2 additions & 2 deletions WireAPI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.4"),
.package(path: "../SourceryPlugin"),
.package(path: "../WirePlugins"),
.package(name: "WireFoundation", path: "../WireFoundation")
],
targets: [
Expand All @@ -24,7 +24,7 @@ let package = Package(
name: "WireAPISupport",
dependencies: ["WireAPI"],
plugins: [
.plugin(name: "SourceryPlugin", package: "SourceryPlugin")
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
),
.testTarget(
Expand Down
7 changes: 2 additions & 5 deletions WireAnalytics/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/DataDog/dd-sdk-ios.git", exact: "2.18.0"),
.package(url: "https://github.com/Countly/countly-sdk-ios.git", exact: "24.4.2"),
.package(path: "../SourceryPlugin")
.package(path: "../WirePlugins")
],
targets: [
.target(
Expand All @@ -39,10 +39,7 @@ let package = Package(
name: "WireAnalyticsSupport",
dependencies: ["WireAnalytics"],
plugins: [
.plugin(
name: "SourceryPlugin",
package: "SourceryPlugin"
)
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
),
.testTarget(
Expand Down
4 changes: 2 additions & 2 deletions WireDomain/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(path: "../SourceryPlugin"),
.package(path: "../WirePlugins"),
.package(name: "WireAPI", path: "../WireAPI"),
.package(name: "WireFoundation", path: "../WireFoundation")
],
Expand All @@ -27,7 +27,7 @@ let package = Package(
dependencies: ["WireDomainPkg"],
path: "./Sources/PackageSupport",
plugins: [
.plugin(name: "SourceryPlugin", package: "SourceryPlugin")
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
),
.testTarget(
Expand Down
4 changes: 2 additions & 2 deletions WireFoundation/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.4"),
.package(path: "../SourceryPlugin")
.package(path: "../WirePlugins")
],
targets: [
.target(name: "WireFoundation"),
Expand All @@ -26,7 +26,7 @@ let package = Package(
.target(
name: "WireFoundationSupport",
dependencies: ["WireFoundation"],
plugins: [.plugin(name: "SourceryPlugin", package: "SourceryPlugin")]
plugins: [.plugin(name: "SourceryPlugin", package: "WirePlugins")]
),

.target(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftGenPlugin"
BuildableName = "SwiftGenPlugin"
BlueprintName = "SwiftGenPlugin"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftGenPlugin"
BuildableName = "SwiftGenPlugin"
BlueprintName = "SwiftGenPlugin"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
36 changes: 36 additions & 0 deletions WirePlugins/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "WirePlugins",
products: [
.plugin(name: "SourceryPlugin", targets: ["SourceryPlugin"]),
.plugin(name: "SwiftGenPlugin", targets: ["SwiftGenPlugin"])
],
targets: [
.binaryTarget(
name: "sourcery",
url: "https://github.com/krzysztofzablocki/Sourcery/releases/download/2.2.4/sourcery-2.2.4.artifactbundle.zip",
checksum: "79282fd22949653dcaf0ab6a215d33a913ce09840f577c5959b7e94292b12bd4"
),
.plugin(
name: "SourceryPlugin",
capability: .buildTool(),
dependencies: ["sourcery"],
exclude: ["./Stencils/AutoMockable.stencil"]
),

.plugin(
name: "SwiftGenPlugin",
capability: .buildTool(),
dependencies: ["swiftgen"]
),
.binaryTarget(
name: "swiftgen",
url: "https://github.com/SwiftGen/SwiftGen/releases/download/6.6.3/swiftgen-6.6.3.artifactbundle.zip",
checksum: "caf1feaf93dd32bc5037f0b6ded8d0f4fe28ab5d2f6e5c3edf2572006ba0b7eb"
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can reference this plugin in your target:

```swift
dependencies: [
.package(path: "../SourceryPlugin")
.package(path: "../WirePlugins")
],
targets: [

Expand All @@ -24,7 +24,7 @@ targets: [
name: "YourTargetSupport",
dependencies: ["YourTarget"],
plugins: [
.plugin(name: "SourceryPlugin", package: "SourceryPlugin")
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
)
]
Expand Down
File renamed without changes.
55 changes: 55 additions & 0 deletions WirePlugins/Plugins/SwiftGenPlugin/SwiftGenPlugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// Wire
// Copyright (C) 2024 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import Foundation
import PackagePlugin

@main
struct SwiftGenPlugin: BuildToolPlugin {
/// Entry point for creating build commands for targets in Swift packages.
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
// regarding the warning: https://github.com/swiftlang/swift-package-manager/issues/7870

Check warning on line 26 in WirePlugins/Plugins/SwiftGenPlugin/SwiftGenPlugin.swift

View workflow job for this annotation

GitHub Actions / Test Results

'appending(subpath:)' is deprecated: Use `URL` type instead of `Path`.

'appending(subpath:)' is deprecated: Use `URL` type instead of `Path`.

Check warning on line 26 in WirePlugins/Plugins/SwiftGenPlugin/SwiftGenPlugin.swift

View workflow job for this annotation

GitHub Actions / Test Results

'string' is deprecated: Use `URL` type instead of `Path`.

'string' is deprecated: Use `URL` type instead of `Path`.
let configFile = URL(fileURLWithPath: target.directory.appending(subpath: ".swiftgen.yml").string)
let outputFilesDirectory = context.pluginWorkDirectoryURL
let tool = try context.tool(named: "swiftgen")
return [
.prebuildCommand(
displayName: "Running \(tool)",
executable: tool.url,
arguments: ["--config", configFile.path()],
environment: ["GENERATED": outputFilesDirectory.path()],
outputFilesDirectory: outputFilesDirectory
)
] + existentialAnyWorkaround(context: context)
}

/// This workaround is needed because at the time of writing `strings/structured-swift5.stencil` of SwiftGen does not support existential any.
private func existentialAnyWorkaround(context: PluginContext) -> [Command] {
let outputFilesDirectory = context.pluginWorkDirectoryURL
let outputFile = outputFilesDirectory.appending(path: "Strings+Generated.swift", directoryHint: .notDirectory)
return [
.prebuildCommand(
displayName: "Replace CVarArg by any CVarArg",
executable: try! context.tool(named: "sed").url,
arguments: ["-i", "", "s/CVarArg/any CVarArg/g", outputFile.path()],
// fix duplicate build file warning by providing a non-existent path
outputFilesDirectory: outputFilesDirectory.appending(path: "tmp", directoryHint: .isDirectory)
)
]
}
}
14 changes: 9 additions & 5 deletions WireUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(path: "../SourceryPlugin"),
.package(name: "WireFoundation", path: "../WireFoundation")
.package(path: "../WireFoundation"),
.package(path: "../WirePlugins")
],
targets: [
.target(name: "WireAccountImageUI", dependencies: ["WireFoundation"]),
Expand All @@ -41,12 +41,12 @@ let package = Package(
.target(name: "WireMainNavigationUI"),
.testTarget(name: "WireMainNavigationUITests", dependencies: ["WireMainNavigationUI"]),

.target(name: "WireMoveToFolderUI", dependencies: ["WireFoundation"]),
.target(name: "WireMoveToFolderUI", dependencies: ["WireFoundation", "WireReusableUIComponents"]),
.target(
name: "WireMoveToFolderUISupport",
dependencies: ["WireMoveToFolderUI"],
plugins: [
.plugin(name: "SourceryPlugin", package: "SourceryPlugin")
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
),
.testTarget(name: "WireMoveToFolderUITests", dependencies: ["WireMoveToFolderUI", "WireMoveToFolderUISupport"]),
Expand All @@ -57,7 +57,11 @@ let package = Package(
.target(name: "WireSettingsUI"),
.testTarget(name: "WireSettingsUITests", dependencies: ["WireSettingsUI"]),

.target(name: "WireSidebarUI", dependencies: ["WireFoundation"]),
.target(
name: "WireSidebarUI",
dependencies: ["WireFoundation"],
plugins: [.plugin(name: "SwiftGenPlugin", package: "WirePlugins")]
),
.testTarget(name: "WireSidebarUITests", dependencies: ["WireSidebarUI"])
]
)
Expand Down
Loading

0 comments on commit a983779

Please sign in to comment.