@@ -57,9 +57,9 @@ export const internalLink = async () => {
5757 }
5858}
5959
60- export const xcodeprojConfiguration = async ( ) => {
61- if ( danger . github . thisPR . repo == "macos-browser " ) {
62- const projectFile = "DuckDuckGo.xcodeproj/project.pbxproj" ;
60+ export const xcodeprojConfiguration_macOS = async ( ) => {
61+ if ( danger . github . thisPR . repo == "apple-browsers " ) {
62+ const projectFile = "macOS/ DuckDuckGo-macOS .xcodeproj/project.pbxproj" ;
6363 if ( danger . git . modified_files . includes ( projectFile ) ) {
6464 let diff = await danger . git . diffForFile ( projectFile ) ;
6565 let addedLines = diff ?. added . split ( / \n / ) ;
@@ -71,7 +71,7 @@ export const xcodeprojConfiguration = async () => {
7171 // * arbitrary number of any characters (the value can be empty)
7272 // * a semicolon
7373 if ( addedLines ?. find ( value => / ^ \+ \t + [ A - Z _ 0 - 9 ] * = .* ; $ / . test ( value ) ) ) {
74- fail ( "No configuration is allowed inside Xcode project file - use xcconfig files instead." ) ;
74+ fail ( "No configuration is allowed inside macOS Xcode project file - use xcconfig files instead." ) ;
7575 }
7676 }
7777 }
@@ -141,78 +141,57 @@ async function checkForMismatch(modifiedFiles: any, sourceCodeUrlFilePath: strin
141141 return false ;
142142}
143143
144- async function trackerBlockingMismatch ( repository : string , modifiedFiles : any ) {
144+ async function trackerBlockingMismatch ( modifiedFiles : any ) {
145145 // Fail if Tracker Blocking config URL is different between code and script
146- var tdsUrlProviderFilePath = '' ;
147- var updateEmbeddedFilePath = '' ;
148- var tdsUrlProviderRegex = '' ;
149- var updateEmbeddedRegex = '' ;
150-
151- // Configure
152- switch ( repository ) {
153- case "iOS" :
154- tdsUrlProviderFilePath = 'Core/AppURLs.swift' ;
155- updateEmbeddedFilePath = 'scripts/update_embedded.sh' ;
156-
157- tdsUrlProviderRegex = 'static let trackerDataSet = URL.*string:.*staticBase.*trackerblocking\/(.*)\".*' ;
158- updateEmbeddedRegex = 'performUpdate \'https://staticcdn.duckduckgo.com/trackerblocking/(.*)\' \".*' ;
159- break ;
160- case "macos-browser" :
161- tdsUrlProviderFilePath = 'DuckDuckGo/AppDelegate/AppConfigurationURLProvider.swift' ;
162- updateEmbeddedFilePath = 'scripts/update_embedded.sh' ;
163-
164- tdsUrlProviderRegex = 'case \.trackerDataSet: return URL.string: \"(.*)\".*' ;
165- updateEmbeddedRegex = 'TDS_URL=\"(.*)\"' ;
166- break ;
167- default :
168- return ;
169- }
146+ let tdsUrlProviderFileiOSPath = 'iOS/Core/AppURLs.swift' ;
147+ let updateEmbeddedFileiOSPath = 'iOS/scripts/update_embedded.sh' ;
148+ let tdsUrlProvideriOSRegex = 'static let trackerDataSet = URL.*string:.*staticBase.*trackerblocking\/(.*)\".*' ;
149+ let updateEmbeddediOSRegex = 'performUpdate \'https://staticcdn.duckduckgo.com/trackerblocking/(.*)\' \".*' ;
150+
151+ let tdsUrlProviderFilemacOSPath = 'macOS/DuckDuckGo/Application/AppConfigurationURLProvider.swift' ;
152+ let updateEmbeddedFilemacOSPath = 'macOS/scripts/update_embedded.sh' ;
153+ let tdsUrlProvidermacOSRegex = 'public static let defaultTrackerDataURL = URL.string: \"(.*)\".*' ;
154+ let updateEmbeddedmacOSRegex = 'TDS_URL=\"(.*)\"' ;
155+
156+ const iosResult = await checkForMismatch ( modifiedFiles , tdsUrlProviderFileiOSPath , tdsUrlProvideriOSRegex , updateEmbeddedFileiOSPath , updateEmbeddediOSRegex ) ;
157+ if ( iosResult ) {
158+ fail ( `iOS Content Tracker URL mismatch. Please check ${ tdsUrlProviderFileiOSPath } and ${ updateEmbeddedFileiOSPath } ` )
159+ }
170160
171- const res = await checkForMismatch ( modifiedFiles , tdsUrlProviderFilePath , tdsUrlProviderRegex , updateEmbeddedFilePath , updateEmbeddedRegex ) ;
172- if ( res ) {
173- fail ( `Content Tracker URL mismatch. Please check ${ tdsUrlProviderFilePath } and ${ updateEmbeddedFilePath } ` )
161+ const macosResult = await checkForMismatch ( modifiedFiles , tdsUrlProviderFilemacOSPath , tdsUrlProvidermacOSRegex , updateEmbeddedFilemacOSPath , updateEmbeddedmacOSRegex ) ;
162+ if ( macosResult ) {
163+ fail ( `macOS Content Tracker URL mismatch. Please check ${ tdsUrlProviderFilemacOSPath } and ${ updateEmbeddedFilemacOSPath } ` )
174164 }
175165}
176166
177- async function privacyConfigMismatch ( repository : string , modifiedFiles : any ) {
167+ async function privacyConfigMismatch ( modifiedFiles : any ) {
178168 // Fail if Tracker Blocking config URL is different between code and script
179- var appConfigUrlProviderFilePath = '' ;
180- var updateEmbeddedFilePath = '' ;
181- var configUrlProviderRegex = '' ;
182- var updateEmbeddedRegex = '' ;
183-
184- // Configure
185- switch ( repository ) {
186- case "iOS" :
187- appConfigUrlProviderFilePath = 'Core/AppURLs.swift' ;
188- updateEmbeddedFilePath = 'scripts/update_embedded.sh' ;
189-
190- configUrlProviderRegex = 'static let privacyConfig = URL.*string:.*staticBase.*trackerblocking\/config\/(.*)\".*' ;
191- updateEmbeddedRegex = 'performUpdate \'https://staticcdn.duckduckgo.com/trackerblocking/config/(.*)\' \".*' ;
192- break ;
193- case "macos-browser" :
194- appConfigUrlProviderFilePath = 'DuckDuckGo/AppDelegate/AppConfigurationURLProvider.swift' ;
195- updateEmbeddedFilePath = 'scripts/update_embedded.sh' ;
169+ let appConfigUrlProviderFileiOSPath = 'iOS/Core/AppURLs.swift' ;
170+ let updateEmbeddedFileiOSPath = 'iOS/scripts/update_embedded.sh' ;
171+ let configUrlProvideriOSRegex = 'static let privacyConfig = URL.*string:.*staticBase.*trackerblocking\/config\/(.*)\".*' ;
172+ let updateEmbeddediOSRegex = 'performUpdate \'https://staticcdn.duckduckgo.com/trackerblocking/config/(.*)\' \".*' ;
173+
174+ let appConfigUrlProviderFilemacOSPath = 'macOS/DuckDuckGo/Application/AppConfigurationURLProvider.swift' ;
175+ let updateEmbeddedFilemacOSPath = 'macOS/scripts/update_embedded.sh' ;
176+ let configUrlProvidermacOSRegex = 'public static let defaultPrivacyConfigurationURL = URL.string: \"(.*)\".*' ;
177+ let updateEmbeddedmacOSRegex = 'CONFIG_URL=\"(.*)\"' ;
178+
179+ const iosResult = await checkForMismatch ( modifiedFiles , appConfigUrlProviderFileiOSPath , configUrlProvideriOSRegex , updateEmbeddedFileiOSPath , updateEmbeddediOSRegex ) ;
180+ if ( iosResult ) {
181+ fail ( `iOS Privacy Config URL mismatch. Please check ${ appConfigUrlProviderFileiOSPath } and ${ updateEmbeddedFileiOSPath } ` )
182+ }
196183
197- configUrlProviderRegex = 'case \.privacyConfiguration: return URL.string: \"(.*)\".*' ;
198- updateEmbeddedRegex = 'CONFIG_URL=\"(.*)\"' ;
199- break ;
200- default :
201- return ;
202- }
203-
204- const res = await checkForMismatch ( modifiedFiles , appConfigUrlProviderFilePath , configUrlProviderRegex , updateEmbeddedFilePath , updateEmbeddedRegex ) ;
205- if ( res ) {
206- fail ( `Privacy Config URL mismatch. Please check ${ appConfigUrlProviderFilePath } and ${ updateEmbeddedFilePath } ` )
184+ const macosResult = await checkForMismatch ( modifiedFiles , appConfigUrlProviderFilemacOSPath , configUrlProvidermacOSRegex , updateEmbeddedFilemacOSPath , updateEmbeddedmacOSRegex ) ;
185+ if ( macosResult ) {
186+ fail ( `macOS Privacy Config URL mismatch. Please check ${ appConfigUrlProviderFilemacOSPath } and ${ updateEmbeddedFilemacOSPath } ` )
207187 }
208188}
209189
210190export const embeddedFilesURLMismatch = async ( ) => {
211- const repo = danger . github . thisPR . repo ;
212191 const modifiedFiles = danger . git . modified_files ;
213192
214- await trackerBlockingMismatch ( repo , modifiedFiles )
215- await privacyConfigMismatch ( repo , modifiedFiles )
193+ await trackerBlockingMismatch ( modifiedFiles )
194+ await privacyConfigMismatch ( modifiedFiles )
216195}
217196
218197export const releaseAndHotfixBranchBSKChangeWarning = async ( ) => {
@@ -235,7 +214,7 @@ export const releaseAndHotfixBranchBSKChangeWarning = async () => {
235214export default async ( ) => {
236215 await prSize ( )
237216 await internalLink ( )
238- await xcodeprojConfiguration ( )
217+ await xcodeprojConfiguration_macOS ( )
239218 await localizedStrings ( )
240219 await licensedFonts ( )
241220 await newColors ( )
0 commit comments