diff --git a/project-bwa.yml b/project-bwa.yml index 793b6437d0..012141f402 100644 --- a/project-bwa.yml +++ b/project-bwa.yml @@ -83,19 +83,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 @@ -140,11 +132,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 @@ -163,25 +155,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 @@ -209,15 +192,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 AuthenticatorSharedTests: type: bundle.unit-test platform: iOS @@ -226,18 +200,12 @@ 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/*" - - "**/Fixtures/*" - excludes: - - "**/*SnapshotTests.*" - - "**/*ViewInspectorTests.*" - path: GlobalTestHelpers-bwa - - path: AuthenticatorShared/Sourcery/Generated - optional: true - path: AuthenticatorShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: @@ -257,15 +225,12 @@ 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/*" - - "**/Fixtures/*" - path: GlobalTestHelpers-bwa - - path: AuthenticatorShared/Sourcery/Generated - optional: true - path: AuthenticatorShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: @@ -286,15 +251,12 @@ 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/*" - - "**/Fixtures/*" - path: GlobalTestHelpers-bwa - - path: AuthenticatorShared/Sourcery/Generated - optional: true - path: AuthenticatorShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: diff --git a/project-bwk.yml b/project-bwk.yml index 0ca47904d4..7eb91e8c6c 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 @@ -124,36 +118,15 @@ 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: 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 @@ -177,6 +150,8 @@ targets: settings: base: INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist + # Can't use the TestTarget template here because it includes Fixtures, but those should be excluded + # here and included in BitwardenKitMocks instead. sources: - path: BitwardenKit includes: @@ -199,6 +174,8 @@ targets: settings: base: INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist + # Can't use the SnapshotTestTarget template here because it includes Fixtures, but those should be excluded + # here and included in BitwardenKitMocks instead. sources: - path: BitwardenKit includes: @@ -217,6 +194,8 @@ targets: settings: base: INFOPLIST_FILE: BitwardenKit/Application/TestHelpers/Support/Info.plist + # Can't use the ViewInspectorTestTarget template here because it includes Fixtures, but those should be excluded + # here and included in BitwardenKitMocks instead. sources: - path: BitwardenKit includes: diff --git a/project-common.yml b/project-common.yml index ed4239ed75..085a4aa9b1 100644 --- a/project-common.yml +++ b/project-common.yml @@ -25,3 +25,66 @@ 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 snapshot test targets. + SnapshotTestTarget: + sources: + - path: ${sourcesPath} + includes: + - "**/*SnapshotTests.*" + - "**/Fixtures/*" + - "**/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.*" + - "**/Fixtures/*" + - "**/TestHelpers/*" + # Adds common include/excludes for ViewInspector test targets. + ViewInspectorTestTarget: + sources: + - path: ${sourcesPath} + includes: + - "**/*ViewInspectorTests.*" + - "**/Fixtures/*" + - "**/TestHelpers/*" diff --git a/project-pm.yml b/project-pm.yml index e86b457061..71e392645c 100644 --- a/project-pm.yml +++ b/project-pm.yml @@ -151,19 +151,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 @@ -215,11 +207,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 @@ -238,11 +230,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: - target: BitwardenShared BitwardenActionExtensionTests: @@ -251,11 +242,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 @@ -273,11 +264,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: - target: BitwardenShared BitwardenAutoFillExtensionTests: @@ -286,11 +276,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 @@ -308,11 +298,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: - target: BitwardenShared BitwardenShareExtensionTests: @@ -321,11 +310,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 @@ -348,24 +337,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 @@ -382,15 +362,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 BitwardenSharedTests: type: bundle.unit-test platform: iOS @@ -402,18 +373,12 @@ 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/*" - - "**/Fixtures/*" - excludes: - - "**/*SnapshotTests.*" - - "**/*ViewInspectorTests.*" - path: GlobalTestHelpers - - path: BitwardenShared/Sourcery/Generated - optional: true - path: BitwardenShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: @@ -436,15 +401,12 @@ 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/*" - - "**/Fixtures/*" - path: GlobalTestHelpers - - path: BitwardenShared/Sourcery/Generated - optional: true - path: BitwardenShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: @@ -467,15 +429,12 @@ 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/*" - - "**/Fixtures/*" - path: GlobalTestHelpers - - path: BitwardenShared/Sourcery/Generated - optional: true - path: BitwardenShared/Sourcery/Generated/AutoMockable.generated.swift optional: true dependencies: