Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
87 changes: 29 additions & 58 deletions project-bwa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,11 @@ targets:
settings:
base:
INFOPLIST_FILE: Authenticator/Application/Support/Info.plist
templates:
- CommonTarget
templateAttributes:
sourcesPath: Authenticator
sources:
- path: Authenticator
excludes:
- "**/*Tests.*"
- "**/TestHelpers/*"
- "**/swiftgen-bwa.yml"
- "**/GoogleService-Info.*.plist"
- "**/__Snapshots__/*"
- path: Authenticator
includes:
- "**/__Snapshots__/*"
- "**/GoogleService-Info.*.plist"
buildPhase: none
- path: README-bwa.md
buildPhase: none
- path: swiftgen-bwa.yml
Expand Down Expand Up @@ -144,11 +136,11 @@ targets:
settings:
base:
INFOPLIST_FILE: Authenticator/Application/TestHelpers/Support/Info.plist
templates:
- TestTarget
templateAttributes:
sourcesPath: Authenticator
sources:
- path: Authenticator
includes:
- "**/*Tests.*"
- "**/TestHelpers/*"
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
Expand All @@ -167,25 +159,16 @@ targets:
base:
APPLICATION_EXTENSION_API_ONLY: true
INFOPLIST_FILE: AuthenticatorShared/UI/Platform/Application/Support/Info.plist
templates:
- CommonTarget
- SourceryTarget
templateAttributes:
sourcesPath: AuthenticatorShared
sources:
- path: AuthenticatorShared
excludes:
- "**/*Tests.*"
- "**/TestHelpers/*"
- "**/Fixtures/*"
- "**/__Snapshots__/*"
- "**/Sourcery/Generated/*"
- "**/sourcery.yml"
- path: AuthenticatorShared
includes:
- "**/__Snapshots__/*"
buildPhase: none
- path: AuthenticatorShared/UI/Platform/Application/Support/Generated/Assets.swift
optional: true
- path: AuthenticatorShared/Core/Vault/Services/Importers/Support/Generated/GoogleAuth.pb.swift
optional: true
- path: AuthenticatorShared/Sourcery/sourcery.yml
buildPhase: none
dependencies:
- package: BitwardenSdk
- package: SwiftProtobuf
Expand Down Expand Up @@ -213,27 +196,18 @@ targets:
$SRCROOT/AuthenticatorShared/Core/Vault/Services/Importers/Support/GoogleAuth.proto
outputFiles:
- $(SRCROOT)/AuthenticatorShared/Core/Vault/Services/Importers/Support/Generated/GoogleAuth.pb.swift
- name: Sourcery
script: |
if [[ ! "$PATH" =~ "/opt/homebrew/bin" ]]; then
PATH="/opt/homebrew/bin:$PATH"
fi
mint run sourcery --config AuthenticatorShared/Sourcery/sourcery.yml
basedOnDependencyAnalysis: false
outputFiles:
- $(SRCROOT)/AuthenticatorShared/Sourcery/Generated/AutoMockable.generated.swift
AuthenticatorSharedMocks:
type: framework
platform: iOS
settings:
base:
ENABLE_TESTING_SEARCH_PATHS: YES
GENERATE_INFOPLIST_FILE: YES
templates:
- MocksTarget
templateAttributes:
sourcesPath: AuthenticatorShared
sources:
- path: AuthenticatorShared
includes:
- "**/Fixtures/*"
- "**/Mocks/*"
- path: AuthenticatorShared/Sourcery/Generated/AutoMockable.generated.swift
optional: true
dependencies:
Expand All @@ -248,14 +222,11 @@ targets:
BUNDLE_LOADER: "$(TEST_HOST)"
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Authenticator.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Authenticator"
INFOPLIST_FILE: AuthenticatorShared/UI/Platform/Application/TestHelpers/Support/Info.plist
templates:
- TestTarget
templateAttributes:
sourcesPath: AuthenticatorShared
sources:
- path: AuthenticatorShared
includes:
- "**/*Tests.*"
- "**/TestHelpers/*"
excludes:
- "**/*SnapshotTests.*"
- "**/*ViewInspectorTests.*"
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
Expand All @@ -276,11 +247,11 @@ targets:
BUNDLE_LOADER: "$(TEST_HOST)"
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Authenticator.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Authenticator"
INFOPLIST_FILE: AuthenticatorShared/UI/Platform/Application/TestHelpers/Support/Info.plist
templates:
- SnapshotTestTarget
templateAttributes:
sourcesPath: AuthenticatorShared
sources:
- path: AuthenticatorShared
includes:
- "**/*SnapshotTests.*"
- "**/TestHelpers/*"
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
Expand All @@ -302,11 +273,11 @@ targets:
BUNDLE_LOADER: "$(TEST_HOST)"
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Authenticator.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Authenticator"
INFOPLIST_FILE: AuthenticatorShared/UI/Platform/Application/TestHelpers/Support/Info.plist
templates:
- ViewInspectorTestTarget
templateAttributes:
sourcesPath: AuthenticatorShared
sources:
- path: AuthenticatorShared
includes:
- "**/*ViewInspectorTests.*"
- "**/TestHelpers/*"
- path: GlobalTestHelpers-bwa
dependencies:
- target: Authenticator
Expand Down
100 changes: 33 additions & 67 deletions project-bwk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,10 @@ targets:
APPLICATION_EXTENSION_API_ONLY: true
INFOPLIST_FILE: AuthenticatorBridgeKit/Info.plist
SWIFT_STRICT_CONCURRENCY: complete
sources:
- path: AuthenticatorBridgeKit
excludes:
- "**/Fixtures/*"
- "**/Mocks/*"
- "**/Tests/*"
- "**/*Tests.*"
- "**/TestHelpers/*"
templates:
- CommonTarget
templateAttributes:
sourcesPath: AuthenticatorBridgeKit
dependencies:
- target: BitwardenKit
AuthenticatorBridgeKitTests:
Expand All @@ -84,12 +80,10 @@ targets:
base:
INFOPLIST_FILE: AuthenticatorBridgeKit/Tests/TestHelpers/Support/Info.plist
SWIFT_STRICT_CONCURRENCY: complete
sources:
- path: AuthenticatorBridgeKit
includes:
- "**/Tests/*"
- "**/*Tests.*"
- "**/TestHelpers/*"
templates:
- TestTarget
templateAttributes:
sourcesPath: AuthenticatorBridgeKit
dependencies:
- target: AuthenticatorBridgeKit
- target: AuthenticatorBridgeKitMocks
Expand All @@ -105,11 +99,10 @@ targets:
ENABLE_TESTING_SEARCH_PATHS: YES
INFOPLIST_FILE: AuthenticatorBridgeKit/MocksInfo.plist
SWIFT_STRICT_CONCURRENCY: complete
sources:
- path: AuthenticatorBridgeKit
includes:
- "**/Fixtures/*"
- "**/Mocks/*"
templates:
- MocksTarget
templateAttributes:
sourcesPath: AuthenticatorBridgeKit
dependencies:
- target: AuthenticatorBridgeKit
- target: BitwardenKit
Expand All @@ -124,49 +117,28 @@ targets:
base:
APPLICATION_EXTENSION_API_ONLY: true
INFOPLIST_FILE: BitwardenKit/Info.plist
sources:
- path: BitwardenKit
excludes:
- "**/Fixtures/*"
- "**/Mocks/*"
- "**/*Tests.*"
- "**/TestHelpers/*"
- "**/__Snapshots__/*"
- "**/Sourcery/Generated/*"
- "**/sourcery.yml"
- path: BitwardenKit
includes:
- "**/__Snapshots__/*"
- "**/GoogleService-Info.*.plist"
- "**/sourcery.yml"
buildPhase: none
templates:
- CommonTarget
- SourceryTarget
templateAttributes:
sourcesPath: BitwardenKit
dependencies:
- package: BitwardenSdk
- package: SwiftUIIntrospect
- target: BitwardenResources
- target: Networking
preBuildScripts:
- name: Sourcery
script: |
if [[ ! "$PATH" =~ "/opt/homebrew/bin" ]]; then
PATH="/opt/homebrew/bin:$PATH"
fi
mint run sourcery --config BitwardenKit/Sourcery/sourcery.yml
basedOnDependencyAnalysis: false
outputFiles:
- $(SRCROOT)/BitwardenKit/Sourcery/Generated/AutoMockable.generated.swift
BitwardenKitMocks:
type: framework
platform: iOS
settings:
base:
ENABLE_TESTING_SEARCH_PATHS: YES
INFOPLIST_FILE: BitwardenKit/Application/Mocks/Support/Info.plist
templates:
- MocksTarget
templateAttributes:
sourcesPath: BitwardenKit
sources:
- path: BitwardenKit
includes:
- "**/Fixtures/*"
- "**/Mocks/*"
- path: BitwardenKit/Sourcery/Generated/AutoMockable.generated.swift
optional: true
dependencies:
Expand All @@ -178,14 +150,10 @@ targets:
settings:
base:
INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist
sources:
- path: BitwardenKit
includes:
- "**/*Tests.*"
- "**/TestHelpers/*"
excludes:
- "**/*SnapshotTests.*"
- "**/*ViewInspectorTests.*"
templates:
- TestTarget
templateAttributes:
sourcesPath: BitwardenKit
dependencies:
- target: AuthenticatorBridgeKitMocks
- target: BitwardenKit
Expand All @@ -201,11 +169,10 @@ targets:
settings:
base:
INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist
sources:
- path: BitwardenKit
includes:
- "**/*SnapshotTests.*"
- "**/TestHelpers/*"
templates:
- SnapshotTestTarget
templateAttributes:
sourcesPath: BitwardenKit
dependencies:
- target: AuthenticatorBridgeKitMocks
- target: BitwardenKit
Expand All @@ -219,11 +186,10 @@ targets:
settings:
base:
INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist
sources:
- path: BitwardenKit
includes:
- "**/*ViewInspectorTests.*"
- "**/TestHelpers/*"
templates:
- ViewInspectorTestTarget
templateAttributes:
sourcesPath: BitwardenKit
dependencies:
- target: AuthenticatorBridgeKitMocks
- target: BitwardenKit
Expand Down
67 changes: 67 additions & 0 deletions project-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,70 @@ packages:
ViewInspector:
url: https://github.com/nalexn/ViewInspector
exactVersion: 0.10.3
targetTemplates:
# Adds common include/excludes for app and framework targets.
CommonTarget:
sources:
- path: ${sourcesPath}
excludes:
- "**/*Tests.*"
- "**/.gitignore"
- "**/Fixtures/*"
- "**/GoogleService-Info.*.plist"
- "**/Mocks/*"
- "**/Sourcery/Generated/*"
- "**/TestHelpers/*"
- "**/Tests/*"
- "**/__Snapshots__/*"
- "**/sourcery.yml"
- path: ${sourcesPath}
includes:
- "**/__Snapshots__/*"
- "**/GoogleService-Info.*.plist"
buildPhase: none
# Adds common include/excludes for mocks targets.
MocksTarget:
sources:
- path: ${sourcesPath}
includes:
- "**/Fixtures/*"
- "**/Mocks/*"
Comment on lines +50 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿค” Should the auto generated Sourcery optional file be added here as well?

