Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
No Bug: Add support for building with enterprise account (#2732)
Browse files Browse the repository at this point in the history
Renames build channels:
- `developer` -> `debug`
- `enterprise` -> `dev`

Then creates `enterprise` again for enterprise builds

Renames preprocessor macros:
- `MOZ_CHANNEL_FENNEC` -> `MOZ_CHANNEL_DEBUG`
- `MOZ_CHANNEL_ENTERPRISE` -> `MOZ_CHANNEL_DEV`

Then creates `MOZ_CHANNEL_ENTERPRISE` again for enterprise builds
  • Loading branch information
kylehickinson authored Jul 23, 2020
1 parent f7a6c61 commit eecd60e
Show file tree
Hide file tree
Showing 42 changed files with 1,612 additions and 184 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ Client/Configuration/Local/

adblock-regions.txt
yubikit.log

# Fastlane Env
.env
.env.*
2 changes: 1 addition & 1 deletion BraveRewardsUI/QA Settings/QASettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class QASettingsViewController: TableViewController {

title = "Rewards QA Settings"

let isDefaultEnvironmentProd = AppConstants.buildChannel != .developer
let isDefaultEnvironmentProd = AppConstants.buildChannel != .debug

let override: EnvironmentOverride = EnvironmentOverride(rawValue: Preferences.Rewards.environmentOverride.value) ?? .none
segmentedControl.selectedSegmentIndex = EnvironmentOverride.sortedCases.firstIndex(of: override) ?? 0
Expand Down
4 changes: 2 additions & 2 deletions BraveShared/Analytics/DAU.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class DAU {
/// Sends ping to server and returns a boolean whether a timer for the server call was scheduled.
/// A user needs to be active for a certain amount of time before we ping the server.
@discardableResult public func sendPingToServer() -> Bool {
if AppConstants.buildChannel == .developer {
if AppConstants.buildChannel == .debug || AppConstants.buildChannel == .enterprise {
log.info("Development build detected, no server ping.")
return false
}
Expand Down Expand Up @@ -188,7 +188,7 @@ public class DAU {
return true
}

let daysThatMustPassToSkipDtoi = AppConstants.buildChannel == .enterprise ? 2 : 14
let daysThatMustPassToSkipDtoi = AppConstants.buildChannel == .dev ? 2 : 14

return (currentDateOrdinal - referenceDateOrdinal) > daysThatMustPassToSkipDtoi
}
Expand Down
2 changes: 1 addition & 1 deletion BraveShared/Analytics/UserReferralProgram.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class UserReferralProgram {
}

// This should _probably_ correspond to the baseUrl for NTPDownloader
let host = AppConstants.buildChannel == .developer ? HostUrl.staging : HostUrl.prod
let host = AppConstants.buildChannel == .debug ? HostUrl.staging : HostUrl.prod

guard let apiKey = getPlistString(for: UserReferralProgram.apiKeyPlistKey)?.trimmingCharacters(in: .whitespacesAndNewlines) else {
log.error("Urp init error, failed to get values from Brave.plist.")
Expand Down
13 changes: 8 additions & 5 deletions BraveSharedTests/DAUTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ class DAUTests: XCTestCase {
let externalBetaExpected = URLQueryItem(name: "channel", value: "beta")
XCTAssertEqual(dau.channelParam(for: .beta), externalBetaExpected)

let internalBetaExpected = URLQueryItem(name: "channel", value: "developer")
XCTAssertEqual(dau.channelParam(for: .enterprise), internalBetaExpected)
let devExpected = URLQueryItem(name: "channel", value: "developer")
XCTAssertEqual(dau.channelParam(for: .dev), devExpected)

let devExpected = URLQueryItem(name: "channel", value: "invalid")
XCTAssertEqual(dau.channelParam(for: .developer), devExpected)
let debugExpected = URLQueryItem(name: "channel", value: "invalid")
XCTAssertEqual(dau.channelParam(for: .debug), debugExpected)

let enterpriseExpected = URLQueryItem(name: "channel", value: "invalid")
XCTAssertEqual(dau.channelParam(for: .enterprise), enterpriseExpected)
}

func testVersionParam() {
Expand Down Expand Up @@ -300,7 +303,7 @@ class DAUTests: XCTestCase {
}

func testNoPingOnDevelopmentBuild() {
XCTAssertTrue(AppConstants.buildChannel == .developer)
XCTAssertTrue(AppConstants.buildChannel == .debug)

let dau = DAU()
XCTAssertFalse(dau.sendPingToServer())
Expand Down
1,168 changes: 1,011 additions & 157 deletions Client.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions Client.xcodeproj/xcshareddata/xcschemes/BraveShareTo.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "27F443942135E11200296C58"
BuildableName = "BraveShareTo.appex"
BlueprintName = "BraveShareTo"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
78 changes: 78 additions & 0 deletions Client.xcodeproj/xcshareddata/xcschemes/Enterprise.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Enterprise"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F84B21BD1A090F8100AAB793"
BuildableName = "Client.app"
BlueprintName = "Client"
ReferencedContainer = "container:Client.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Enterprise"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion Client/Application/Delegates/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UIViewControllerRestorati

// Don't track crashes if we're building the development environment due to the fact that terminating/stopping
// the simulator via Xcode will count as a "crash" and lead to restore popups in the subsequent launch
let crashedLastSession = !Preferences.AppState.backgroundedCleanly.value && AppConstants.buildChannel != .developer
let crashedLastSession = !Preferences.AppState.backgroundedCleanly.value && AppConstants.buildChannel != .debug
Preferences.AppState.backgroundedCleanly.value = false
browserViewController = BrowserViewController(profile: self.profile!, tabManager: self.tabManager, crashedLastSession: crashedLastSession)
browserViewController.edgesForExtendedLayout = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"images" : [
{
"filename" : "icon_20pt@2x-1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "icon_20pt@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "icon_29pt-1.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "icon_29pt@2x-1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "icon_29pt@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "icon_40pt@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "icon_40pt@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "icon_60pt@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "icon_60pt@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "icon_20pt-1.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "icon_40pt-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "icon_76pt-1.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "icon_76pt@2x-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "icon_83.5@2x-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "Icon-1.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Client/Configuration/Debug.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INCLUDE_SETTINGS_BUNDLE = YES

// Defines Swift Flags, (used as #if/#endif) inside *Swift* code
// BASE 'inheritence' at end, due to dynamic nature of those flags
OTHER_SWIFT_FLAGS=-DMOZ_CHANNEL_FENNEC $(OTHER_SWIFT_FLAGS_BASE)
OTHER_SWIFT_FLAGS=-DMOZ_CHANNEL_DEBUG $(OTHER_SWIFT_FLAGS_BASE)

ENABLE_TESTABILITY = YES

Expand Down
2 changes: 1 addition & 1 deletion Client/Configuration/Dev.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ INCLUDE_SETTINGS_BUNDLE = YES

// Defines Swift Flags, (used as #if/#endif) inside *Swift* code
// BASE 'inheritence' at end, due to dynamic nature of those flags
OTHER_SWIFT_FLAGS=-DMOZ_CHANNEL_ENTERPRISE $(OTHER_SWIFT_FLAGS_BASE)
OTHER_SWIFT_FLAGS=-DMOZ_CHANNEL_DEV $(OTHER_SWIFT_FLAGS_BASE)

GCC_PREPROCESSOR_DEFINITIONS= DEBUG=1

Loading

0 comments on commit eecd60e

Please sign in to comment.