diff --git a/project-bwa.yml b/project-bwa.yml index bad7fc5ed8..ad8188fb27 100644 --- a/project-bwa.yml +++ b/project-bwa.yml @@ -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 @@ -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 @@ -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 @@ -213,15 +196,6 @@ 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 @@ -229,11 +203,11 @@ targets: 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: @@ -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 @@ -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 @@ -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 diff --git a/project-bwk.yml b/project-bwk.yml index e5e39a45fe..6ead03e027 100644 --- a/project-bwk.yml +++ b/project-bwk.yml @@ -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: @@ -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 @@ -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 @@ -124,37 +117,16 @@ 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 @@ -162,11 +134,11 @@ targets: 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: @@ -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 @@ -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 @@ -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 diff --git a/project-common.yml b/project-common.yml index a710fd8d9c..759d9eb1a6 100644 --- a/project-common.yml +++ b/project-common.yml @@ -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/*" + # 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/*" diff --git a/project-pm.yml b/project-pm.yml index 8c0aa0e317..8e64c9e57e 100644 --- a/project-pm.yml +++ b/project-pm.yml @@ -154,19 +154,11 @@ targets: settings: base: INFOPLIST_FILE: Bitwarden/Application/Support/Info.plist + templates: + - CommonTarget + templateAttributes: + sourcesPath: Bitwarden sources: - - path: Bitwarden - excludes: - - "**/*Tests.*" - - "**/TestHelpers/*" - - "**/swiftgen-pm.yml" - - "**/GoogleService-Info.*.plist" - - "**/__Snapshots__/*" - - path: Bitwarden - includes: - - "**/__Snapshots__/*" - - "**/GoogleService-Info.*.plist" - buildPhase: none - path: Bitwarden/Application/Support/GoogleService-Info.plist buildPhase: resources - path: README.md @@ -219,11 +211,11 @@ targets: settings: base: INFOPLIST_FILE: Bitwarden/Application/TestHelpers/Support/Info.plist + templates: + - TestTarget + templateAttributes: + sourcesPath: Bitwarden sources: - - path: Bitwarden - includes: - - "**/*Tests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: Bitwarden @@ -242,11 +234,10 @@ targets: base: CODE_SIGN_ENTITLEMENTS: BitwardenActionExtension/Application/Support/BitwardenActionExtension.entitlements INFOPLIST_FILE: BitwardenActionExtension/Application/Support/Info.plist - sources: - - path: BitwardenActionExtension - excludes: - - "**/*Tests.*" - - "**/TestHelpers/*" + templates: + - CommonTarget + templateAttributes: + sourcesPath: BitwardenActionExtension dependencies: - package: BitwardenSdk - target: BitwardenShared @@ -256,11 +247,11 @@ targets: settings: base: INFOPLIST_FILE: BitwardenActionExtension/Application/TestHelpers/Support/Info.plist + templates: + - TestTarget + templateAttributes: + sourcesPath: BitwardenActionExtension sources: - - path: BitwardenActionExtension - includes: - - "**/*Tests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: BitwardenActionExtension @@ -278,11 +269,10 @@ targets: base: CODE_SIGN_ENTITLEMENTS: BitwardenAutoFillExtension/Application/Support/BitwardenAutoFill.entitlements INFOPLIST_FILE: BitwardenAutoFillExtension/Application/Support/Info.plist - sources: - - path: BitwardenAutoFillExtension - excludes: - - "**/*Tests.*" - - "**/TestHelpers/*" + templates: + - CommonTarget + templateAttributes: + sourcesPath: BitwardenAutoFillExtension dependencies: - package: BitwardenSdk - target: BitwardenShared @@ -292,11 +282,11 @@ targets: settings: base: INFOPLIST_FILE: BitwardenAutoFillExtension/Application/TestHelpers/Support/Info.plist + templates: + - TestTarget + templateAttributes: + sourcesPath: BitwardenAutoFillExtension sources: - - path: BitwardenAutoFillExtension - includes: - - "**/*Tests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: BitwardenAutoFillExtension @@ -314,11 +304,10 @@ targets: base: INFOPLIST_FILE: BitwardenShareExtension/Application/Support/Info.plist CODE_SIGN_ENTITLEMENTS: BitwardenShareExtension/Application/Support/BitwardenShareExtension.entitlements - sources: - - path: BitwardenShareExtension - excludes: - - "**/*Tests.*" - - "**/TestHelpers/*" + templates: + - CommonTarget + templateAttributes: + sourcesPath: BitwardenShareExtension dependencies: - package: BitwardenSdk - target: BitwardenShared @@ -328,11 +317,11 @@ targets: settings: base: INFOPLIST_FILE: BitwardenShareExtension/Application/TestHelpers/Support/Info.plist + templates: + - TestTarget + templateAttributes: + sourcesPath: BitwardenShareExtension sources: - - path: BitwardenShareExtension - includes: - - "**/*Tests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: BitwardenShareExtension @@ -355,24 +344,15 @@ targets: - BitwardenShared/UI/Tools/PreviewContent - BitwardenShared/UI/Vault/PreviewContent INFOPLIST_FILE: BitwardenShared/UI/Platform/Application/Support/Info.plist + templates: + - CommonTarget + - SourceryTarget + templateAttributes: + sourcesPath: BitwardenShared sources: - - path: BitwardenShared - excludes: - - "**/*Tests.*" - - "**/TestHelpers/*" - - "**/Fixtures/*" - - "**/__Snapshots__/*" - - "**/Sourcery/Generated/*" - - "**/sourcery.yml" - - path: BitwardenShared - includes: - - "**/__Snapshots__/*" - buildPhase: none - path: BitwardenShared/UI/Platform/Application/Support/Generated/Assets.swift optional: true - path: BitwardenWatchShared - - path: BitwardenShared/Sourcery/sourcery.yml - buildPhase: none dependencies: - package: BitwardenSdk - target: BitwardenKit/AuthenticatorBridgeKit @@ -389,15 +369,6 @@ targets: basedOnDependencyAnalysis: false outputFiles: - $(SRCROOT)/BitwardenShared/UI/Platform/Application/Support/Generated/Assets.swift - - name: Sourcery - script: | - if [[ ! "$PATH" =~ "/opt/homebrew/bin" ]]; then - PATH="/opt/homebrew/bin:$PATH" - fi - mint run sourcery --config BitwardenShared/Sourcery/sourcery.yml - basedOnDependencyAnalysis: false - outputFiles: - - $(SRCROOT)/BitwardenShared/Sourcery/Generated/AutoMockable.generated.swift BitwardenSharedMocks: type: framework platform: iOS @@ -405,11 +376,11 @@ targets: base: ENABLE_TESTING_SEARCH_PATHS: YES GENERATE_INFOPLIST_FILE: YES + templates: + - MocksTarget + templateAttributes: + sourcesPath: BitwardenShared sources: - - path: BitwardenShared - includes: - - "**/Fixtures/*" - - "**/Mocks/*" - path: BitwardenShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: @@ -427,14 +398,11 @@ targets: BUNDLE_LOADER: "$(TEST_HOST)" TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Bitwarden.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Bitwarden" INFOPLIST_FILE: BitwardenShared/UI/Platform/Application/TestHelpers/Support/Info.plist + templates: + - TestTarget + templateAttributes: + sourcesPath: BitwardenShared sources: - - path: BitwardenShared - includes: - - "**/*Tests.*" - - "**/TestHelpers/*" - excludes: - - "**/*SnapshotTests.*" - - "**/*ViewInspectorTests.*" - path: GlobalTestHelpers dependencies: - target: Bitwarden @@ -458,11 +426,11 @@ targets: BUNDLE_LOADER: "$(TEST_HOST)" TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Bitwarden.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Bitwarden" INFOPLIST_FILE: BitwardenShared/UI/Platform/Application/TestHelpers/Support/Info.plist + templates: + - SnapshotTestTarget + templateAttributes: + sourcesPath: BitwardenShared sources: - - path: BitwardenShared - includes: - - "**/*SnapshotTests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: Bitwarden @@ -487,11 +455,11 @@ targets: BUNDLE_LOADER: "$(TEST_HOST)" TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Bitwarden.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Bitwarden" INFOPLIST_FILE: BitwardenShared/UI/Platform/Application/TestHelpers/Support/Info.plist + templates: + - ViewInspectorTestTarget + templateAttributes: + sourcesPath: BitwardenShared sources: - - path: BitwardenShared - includes: - - "**/*ViewInspectorTests.*" - - "**/TestHelpers/*" - path: GlobalTestHelpers dependencies: - target: Bitwarden