- path: ${sourcesPath}/Sourcery/Generated/AutoMockable.generated.swift
        optional: true

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue with this is that not all targets using the MocksTarget template integrate Sourcery. AuthenticatorBridgeKitMocks doesn't use Sourcery (yet), which causes the build to fail if that file doesn't exist. I guess we could add Sourcery for that target or keep it as-is for now. Do you have a preference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like the bridge to follow the same pattern at some point but currently there are only 2 mocks in there, so applying it now may be a bit overkill.
Maybe we can revisit this if we have more work being done in the bridge. Does that sound good to you?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I like that.

# Adds common include/excludes for snapshot test targets.
SnapshotTestTarget:
sources:
- path: ${sourcesPath}
includes:
- "**/*SnapshotTests.*"
- "**/TestHelpers/*"
# Adds the Sourcery pre-build script.
SourceryTarget:
sources:
- path: ${sourcesPath}/Sourcery/sourcery.yml
buildPhase: none
preBuildScripts:
- name: Sourcery
script: |
if [[ ! "$PATH" =~ "/opt/homebrew/bin" ]]; then
PATH="/opt/homebrew/bin:$PATH"
fi
mint run sourcery --config ${sourcesPath}/Sourcery/sourcery.yml
basedOnDependencyAnalysis: false
outputFiles:
- $(SRCROOT)/${sourcesPath}/Sourcery/Generated/AutoMockable.generated.swift
# Adds common include/excludes for test targets.
TestTarget:
sources:
- path: ${sourcesPath}
excludes:
- "**/*SnapshotTests.*"
- "**/*ViewInspectorTests.*"
includes:
- "**/*Tests.*"
- "**/TestHelpers/*"
# Adds common include/excludes for ViewInspector test targets.
ViewInspectorTestTarget:
sources:
- path: ${sourcesPath}
includes:
- "**/*ViewInspectorTests.*"
- "**/TestHelpers/*"
Loading