Update README and fix broken tests
- Update to rules_apple 0.18.0 (latest)
- Fix AspectTests for rules_apple test changes
PiperOrigin-RevId: 267213881
diff --git a/README.md b/README.md
index 7f97647..38f7033 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,13 @@
## Building and installing
+1. Check `.bazelrc` to see if the Xcode version used by Tulsi is installed
+ locally. If it isn't, feel free to remove the `--xcode_version` flag or
+ modify it as you wish, but note that Tulsi may not build correctly with
+ different versions of Xcode.
1. Run `build_and_run.sh`. This will install Tulsi.app inside ~/Applications.
+
## Notes
Tulsi-generated Xcode projects use Bazel to build, **not** Xcode via xcbuild. This means
diff --git a/WORKSPACE b/WORKSPACE
index 1218dc4..1691b27 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
- tag = "0.17.2",
+ tag = "0.18.0",
)
load(
diff --git a/src/TulsiGeneratorIntegrationTests/AspectTests.swift b/src/TulsiGeneratorIntegrationTests/AspectTests.swift
index 2c1e962..27d36fb 100644
--- a/src/TulsiGeneratorIntegrationTests/AspectTests.swift
+++ b/src/TulsiGeneratorIntegrationTests/AspectTests.swift
@@ -112,15 +112,9 @@
checker.assertThat("//tulsi_test:XCTest")
.hasTestHost("//tulsi_test:Application")
- .dependsOn("//tulsi_test:XCTest.__internal__.__test_bundle")
-
- // TODO(b/139478940): Replace this dependency on the naming convention for an implementation
- // detail of rules_apple with the solution arrived at from the referenced bug.
- checker.assertThat("//tulsi_test:XCTest.__internal__.__test_bundle")
- .hasTestHost("//tulsi_test:Application")
.hasDeploymentTarget(DeploymentTarget(platform: .ios, osVersion: "10.0"))
- .dependsOn("//tulsi_test:Application")
- .dependsOn("//tulsi_test:TestLibrary")
+ .dependsTransitivelyOn("//tulsi_test:Application")
+ .dependsTransitivelyOn("//tulsi_test:TestLibrary")
}
func testExceptionThrown() {
@@ -336,16 +330,10 @@
checker.assertThat("//tulsi_test:XCTest")
.hasTestHost("//tulsi_test:Application")
- .dependsOn("//tulsi_test:XCTest.__internal__.__test_bundle")
-
- // TODO(b/139478940): Replace this dependency on the naming convention for an implementation
- // detail of rules_apple with the solution arrived at from the referenced bug.
- checker.assertThat("//tulsi_test:XCTest.__internal__.__test_bundle")
- .hasTestHost("//tulsi_test:Application")
.hasDeploymentTarget(DeploymentTarget(platform: .ios, osVersion: "10.0"))
- .dependsOn("//tulsi_test:Application")
- .dependsOn("//tulsi_test:Library")
- .dependsOn("//tulsi_test:TestLibrary")
+ .dependsTransitivelyOn("//tulsi_test:Application")
+ .dependsTransitivelyOn("//tulsi_test:Library")
+ .dependsTransitivelyOn("//tulsi_test:TestLibrary")
checker.assertThat("//tulsi_test:ApplicationLibrary")
.dependsOn("//tulsi_test:CoreDataResources")
@@ -576,6 +564,25 @@
return self
}
+ /// Asserts that the contextual RuleEntry is linked to a rule identified by the given
+ /// targetLabel as a transitive dependency.
+ @discardableResult
+ func dependsTransitivelyOn(_ targetLabel: String, line: UInt = #line) -> Context {
+ guard let ruleEntry = ruleEntry else { return self }
+ let label = BuildLabel(targetLabel)
+ var ruleEntries = [ruleEntry]
+ while true {
+ guard let entry = ruleEntries.popLast() else { break }
+ guard !entry.dependencies.contains(label) else { return self }
+
+ ruleEntries.append(contentsOf: entry.dependencies.compactMap {
+ ruleEntryMap.ruleEntry(buildLabel: $0, depender: entry)
+ })
+ }
+ XCTFail("\(ruleEntry) must transitively depend on \(targetLabel)", line: line)
+ return self
+ }
+
/// Asserts that the contextual RuleEntry contains the given list of sources (but may have
/// others as well).
@discardableResult