Added an integration test for a build file with at least two extension-host pairs.
PiperOrigin-RevId: 205274737
diff --git a/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift b/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
index 1746435..2db99de 100644
--- a/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
+++ b/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
@@ -83,6 +83,39 @@
validateDiff(diffLines)
}
+ func test_MultiExtensionProject() throws {
+ let testDir = "tulsi_e2e_multi_extension"
+ installBUILDFile("MultiExtension", intoSubdirectory: testDir)
+
+ let appLabelOne = BuildLabel("//\(testDir):ApplicationOne")
+ let appLabelTwo = BuildLabel("//\(testDir):ApplicationTwo")
+ let buildTargets = [RuleInfo(label: appLabelOne,
+ type: "ios_application",
+ linkedTargetLabels: []),
+ RuleInfo(label: appLabelTwo,
+ type: "ios_application",
+ linkedTargetLabels: [])]
+ let additionalFilePaths = ["\(testDir)/BUILD"]
+
+ makePlistFileNamed("Plist1.plist",
+ withContent: ["NSExtension": ["NSExtensionPointIdentifier": "com.apple.extension-foo"],
+ "CFBundleVersion": "1.0",
+ "CFBundleShortVersionString": "1.0"],
+ inSubdirectory: "\(testDir)/TodayExtension")
+
+ let projectName = "MultiExtensionProject"
+ let projectURL = try generateProjectNamed(projectName,
+ buildTargets: buildTargets,
+ pathFilters: ["\(testDir)/...",
+ "bazel-bin/...",
+ "bazel-genfiles/..."],
+ additionalFilePaths: additionalFilePaths,
+ outputDir: "tulsi_e2e_output")
+
+ let diffLines = diffProjectAt(projectURL, againstGoldenProject: projectName)
+ validateDiff(diffLines)
+ }
+
func test_BrokenSourceBUILD() {
let aspectLogExpectation = expectation(description:
"Should see a statement that Bazel aspect info is being printed to our logs."
diff --git a/src/TulsiGeneratorIntegrationTests/Resources/MultiExtension.BUILD b/src/TulsiGeneratorIntegrationTests/Resources/MultiExtension.BUILD
new file mode 100644
index 0000000..45a9a17
--- /dev/null
+++ b/src/TulsiGeneratorIntegrationTests/Resources/MultiExtension.BUILD
@@ -0,0 +1,66 @@
+# Copyright 2016 The Tulsi Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# mock BUILD file with an extension referenced by multiple bundles to test that a scheme is
+# generated for every host-extension pair.
+
+load(
+ "@build_bazel_rules_apple//apple:ios.bzl",
+ "apple_product_type",
+ "ios_application",
+ "ios_extension",
+)
+
+ios_application(
+ name = "ApplicationOne",
+ bundle_id = "example.iosapp",
+ entitlements = "Application/entitlements.entitlements",
+ extensions = [
+ ":TodayExtension",
+ ],
+ families = [
+ "iphone",
+ "ipad",
+ ],
+ infoplists = ["Application/Info.plist"],
+ minimum_os_version = "8.0",
+)
+
+ios_application(
+ name = "ApplicationTwo",
+ bundle_id = "example.iosapp",
+ entitlements = "Application/entitlements.entitlements",
+ extensions = [
+ ":TodayExtension",
+ ],
+ families = [
+ "iphone",
+ "ipad",
+ ],
+ infoplists = ["Application/Info.plist"],
+ minimum_os_version = "8.0",
+)
+
+ios_extension(
+ name = "TodayExtension",
+ bundle_id = "example.iosapp.todayextension",
+ families = [
+ "iphone",
+ "ipad",
+ ],
+ infoplists = [
+ "TodayExtension/Plist1.plist",
+ ],
+ minimum_os_version = "8.0",
+)