Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: extract WireLogger into Swift package - WPB-11881 #1938

Merged
merged 35 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0306c7f
create target WireLogging
caldrian Dec 3, 2024
c3de44b
move several files
caldrian Dec 3, 2024
eebc803
move SystemLogger
caldrian Dec 3, 2024
3320e12
move all files except objc
caldrian Dec 3, 2024
0c94b20
add missing imports
caldrian Dec 3, 2024
ae4c7cb
fix imports in DataModel
caldrian Dec 3, 2024
328085f
fix imports in WireDomain
caldrian Dec 3, 2024
422d412
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 3, 2024
424d4a6
fix imports in RequestStrategy
caldrian Dec 3, 2024
4f42bab
fix imports in SyncEngine
caldrian Dec 3, 2024
4eff7e6
add missing imports
caldrian Dec 3, 2024
c326799
format code
caldrian Dec 3, 2024
4a79500
Trigger CI
caldrian Dec 3, 2024
0ec0fa0
rename WireLoggerObjc to WireLoggerObjC
caldrian Dec 3, 2024
f6d18ff
fix filename
caldrian Dec 3, 2024
090d1f7
move file to avoid issues
caldrian Dec 3, 2024
15556ad
convert groups to folders
caldrian Dec 3, 2024
d4a91fd
add Package.resolved to .gitignore
caldrian Dec 4, 2024
fd7c094
link WireLogging to unit tests
caldrian Dec 4, 2024
c571a89
add TODO, clean up (null) in xcodeproj
caldrian Dec 4, 2024
56c82e3
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
a5c5fd4
create package WireLogging
caldrian Dec 4, 2024
3bbffa5
WireLoggingAll scheme
caldrian Dec 4, 2024
cdeb6d0
fix framework.rb
caldrian Dec 4, 2024
81d8f28
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
18cd558
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
3fe7307
fix missing import
caldrian Dec 4, 2024
1200355
revert converting groups to folders
caldrian Dec 4, 2024
65075af
convert groups to folders again
caldrian Dec 4, 2024
cdeb635
sort folders in fastlane/framework.rb
caldrian Dec 5, 2024
ef51717
remove unused import
caldrian Dec 5, 2024
2b9f424
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 5, 2024
e2e1d09
several fixes
caldrian Dec 6, 2024
63fb26f
fix redundant values
caldrian Dec 6, 2024
9251e11
fix filenam
caldrian Dec 6, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ playground.xcworkspace
# .swiftpm

.build/
# Ignore Package.resolved files in packages and projects, only track the one in the workspace.
**/Package.resolved
!wire-ios-mono.xcworkspace/xcshareddata/swiftpm/Package.resolved

