[PM-17411] Rename files to indicate they belong to Authenticator (#223)

This commit is contained in:
Katherine Bertelsen 2025-01-30 11:43:03 -06:00 committed by GitHub
parent c6d53a4f35
commit e7356d2fdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 204 additions and 35 deletions

View File

@ -142,22 +142,22 @@ jobs:
- name: Select variant
run: |
./Scripts/select_variant.sh ${{ env.build-variant }}
./Scripts-bwa/select_variant.sh ${{ env.build-variant }}
- name: Update build version
if: ${{ inputs.build-version }}
run: |
yq -i '.settings.MARKETING_VERSION = "${{ inputs.build-version }}"' 'project.yml'
yq -i '.settings.MARKETING_VERSION = "${{ inputs.build-version }}"' 'project-bwa.yml'
- name: Update build number
run: |
BUILD_NUMBER=$(($GITHUB_RUN_NUMBER))
yq -i ".settings.CURRENT_PROJECT_VERSION = ${{ inputs.build-number || '$BUILD_NUMBER' }}" 'project.yml'
yq -i ".settings.CURRENT_PROJECT_VERSION = ${{ inputs.build-number || '$BUILD_NUMBER' }}" 'project-bwa.yml'
- name: Build iOS app
run: |
BUILD_NUMBER=$(($GITHUB_RUN_NUMBER))
./Scripts/build.sh
./Scripts-bwa/build.sh
- name: Upload IPA
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
@ -206,6 +206,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
with:
config: crowdin.yml
config: crowdin-bwa.yml
upload_sources: true
upload_translations: false

View File

@ -42,4 +42,4 @@ jobs:
- name: Install Mint
run: |
brew install mint
./Scripts/bootstrap.sh
./Scripts-bwa/bootstrap.sh

View File

@ -41,7 +41,7 @@ jobs:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
with:
config: crowdin.yml
config: crowdin-bwa.yml
upload_sources: false
upload_translations: false
download_translations: true

View File

@ -72,7 +72,7 @@ jobs:
- name: Install Mint, protobuf, xcbeautify, and xcresultparser
run: |
brew install mint swift-protobuf xcbeautify a7ex/homebrew-formulae/xcresultparser
./Scripts/bootstrap.sh
./Scripts-bwa/bootstrap.sh
- name: Build and test
run: |

View File

@ -46,17 +46,17 @@ Bitwarden Authenticator allows you easily store and generate two-factor authenti
3. Bootstrap the project:
```sh
$ Scripts/bootstrap.sh
$ Scripts-bwa/bootstrap.sh
```
> **Note**
> Because `Scripts/bootstrap.sh` is how the project is generated, `bootstrap.sh` will need to be run every time the project configuration or file structure has changed (for example, when files have been added, removed or moved). It is typically best practice to run `bootstrap.sh` any time you switch branches or pull down changes.
> Because `Scripts-bwa/bootstrap.sh` is how the project is generated, `bootstrap.sh` will need to be run every time the project configuration or file structure has changed (for example, when files have been added, removed or moved). It is typically best practice to run `bootstrap.sh` any time you switch branches or pull down changes.
Alternatively, you can create git hooks to automatically execute the `bootstrap.sh` script every time a git hook occurs. To use the git hook scripts already defined in the `Scripts` directory, copy the scripts to the `.git/hooks` directory.
```sh
$ cp Scripts/post-merge .git/hooks/
$ cp Scripts/post-checkout .git/hooks/
$ cp Scripts-bwa/post-merge .git/hooks/
$ cp Scripts-bwa/post-checkout .git/hooks/
```
### Run the App
@ -79,7 +79,7 @@ This project is linted using both SwiftLint and SwiftFormat. Both tools run in l
Additionally, if you would like SwiftFormat to autocorrect any issues before every commit, you can use a git hook script. To use the git hook script already defined in the `Scripts` directory, copy the script to the `.git/hooks` directory.
```sh
$ cp Scripts/pre-commit .git/hooks/
$ cp Scripts-bwa/pre-commit .git/hooks/
```
## Project Structure
@ -90,7 +90,7 @@ This project's structure is split into separate sections to support sharing as m
### GlobalTestHelpers
`GlobalTestHelpers` is a directory that contains helper files used in all test targets. This directory is included in each target that is defined in the `project.yml` file.
`GlobalTestHelpers` is a directory that contains helper files used in all test targets. This directory is included in each target that is defined in the `project-bwa.yml` file.
## Contribute

11
Scripts-bwa/bootstrap.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
mint bootstrap
# Handle script being called from repo root or Scripts folder
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
repo_root=$(dirname "$script_dir")
mint run xcodegen --spec "$repo_root/project-bwa.yml"

43
Scripts-bwa/build.sh Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# Builds the Authenticator iOS app, and outputs an IPA file that can be uploaded to TestFlight.
#
# Usage:
#
# $ ./build.sh
set -euo pipefail
bold=$(tput -T ansi bold)
normal=$(tput -T ansi sgr0)
BUILD_DIR="build"
ARCHIVE_PATH="${BUILD_DIR}/Authenticator.xcarchive"
EXPORT_PATH="${BUILD_DIR}/Authenticator"
echo "🧱 Building in $(pwd)"
echo ""
echo "🌱 Generating xcode project"
mint run xcodegen
mkdir -p "${BUILD_DIR}"
echo "🔨 Performing Xcode archive"
xcrun xcodebuild archive \
-project Authenticator.xcodeproj \
-scheme Authenticator \
-configuration Release \
-archivePath "${ARCHIVE_PATH}" \
| xcbeautify --renderer github-actions
echo ""
echo "📦 Performing Xcode archive export"
xcrun xcodebuild -exportArchive \
-archivePath "${ARCHIVE_PATH}" \
-exportPath "${EXPORT_PATH}" \
-exportOptionsPlist "Configs-bwa/export_options.plist" \
| xcbeautify --renderer github-actions
echo "🎉 Build complete"

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
# if [ "$CONFIGURATION" != "Debug" ]; then
# find "${DWARF_DSYM_FOLDER_PATH}" -name "*.dSYM" \
# -exec "${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols" \
# -gsp "${PROJECT_DIR}/Bitwarden/Application/Support/GoogleService-Info.plist" \
# -p ios -- {} +
# fi

4
Scripts-bwa/post-checkout Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
PATH=/usr/local/bin:$PATH
./Scripts-bwa/bootstrap.sh

4
Scripts-bwa/post-merge Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
PATH=/usr/local/bin:$PATH
./Scripts-bwa/bootstrap.sh

4
Scripts-bwa/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
PATH=/usr/local/bin:$PATH
mint run swiftformat .

69
Scripts-bwa/select_variant.sh Executable file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
#
# Updates the Release version of the Authenticator app to a build variant
#
# Usage:
#
# $ ./select_variant.sh <variant>
set -euo pipefail
bold=$(tput -T ansi bold)
normal=$(tput -T ansi sgr0)
if [ $# -ne 1 ]; then
echo >&2 "Called without necessary arguments: ${bold}Variant${normal}."
echo >&2 "For example: \`Scripts-bwa/select_variant.sh Beta."
exit 1
fi
variant=$1
echo "🧱 Setting build variant to ${bold}${variant}${normal}."
local_xcconfig_file="Configs-bwa/Local.xcconfig"
export_options_file="Configs-bwa/export_options.plist"
case $variant in
Production)
ios_bundle_id='com.bitwarden.authenticator'
shared_app_group_id='group.com.bitwarden.bitwarden-authenticator'
profile_prefix="Dist:"
app_icon="AppIcon"
;;
Beta)
ios_bundle_id='com.bitwarden.autenticator.beta'
shared_app_group_id='group.com.bitwarden.bitwarden-authenticator.beta'
profile_prefix="Dist: Beta"
app_icon="AppIcon-Beta"
;;
esac
cat << EOF > ${local_xcconfig_file}
CODE_SIGN_STYLE = Manual
CODE_SIGN_IDENTITY = Apple Distribution
DEVELOPMENT_TEAM = LTZ2PFU5D6
ORGANIZATION_IDENTIFIER = com.8bit
BASE_BUNDLE_ID = ${ios_bundle_id}
SHARED_APP_GROUP_IDENTIFIER = ${shared_app_group_id}
APPICON_NAME = ${app_icon}
PROVISIONING_PROFILE_SPECIFIER = ${profile_prefix} Bitwarden Authenticator
EOF
cat << EOF > ${export_options_file}
<?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>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<key>${ios_bundle_id}</key>
<string>${profile_prefix} Bitwarden Authenticator</string>
</dict>
<key>manageAppVersionAndBuildNumber</key>
<false/>
</dict>
</plist>
EOF

