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

Add #URL macro #2540

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4"
-skipPackagePluginValidation \
-skipMacroValidation \

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
ONLY_ACTIVE_ARCH=NO \
| tee xcodebuild.log

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml

Expand Down Expand Up @@ -89,6 +90,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml

- name: Publish unit tests report
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
DDG_SLOW_COMPILE_CHECK_THRESHOLD=250 \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml
Expand Down Expand Up @@ -188,6 +189,7 @@ jobs:
-derivedDataPath "DerivedData" \
-configuration "Release" \
-skipPackagePluginValidation \
-skipMacroValidation \
| xcbeautify

create-asana-task:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
ONLY_ACTIVE_ARCH=NO \
| tee xcodebuild.log

Expand Down
5 changes: 3 additions & 2 deletions Core/AppURLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
// limitations under the License.
//

import Foundation
import BrowserServicesKit
import Foundation
import Macros

public extension URL {

Expand Down Expand Up @@ -48,7 +49,7 @@ public extension URL {
static let exti = URL(string: "\(base)/exti/\(devMode)")!
static let feedback = URL(string: "\(base)/feedback.js?type=app-feedback")!

static let appStore = URL(string: "https://apps.apple.com/app/duckduckgo-privacy-browser/id663592361")!
static let appStore = #URL("https://apps.apple.com/app/duckduckgo-privacy-browser/id663592361")

static let mac = URL(string: "\(base)/mac")!
static let windows = URL(string: "\(base)/windows")!
Expand Down
7 changes: 4 additions & 3 deletions Core/BookmarksImporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
// limitations under the License.
//

import Bookmarks
import Common
import Foundation
import SwiftSoup
import Bookmarks
import Macros
import Persistence
import SwiftSoup

public enum BookmarksImportError: Error {
case invalidHtmlNoDLTag
Expand Down Expand Up @@ -217,7 +218,7 @@ final public class BookmarksImporter {
static let FavoritesFolder = "DuckDuckGo Favorites"
static let BookmarksFolder = "DuckDuckGo Bookmarks"
static let bookmarkURLString = "https://duckduckgo.com"
static let bookmarkURL = URL(string: "https://duckduckgo.com")!
static let bookmarkURL = #URL("https://duckduckgo.com")
static let favoriteAttribute = "duckduckgo:favorite"
static let isFavorite = "true"
static let idAttribute = "id"
Expand Down
3 changes: 2 additions & 1 deletion Core/DataStoreWarmup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

import Combine
import Macros
import WebKit

/// WKWebsiteDataStore is basically non-functional until a web view has been instanciated and a page is successfully loaded.
Expand All @@ -27,7 +28,7 @@ public class DataStoreWarmup {

@MainActor
public func ensureReady() async {
await BlockingNavigationDelegate().loadInBackgroundWebView(url: URL(string: "about:blank")!)
await BlockingNavigationDelegate().loadInBackgroundWebView(url: #URL("about:blank"))
}

}
Expand Down
7 changes: 4 additions & 3 deletions Core/UserAgentManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

// swiftlint:disable file_length

import Foundation
import WebKit
import BrowserServicesKit
import Common
import Foundation
import Macros
import WebKit

public protocol UserAgentManager {

Expand All @@ -46,7 +47,7 @@ public class DefaultUserAgentManager: UserAgentManager {

private func prepareUserAgent() {
let webview = WKWebView()
webview.load(URLRequest.developerInitiated(URL(string: "about:blank")!))
webview.load(URLRequest.developerInitiated(#URL("about:blank")))

getDefaultAgent(webView: webview) { [weak self] agent in
// Reference webview instance to keep it in scope and allow UA to be returned
Expand Down
74 changes: 70 additions & 4 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@
B652DF10287C2C1600C12A9C /* ContentBlocking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9847BFFD27A2DDB400DB07AA /* ContentBlocking.swift */; };
B652DF12287C336E00C12A9C /* ContentBlockingUpdating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B652DF11287C336E00C12A9C /* ContentBlockingUpdating.swift */; };
B652DF13287C373A00C12A9C /* ScriptSourceProviding.swift in Sources */ = {isa = PBXBuildFile; fileRef = B652DEFE287BF1FE00C12A9C /* ScriptSourceProviding.swift */; };
B6A26C042B98358B00DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C032B98358B00DF9EAD /* Macros */; };
B6A26C062B98359A00DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C052B98359A00DF9EAD /* Macros */; };
B6A26C082B9835A000DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C072B9835A000DF9EAD /* Macros */; };
B6A26C0A2B9835A800DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C092B9835A800DF9EAD /* Macros */; };
B6A26C0C2B9835AD00DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C0B2B9835AD00DF9EAD /* Macros */; };
B6A26C0E2B9835B100DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C0D2B9835B100DF9EAD /* Macros */; };
B6A26C102B9835B400DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C0F2B9835B400DF9EAD /* Macros */; };
B6A26C122B9835B800DF9EAD /* Macros in Frameworks */ = {isa = PBXBuildFile; productRef = B6A26C112B9835B800DF9EAD /* Macros */; };
B6AD9E3628D4510A0019CDE9 /* ContentBlockerRulesManagerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6AD9E3428D4510A0019CDE9 /* ContentBlockerRulesManagerMock.swift */; };
B6AD9E3728D4510A0019CDE9 /* ContentBlockingUpdatingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6AD9E3528D4510A0019CDE9 /* ContentBlockingUpdatingTests.swift */; };
B6AD9E3828D4512E0019CDE9 /* EmbeddedTrackerDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9801F08927E4B21100191874 /* EmbeddedTrackerDataTests.swift */; };
Expand Down Expand Up @@ -2692,13 +2700,15 @@
0202569029881ECA00E694E7 /* CocoaAsyncSocket in Frameworks */,
02025664298818B200E694E7 /* NetworkExtension.framework in Frameworks */,
4B470EE4299C6DFB0086EBDC /* Core.framework in Frameworks */,
B6A26C062B98359A00DF9EAD /* Macros in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
025CCFDF2582601C001CD5BB /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B6A26C0E2B9835B100DF9EAD /* Macros in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -2717,6 +2727,7 @@
853273B624FFE0BB00E3C778 /* WidgetKit.framework in Frameworks */,
0238E44F29C0FAA100615E30 /* FindInPageIOSJSSupport in Frameworks */,
3760DFED299315EF0045A446 /* Waitlist in Frameworks */,
B6A26C042B98358B00DF9EAD /* Macros in Frameworks */,
F143C2EB1E4A4CD400CFDE3A /* Core.framework in Frameworks */,
4B2754EC29E8C7DF00394032 /* Lottie in Frameworks */,
31E69A63280F4CB600478327 /* DuckUI in Frameworks */,
Expand All @@ -2732,6 +2743,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B6A26C0A2B9835A800DF9EAD /* Macros in Frameworks */,
F486D3362506A037002D07D7 /* OHHTTPStubs in Frameworks */,
F486D3382506A225002D07D7 /* OHHTTPStubsSwift in Frameworks */,
F115ED9C2B4EFC8E001A0453 /* TestUtils in Frameworks */,
Expand Down Expand Up @@ -2762,6 +2774,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B6A26C102B9835B400DF9EAD /* Macros in Frameworks */,
1E1D8B632995143200C96994 /* OHHTTPStubs in Frameworks */,
1E1D8B652995143200C96994 /* OHHTTPStubsSwift in Frameworks */,
);
Expand All @@ -2771,6 +2784,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B6A26C0C2B9835AD00DF9EAD /* Macros in Frameworks */,
F486D31D2506980E002D07D7 /* Swifter in Frameworks */,
85F21DC021123B03002631A6 /* Core.framework in Frameworks */,
);
Expand All @@ -2781,6 +2795,7 @@
buildActionMask = 2147483647;
files = (
98D4B7DF2944DDBD0068814D /* Core.framework in Frameworks */,
B6A26C122B9835B800DF9EAD /* Macros in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -2789,6 +2804,7 @@
buildActionMask = 2147483647;
files = (
4B948E2629DCCDB9002531FA /* Persistence in Frameworks */,
B6A26C082B9835A000DF9EAD /* Macros in Frameworks */,
98A50962294B48A400D10880 /* Bookmarks in Frameworks */,
1E60989B290009C700A508F9 /* Common in Frameworks */,
1E60989D290011E600A508F9 /* ContentBlocking in Frameworks */,
Expand Down Expand Up @@ -5678,6 +5694,7 @@
name = PacketTunnelProvider;
packageProductDependencies = (
0202568F29881ECA00E694E7 /* CocoaAsyncSocket */,
B6A26C052B98359A00DF9EAD /* Macros */,
);
productName = PacketTunnelProvider;
productReference = 02025662298818B100E694E7 /* PacketTunnelProvider.appex */;
Expand All @@ -5698,6 +5715,9 @@
025CCFE82582601C001CD5BB /* PBXTargetDependency */,
);
name = FingerprintingUITests;
packageProductDependencies = (
B6A26C0D2B9835B100DF9EAD /* Macros */,
);
productName = FingerprintingUITests;
productReference = 025CCFE22582601C001CD5BB /* FingerprintingUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
Expand Down Expand Up @@ -5757,6 +5777,7 @@
F42D541C29DCA40B004C4FF1 /* DesignResourcesKit */,
0238E44E29C0FAA100615E30 /* FindInPageIOSJSSupport */,
4B2754EB29E8C7DF00394032 /* Lottie */,
B6A26C032B98358B00DF9EAD /* Macros */,
);
productName = DuckDuckGo;
productReference = 84E341921E2F7EFB00BDBA6F /* DuckDuckGo.app */;
Expand All @@ -5782,6 +5803,7 @@
F486D3372506A225002D07D7 /* OHHTTPStubsSwift */,
EEFAB4662A73C230008A38E4 /* NetworkProtectionTestUtils */,
F115ED9B2B4EFC8E001A0453 /* TestUtils */,
B6A26C092B9835A800DF9EAD /* Macros */,
);
productName = DuckDuckGoTests;
productReference = 84E341A61E2F7EFB00BDBA6F /* UnitTests.xctest */;
Expand Down Expand Up @@ -5845,6 +5867,7 @@
packageProductDependencies = (
1E1D8B622995143200C96994 /* OHHTTPStubs */,
1E1D8B642995143200C96994 /* OHHTTPStubsSwift */,
B6A26C0F2B9835B400DF9EAD /* Macros */,
);
productName = IntegrationTests;
productReference = 85D33FCB25C97B6E002B91A6 /* IntegrationTests.xctest */;
Expand All @@ -5867,6 +5890,7 @@
name = AtbUITests;
packageProductDependencies = (
F486D31C2506980E002D07D7 /* Swifter */,
B6A26C0B2B9835AD00DF9EAD /* Macros */,
);
productName = AtbIntegrationTests;
productReference = 85F21DAD210F5E32002631A6 /* AtbUITests.xctest */;
Expand All @@ -5888,6 +5912,7 @@
);
name = PerformanceTests;
packageProductDependencies = (
B6A26C112B9835B800DF9EAD /* Macros */,
);
productName = IntegrationTests;
productReference = 9825F9D7293F2DE900F220F2 /* PerformanceTests.xctest */;
Expand Down Expand Up @@ -5940,6 +5965,7 @@
EE8E56892A56BCE400F11DCA /* NetworkProtection */,
D61CDA152B7CF77300A0FBB9 /* Subscription */,
D61CDA172B7CF78300A0FBB9 /* ZIPFoundation */,
B6A26C072B9835A000DF9EAD /* Macros */,
);
productName = Core;
productReference = F143C2E41E4A4CD400CFDE3A /* Core.framework */;
Expand Down Expand Up @@ -10000,16 +10026,16 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 114.3.0;
kind = revision;
revision = fb21f8ab492717e3ed68694a66fb15290de2f0eb;
};
};
B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/apple-toolbox.git";
requirement = {
kind = exactVersion;
version = 1.0.0;
kind = revision;
revision = 2c598d005facc8799178853c6b5d63c231b897d1;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down Expand Up @@ -10160,6 +10186,46 @@
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Bookmarks;
};
B6A26C032B98358B00DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C052B98359A00DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C072B9835A000DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C092B9835A800DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C0B2B9835AD00DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C0D2B9835B100DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C0F2B9835B400DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6A26C112B9835B800DF9EAD /* Macros */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
productName = Macros;
};
B6F997CB2B8F380A00476735 /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/apple-toolbox.git",
"state" : {
"revision" : "e3dc4faf70ca09718a2d20d5c47b449389e8c153",
"version" : "1.0.0"
"revision" : "2c598d005facc8799178853c6b5d63c231b897d1"
}
},
{
Expand All @@ -23,8 +22,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "1fa06fb43fb0f26fc1a74b710fb1402573264bf5",
"version" : "114.3.0"
"revision" : "fb21f8ab492717e3ed68694a66fb15290de2f0eb"
}
},
{
Expand Down Expand Up @@ -135,6 +133,15 @@
"version" : "1.3.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
}
},
{
"identity" : "swifter",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -165,7 +172,7 @@
{
"identity" : "trackerradarkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/TrackerRadarKit.git",
"location" : "https://github.com/duckduckgo/TrackerRadarKit",
"state" : {
"revision" : "a6b7ba151d9dc6684484f3785293875ec01cc1ff",
"version" : "1.2.2"
Expand Down
Loading
Loading