# CocoaPods
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class AnalyticsService: AnalyticsServiceProtocol {

public convenience init(
config: Config?,
logger: @escaping (String) -> Void
logger: @escaping (String) -> Void // TODO: [WPB-11881] import WireLogging and remove this workaround
caldrian marked this conversation as resolved.
Show resolved Hide resolved
) {
self.init(
config: config,
Expand Down
1,024 changes: 38 additions & 986 deletions WireDomain/Project/WireDomain Project.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Foundation
import WireAPI
import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// Decrypt the E2EE content within update events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireAPI
import WireLogging
import WireSystem

/// Process conversation create events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireAPI
import WireLogging
import WireSystem

/// Process conversation receipt mode update events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireAPI
import WireLogging
import WireSystem

/// Process user properties delete events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import CoreData
import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// A local store dedicated to conversations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Foundation
import WireAPI
import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// Facilitate access to conversations related domain objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireDataModel
import WireLogging

// sourcery: AutoMockable
public protocol ConversationLabelsLocalStoreProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import WireAPI
import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// Facilitates access to conversation labels related domain objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireDataModel
import WireLogging

protocol FeatureConfigLocalStoreProtocol {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Combine
import WireAPI
import WireDataModel
import WireLogging

/// Facilitates access to feature configs related domain objects.
protocol FeatureConfigRepositoryProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import WireDataModel
import WireFoundation
import WireLogging

// sourcery: AutoMockable
protocol UpdateEventsLocalStoreProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Foundation
import WireAPI
import WireDataModel
import WireFoundation
import WireLogging

// sourcery: AutoMockable
/// Access update events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// A local store dedicated to user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Foundation
import WireAPI
import WireDataModel
import WireFoundation
import WireLogging

// sourcery: AutoMockable
/// Facilitate access to users related domain objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import WireDataModel
import WireLogging

// sourcery: AutoMockable
public protocol UserClientsLocalStoreProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import CoreData
import WireAPI
import WireDataModel
import WireLogging

// sourcery: AutoMockable
/// Resolves 1:1 conversations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import CoreData
import Foundation
import WireAPI
import WireDataModel
import WireLogging
import WireSystem

protocol SyncManagerProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import WireAPI
import WireDataModel
import WireLogging
import WireSystem

// sourcery: AutoMockable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import WireAPI
import WireDomainSupport
import XCTest

@testable import WireDomain

final class FeatureConfigUpdateEventProcessorTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import WireAPISupport
import WireDataModel
import WireDataModelSupport
import XCTest

@testable import WireDomain
@testable import WireDomainSupport

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WireLogging"
BuildableName = "WireLogging"
BlueprintName = "WireLogging"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WireLoggingSupport"
BuildableName = "WireLoggingSupport"
BlueprintName = "WireLoggingSupport"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand All @@ -73,6 +101,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WireLoggingTests"
BuildableName = "WireLoggingTests"
BlueprintName = "WireLoggingTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
1 change: 0 additions & 1 deletion WireFoundation/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ let package = Package(
)

for target in package.targets {
guard target.type != .plugin else { continue }
target.swiftSettings = (target.swiftSettings ?? []) + [
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("FullTypedThrows"),
Expand Down
7 changes: 7 additions & 0 deletions WireFoundation/Tests/TestPlans/AllTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
"testExecutionOrdering" : "random"
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:WireFoundation",
"identifier" : "WireLoggingTests",
"name" : "WireLoggingTests"
}
},
{
"target" : {
"containerPath" : "container:WireFoundation",
Expand Down
8 changes: 8 additions & 0 deletions WireLogging/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>FILEHEADER</key>
<string>
// Wire
// Copyright (C) ___YEAR___ 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/.
//</string>
</dict>
</plist>
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>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SourceryPlugin"
BuildableName = "SourceryPlugin"
BlueprintName = "SourceryPlugin"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftGenPlugin"
BuildableName = "SwiftGenPlugin"
BlueprintName = "SwiftGenPlugin"
BlueprintIdentifier = "WireLogging"
BuildableName = "WireLogging"
BlueprintName = "WireLogging"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -64,9 +50,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SourceryPlugin"
BuildableName = "SourceryPlugin"
BlueprintName = "SourceryPlugin"
BlueprintIdentifier = "WireLogging"
BuildableName = "WireLogging"
BlueprintName = "WireLogging"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
Expand Down
37 changes: 37 additions & 0 deletions WireLogging/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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: "WireLogging",
platforms: [.iOS(.v16), .macOS(.v12)],
products: [
.library(name: "WireLogging", targets: ["WireLogging"]),
.library(name: "WireLoggingSupport", targets: ["WireLoggingSupport"])
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(path: "../WirePlugins")
],
targets: [
.target(name: "WireLogging"),
.target(
name: "WireLoggingSupport",
dependencies: ["WireLogging"],
plugins: [.plugin(name: "SourceryPlugin", package: "WirePlugins")]
),
.testTarget(
name: "WireLoggingTests",
dependencies: ["WireLogging", "WireLoggingSupport"]
)
]
)

for target in package.targets {
target.swiftSettings = (target.swiftSettings ?? []) + [
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("FullTypedThrows"),
.enableUpcomingFeature("ExistentialAny")
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import Foundation

final class AggregatedLogger: LoggerProtocol {
private var loggers: [any LoggerProtocol]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

public import Foundation

public protocol LoggerProtocol {

func debug(_ message: any LogConvertible, attributes: LogAttributes...)
Expand Down
Loading
Loading