View File

@ -0,0 +1,10 @@
#!/bin/sh
#
# Updates the list of third-party software licenses displayed in app settings.
set -euo pipefail
if [ "$CONFIGURATION" = "Debug" ]; then
mint run LicensePlist license-plist \
--config-path .license-plist-bwa.yml
fi

View File

@ -0,0 +1,10 @@
#!/bin/bash
#
# Updates the version number stored in Settings.bundle to match the version in Xcode.
set -e
SETTINGS_BUNDLE_PATH="${CODESIGNING_FOLDER_PATH}/Settings.bundle/Root.plist"
BUILD_STRING="${MARKETING_VERSION} (${CURRENT_PROJECT_VERSION})"
/usr/libexec/PlistBuddy -c "Set PreferenceSpecifiers:0:DefaultValue $BUILD_STRING" "${SETTINGS_BUNDLE_PATH}"

View File

@ -4,4 +4,8 @@ set -euo pipefail
mint bootstrap
mint run xcodegen
# Handle script being called from repo root or Scripts folder
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
repo_root=$(dirname "$script_dir")
mint run xcodegen --spec "$repo_root/project-bwa.yml"

View File

@ -37,7 +37,7 @@ echo "📦 Performing Xcode archive export"
xcrun xcodebuild -exportArchive \
-archivePath "${ARCHIVE_PATH}" \
-exportPath "${EXPORT_PATH}" \
-exportOptionsPlist "Configs/export_options.plist" \
-exportOptionsPlist "Configs-bwa/export_options.plist" \
| xcbeautify --renderer github-actions
echo "🎉 Build complete"

View File

@ -1,4 +1,4 @@
#!/bin/bash
PATH=/usr/local/bin:$PATH
./Scripts/bootstrap.sh
./Scripts-bwa/bootstrap.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash
PATH=/usr/local/bin:$PATH
./Scripts/bootstrap.sh
./Scripts-bwa/bootstrap.sh

View File

@ -13,7 +13,7 @@ normal=$(tput -T ansi sgr0)
if [ $# -ne 1 ]; then
echo >&2 "Called without necessary arguments: ${bold}Variant${normal}."
echo >&2 "For example: \`Scripts/select_variant.sh Beta."
echo >&2 "For example: \`Scripts-bwa/select_variant.sh Beta."
exit 1
fi
@ -21,8 +21,8 @@ variant=$1
echo "🧱 Setting build variant to ${bold}${variant}${normal}."
local_xcconfig_file="Configs/Local.xcconfig"
export_options_file="Configs/export_options.plist"
local_xcconfig_file="Configs-bwa/Local.xcconfig"
export_options_file="Configs-bwa/export_options.plist"
case $variant in
Production)

View File

@ -6,5 +6,5 @@ set -euo pipefail
if [ "$CONFIGURATION" = "Debug" ]; then
mint run LicensePlist license-plist \
--config-path .license_plist.yml
--config-path .license-plist-bwa.yml
fi

View File

@ -1,6 +1,6 @@
name: Authenticator
fileGroups:
- Configs
- Configs-bwa
configs:
Debug: debug
Release: release
@ -75,8 +75,8 @@ targets:
type: application
platform: iOS
configFiles:
Debug: Configs/Authenticator-Debug.xcconfig
Release: Configs/Authenticator-Release.xcconfig
Debug: Configs-bwa/Authenticator-Debug.xcconfig
Release: Configs-bwa/Authenticator-Release.xcconfig
settings:
base:
INFOPLIST_FILE: Authenticator/Application/Support/Info.plist
@ -85,7 +85,7 @@ targets:
excludes:
- "**/*Tests.*"
- "**/TestHelpers/*"
- "**/swiftgen.yml"
- "**/swiftgen-bwa.yml"
- "**/GoogleService-Info.*.plist"
- "**/__Snapshots__/*"
- path: Authenticator
@ -93,16 +93,16 @@ targets:
- "**/__Snapshots__/*"
- "**/GoogleService-Info.*.plist"
buildPhase: none
- path: README.md
- path: README-bwa.md
buildPhase: none
- path: swiftgen.yml
- path: swiftgen-bwa.yml
buildPhase: none
dependencies:
- target: AuthenticatorShared
- package: Firebase
product: FirebaseCrashlytics
preBuildScripts:
- path: Scripts/update_acknowledgements.sh
- path: Scripts-bwa/update_acknowledgements.sh
name: "Settings.bundle: Update Acknowledgements"
outputFiles:
- $(SRCROOT)/Authenticator/Application/Support/Settings.bundle/Acknowledgements.plist
@ -124,7 +124,7 @@ targets:
name: SwiftFormat Lint
basedOnDependencyAnalysis: false
postBuildScripts:
- path: Scripts/update_settings_version_number.sh
- path: Scripts-bwa/update_settings_version_number.sh
name: "Settings.bundle: Update Version Number"
basedOnDependencyAnalysis: false
AuthenticatorTests:
@ -138,7 +138,7 @@ targets:
includes:
- "**/*Tests.*"
- "**/TestHelpers/*"
- path: GlobalTestHelpers
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
- package: BitwardenShared
@ -151,8 +151,8 @@ targets:
type: framework
platform: iOS
configFiles:
Debug: Configs/AuthenticatorShared-Debug.xcconfig
Release: Configs/AuthenticatorShared-Release.xcconfig
Debug: Configs-bwa/AuthenticatorShared-Debug.xcconfig
Release: Configs-bwa/AuthenticatorShared-Release.xcconfig
settings:
base:
APPLICATION_EXTENSION_API_ONLY: true
@ -186,7 +186,7 @@ targets:
if [[ ! "$PATH" =~ "/opt/homebrew/bin" ]]; then
PATH="/opt/homebrew/bin:$PATH"
fi
mint run swiftgen config run --config "swiftgen.yml"
mint run swiftgen config run --config "swiftgen-bwa.yml"
basedOnDependencyAnalysis: false
outputFiles:
- $(SRCROOT)/AuthenticatorShared/UI/Platform/Application/Support/Generated/Assets.swift
@ -215,7 +215,7 @@ targets:
- "**/*Tests.*"
- "**/TestHelpers/*"
- "**/Fixtures/*"
- path: GlobalTestHelpers
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
- target: AuthenticatorShared