Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Sync with upstream (#46)
Browse files Browse the repository at this point in the history
* Fix broken external BuildLabel filename parsing (#257)

External BuildLabels were keeping their // halfway through their path, leading to projects xcode would refuse to load.

As an example: @google_toolbox_for_mac//Foundation:BUILD was going to external//Foundation/BUILD, not external/Foundation/BUILD.
This lead the pbjproj to assign the file the path //Foundation/BUILD, which Xcode refuses to load, along with groups named '/' and the omission of other associated source files.

* Add support for ios_sim_arm64 CPU type

* Point External Paths into Stable External Directory instead of Unstable Execroot (#255)

* Fix breaking of external workspaces after builds

Previously, paths to files in external workspaces went through execroot.
Execroot is reconfigured on every rebuild to contain only the external
workspaces (and top-level packages) required by that build. Therefore,
executing a build that used a subset of the project's external
workspaces broke the file references and include paths for the other
external workspaces. Bad times.

This commit points to external workspaces through the stable external
subdirectory of output_base instead of the unstable external subdir
of execroot. This requires a new tulsi symlink for output base; Xcode
doesn't properly resolve ../ paths through symlinks for file references.
Plus, we should probably try to move away from linking through a
temporary build sandbox anyway; it'll just keep leading to subtle bugs.

This should close bazelbuild/tulsi#164
This patches bazelbuild/tulsi#227 and
bazelbuild/tulsi#229.

This commit also contains a fix for an (I think unreported) bug I
noticed while editing ProjectPatcher. In trying to fix paths for files
not on disk, it was unintentionally setting their paths to (an
incorrect) path that was group relative, but meant to be project
relative. It also created inconsistent state in the PBGroup hierarchy.
Since this fixes the paths for generated Info.plists in most projects,
it leads to many of the file ref path changes in the tests. The code
now does what the author clearly intended, and I've added some defence
against future issues into PBXObjects.

* Make execroot symlink's names reflect what it is

tulsi-workspace -> tulsi-execution-root
TULSI_BWRS -> TULSI_EXECUTION_ROOT

* Re-add legacy names for execroot build setting and symlink for backwards compatibility

Fixes bazelbuild/tulsi#164.

* Add `generates_header = True` to `swift_library` targets used by Tulsi's E2E tests.

PiperOrigin-RevId: 367058875
(cherry picked from commit debe5ac)

* Add a setting to the Tulsi-generated lldbinit to explicitly enable implicit module maps. LLDB will transitively include an option that disables implicit module maps when importing a Swift module that depends on an Objective-C library that was built with explicit modules. Depending on the build graph, this can mean LLDB's clang module importer can fail to find the required module maps and provide no debug info.

PiperOrigin-RevId: 371927956
(cherry picked from commit dbb0fc4)

* Updates version number to 0.4.372144887.20210505.

PiperOrigin-RevId: 372147605
(cherry picked from commit 5ef399c)

* Internal Change

PiperOrigin-RevId: 373199701
(cherry picked from commit 9939243)

* Only show one amibigous rule warning per build label.

PiperOrigin-RevId: 374475916
(cherry picked from commit ee965f2)

* Updates version number to 0.4.374474001.20210518.

PiperOrigin-RevId: 374489201
(cherry picked from commit 21cc1c8)

* Change 1/3 to add a new tool that handles pruning the LLDB module cache of any modules that are found in a metadata file that is intended to be created by a bazel aspect that collects explicit module build outputs. This tool is needed to avoid a crash with LLDB that occurs when the LLDB module cache contains a module that is also generated in a build as an explicit module.

This chnage handles reading metadata files that a bazel aspect will write to come up with a list of names of all explicit modules that will have been created from a build.

PiperOrigin-RevId: 378248354
(cherry picked from commit 078e311)

* Change 2/3 to add a new tool that handles pruning the LLDB module cache of any modules that are found in a metadata file that is intended to be created by a bazel aspect that collects explicit module build outputs. This tool is needed to avoid a crash with LLDB that occurs when the LLDB module cache contains a module that is also generated in a build as an explicit module.

This change handles reading the contents of the implicit module cache and map the name of each module to the absolute path of that module.

PiperOrigin-RevId: 378402314
(cherry picked from commit a03f6ef)

* Change 3/3 to add a new tool that handles pruning the LLDB module cache of any modules that are found in a metadata file that is intended to be created by a bazel aspect that collects explicit module build outputs. This tool is needed to avoid a crash with LLDB that occurs when the LLDB module cache contains a module that is also generated in a build as an explicit module.

To summarize how this works:
 - Read the contents of the implicit module cache and map the name of each module to the absolute path of that module.
 - Read metadata files that a bazel aspect will write to come up with a list of names of all explicit modules created from a build.
 - Iterate through the list of explicit module names and delete any module with the same name from the implicit module cache.
 - Compute a hash of the list of explicit module names that were used to prune the implicit module cache.
 - Save that hash to a special sentinel file in the implicit module cache.
 - Compare the hash of subsequent builds to the one in the file to determine if subsequent builds should prune the implicit module cache.

PiperOrigin-RevId: 378666180
(cherry picked from commit 55b6a92)

* Disable legacy build system error in Xcode 13

Disable this as it can annoy users; we're working on new build system support.

PiperOrigin-RevId: 378916679
(cherry picked from commit 3f25dd7)

* Removing this ios_static_framework target that isn't covered by any tests.

Tulsi doesn't allow list ios_static_framework rules, so the e2e test appears to ignore this target.

PiperOrigin-RevId: 378933587
(cherry picked from commit 31da848)

* Revert "Point External Paths into Stable External Directory instead of Unstable Execroot (#255)"

This reverts commit c7609aa.

* Prevent a crash in lldb-rpc-server that can occur after migrating a rule in the build graph to use Swift explicit modules.
  - Updates the Tulsi outputs aspect to output the Swift explicit modules generated from a build.
  - Bundles the module cache pruning tool with the Tulsi app bundle and installs it to the same location as the bazel_cache_reader.
  - Runs the module cache pruning tool after each Tulsi build, providing the output from the aspect, to prevent lldb from loading the outdated implicit module.

PiperOrigin-RevId: 378936605
(cherry picked from commit 98d6f25)

* Updates version number to 0.4.374498161.20210614.

Significant changes:
- Fixed a crash with lldb-rpc-server that can occur after
  migrating a rule to use Swift explicit modules.

PiperOrigin-RevId: 379284179
(cherry picked from commit e4fcc3c)

* Add @discardableResult to pruneModuleCache function so we can avoid needing to explicitly drop the return value when not using it.

PiperOrigin-RevId: 382075141
(cherry picked from commit 552b356)

* Move entitlements handling into the rule implementations.

This allows us to remove the special internal entitlements rule and convert nearly all of the existing macro-wrapped rules into pure rules, with the exception of some macOS rules which still have some straggling items to migrate.

PiperOrigin-RevId: 382347912
(cherry picked from commit 286d21b)

* Move usage of bazel_cache_reader behind a Tulsi option and leave it disabled by default. bazel_cache_reader has been observed to result in significant hits to symbolication in some cases.

PiperOrigin-RevId: 382537207
(cherry picked from commit 6fe2926)

* Skip over unsupported test targets in test_suites

PiperOrigin-RevId: 382571317
(cherry picked from commit d3e3536)

* Updates version number to 0.4.384524523.20210713.

Significant changes:
- Unsupported tests in test_suites are now skipped instead of
  throwing an error.
- Disable fallback dSYM searching by default. The fallback can be
  reenabled with the "Enable fallback dSYM searches" option.
  Reenabling is only recommended if Spotlight is disabled as it
  can impact time to symbolicate a binary.
- Fixed a crash with lldb-rpc-server that can occur after
  migrating a rule to use Swift explicit modules.

PiperOrigin-RevId: 384527057
(cherry picked from commit 7440ba0)

* Automatic code cleanup.

PiperOrigin-RevId: 386871254
(cherry picked from commit febfc91)

* Improve failure messages when goldens are outdated

Show the entire diff at once instead of line-by-line

PiperOrigin-RevId: 389889488
(cherry picked from commit d16d184)

* Improve performance of fetching build/bzl files for a project

```
buildfiles(deps($T1)+deps($T2)+deps($T3)+[...])
```

is equivalent to, but generally much slower than

```
buildfiles(deps($T1+$T2+$T3+[...]))
```

PiperOrigin-RevId: 389912462
(cherry picked from commit a5ef86e)

* Swap to build and test with Xcode 12.5.1

Also fix an issue with the OSS tests.

PiperOrigin-RevId: 390164332
(cherry picked from commit d1a4d3c)

#  Conflicts:
# 	.bazelci/presubmit.yml
# 	.bazelrc
# 	WORKSPACE

* Updates version number to 0.4.391542404.20210818.

Significant changes:
- Improved performance when querying for BUILD/bzl files

PiperOrigin-RevId: 391546363
(cherry picked from commit 53d31b0)

* Slight tweaks to build flags used for project generation

- Use the newer `--run_validations` flag
- Disable the `dsyms` output group that some folks might manually enable by accident

PiperOrigin-RevId: 393791135
(cherry picked from commit 043040df1bc175b5f71d7af80877af0fa98e28f1)

* Updates version number to 0.4.396915249.20210915.

PiperOrigin-RevId: 396918740
(cherry picked from commit f151befb3900ae1f122fdf5a4dc2b0870dffd95c)

* Update iOS sim device to use for E2E tests

Updated to be in sync with our current Xcode target of Xcode 12.5.1

PiperOrigin-RevId: 399783838
(cherry picked from commit a3dec4cc165ca4044215f523bac06b1bf7623861)

* Update Tulsi to Xcode 13.0.

PiperOrigin-RevId: 404053261
(cherry picked from commit 4fd4d4caa99220b55fb592488bddc89c73b86d22)

* Automatic code cleanup.

PiperOrigin-RevId: 406138012
(cherry picked from commit 152959785010edc7cc99afde2bbb5e6a54f0a5bf)

* Fix some warnings in the Tulsi module

Also remove some sneaky semicolons.

PiperOrigin-RevId: 406397098
(cherry picked from commit fe0cc3c1f39cf9d66346dbba45f795900e1b9a73)

* Fix some warnings in TulsiGenerator + a xib

Just have some hashable warnings left now plus
2 xibs with clipping warnings.

PiperOrigin-RevId: 407392908
(cherry picked from commit ec25d2f8b4076d7bfeb17ae1b5a925e3dc512aa1)

* Updates version number to 0.4.408971104.20211110.

PiperOrigin-RevId: 408976515
(cherry picked from commit 619e87e1db4c72a59a37803978bd9eba06cea2db)

* Add GitHub Actions

* Use rules_apple and rules_swift at HEADs

* Update golden

* Revert "Revert "Point External Paths into Stable External Directory instead of Unstable Execroot (#255)""

This reverts commit c681436feee92d038b6cf87343771ffae667afc2.

* Point to master branch for the reusing workflow

* remove unused file

* use bazel 5.0.0rc1

* Fix tulsi tests after unknown commit.

PiperOrigin-RevId: 411826911
(cherry picked from commit 45060a05093fd8614680d298456b78ae2d381986)

* Fix signing of test runners with Xcode 13

Xcode 13 adds new frameworks which are injected into the test runner.
These must be resigned as well otherwise the app will fail to install
due to a certificate expired/revoked error.

PiperOrigin-RevId: 417654389
(cherry picked from commit 7ff52cd4f8482bac6db148be1c5dea3408a7dd80)

* Add UseLegacyBuildSystem option to swap between new/old build systems

The new build system isn't officially supported yet, so I've added
this flag in preparation for support although it's `true` (legacy)
by default.

This should supplement #277 although I haven't thoroughly tested the new build system support (especially on device + for tests) yet.

PiperOrigin-RevId: 417654737
(cherry picked from commit 2cbc9236818025b471689bd8a1810e6c0655a18a)

* Use `--noexperimental_run_validations` instead of `--norun_validations` to make Tulsi works with projects that are still using Bazel 4 (#297)

Note that building Tulsi itself still requires Bazel 5.0+.

* fix conflict merge

* reset makefile

Co-authored-by: Christopher Sauer <cpsauer@users.noreply.github.com>
Co-authored-by: Thi Doãn <t@thi.im>
Co-authored-by: Googler <noreply@google.com>
Co-authored-by: ivanhernandez <ivanhernandez@google.com>
Co-authored-by: davg <davg@google.com>
Co-authored-by: nglevin <nglevin@google.com>
  • Loading branch information
7 people committed Jan 5, 2022
1 parent bfae91a commit 84fbaf7
Show file tree
Hide file tree
Showing 35 changed files with 1,282 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.1
5.0.0rc3
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ src/build/
/bazel-*
binary/
binary/appcast.xml
.build/
.build/
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ macos_application(
name = "tulsi",
additional_contents = {
"//src/tools/bazel_cache_reader": "MacOS",
"//src/tools/module_cache_pruner": "MacOS",
},
app_icons = ["//src/Tulsi:Icon"],
bundle_id = "com.wendyliga.TulsiPlusPlus",
Expand Down
3 changes: 3 additions & 0 deletions Tulsi.tulsiproj/project.tulsiconf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"GenerateRunfiles" : {
"p" : "YES"
},
"ProjectGenerationUseRealFilePath" : {
"p" : "NO"
},
"TreeArtifactOutputs" : {
"p" : "NO"
}
Expand Down
10 changes: 6 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ http_archive(
# TODO: Remove with next rules_swift + rules_apple release
http_archive(
name = "build_bazel_rules_swift",
sha256 = "653e8756001616500b110fd156694de7899278bb7480aba22b2f156438a1d810",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.22.0/rules_swift.0.22.0.tar.gz",
sha256 = "fff70e28e9b28a4249fbfb413f860cb9b5df567fe20a1bc4017dd89e678dd9b5",
strip_prefix = "rules_swift-35ddf9f6e8c0fcd8bcb521e92dd4fd11c3f181b6",
url = "https://github.com/bazelbuild/rules_swift/archive/35ddf9f6e8c0fcd8bcb521e92dd4fd11c3f181b6.tar.gz",
)

http_archive(
name = "build_bazel_rules_apple",
sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.31.3/rules_apple.0.31.3.tar.gz",
sha256 = "2e6c88b66c671b4abb7cebc5d072804d6fc42bd18aa31586b060e2629aae7251",
strip_prefix = "rules_apple-0bba769a9aafe9bd3349b32a326e599553886e98",
url = "https://github.com/bazelbuild/rules_apple/archive/0bba769a9aafe9bd3349b32a326e599553886e98.tar.gz",
)

load(
Expand Down
6 changes: 3 additions & 3 deletions src/Tulsi/Base.lproj/BazelOpenSheetAccessoryView.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -17,7 +17,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="atU-NU-IiP">
<rect key="frame" x="18" y="19" width="241" height="18"/>
<rect key="frame" x="15" y="18" width="245" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Use as the default for other projects" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="ZsK-jX-81p">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Tulsi/MessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class MessageViewController: NSViewController, NSTableViewDelegate, NSUser
ValueTransformer.setValueTransformer(MessageTypeToImageValueTransformer(),
forName: NSValueTransformerName(rawValue: "MessageTypeToImageValueTransformer"))
super.loadView()
bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController, withKeyPath: "arrangedObjects.@count", options: nil)
bind(NSBindingName(rawValue: "messageCount"), to: messageArrayController!, withKeyPath: "arrangedObjects.@count", options: nil)
}

@IBAction func copy(_ sender: AnyObject?) {
Expand Down
2 changes: 1 addition & 1 deletion src/Tulsi/ProjectEditorConfigManagerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ final class ProjectEditorConfigManagerViewController: NSViewController {
forName: NSValueTransformerName(rawValue: "IsOneValueTransformer"))
super.loadView()
bind(NSBindingName(rawValue: "numSelectedConfigs"),
to: configArrayController,
to: configArrayController!,
withKeyPath: "selectedObjects.@count",
options: nil)
self.generateButton.keyEquivalent = "\r"
Expand Down
2 changes: 1 addition & 1 deletion src/Tulsi/ProjectEditorPackageManagerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class ProjectEditorPackageManagerViewController: NSViewController, NewProj
forName: NSValueTransformerName(rawValue: "PackagePathValueTransformer"))
super.loadView()
bind(NSBindingName(rawValue: "numSelectedPackagePaths"),
to: packageArrayController,
to: packageArrayController!,
withKeyPath: "selectedObjects.@count",
options: nil)
}
Expand Down
52 changes: 42 additions & 10 deletions src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ Filtering information for this target. Only for test target, otherwise is None.
)

TulsiOutputAspectInfo = provider(
doc = """Provides information about an Apple target's outputs.""",
fields = {
"transitive_explicit_modules": "Depset of all explicit modules built by this target.",
"transitive_generated_files": "Depset of tulsi generated files.",
"transitive_embedded_bundles": "Depset of all bundles embedded into this target.",
},
Expand Down Expand Up @@ -649,13 +651,31 @@ def _collect_swift_modules(target):
if module.swift
]

def _collect_module_maps(target):
"""Returns a list of Clang module maps found on the given target."""
return [
module.clang.module_map
for module in target[SwiftInfo].transitive_modules.to_list()
if module.clang and type(module.clang.module_map) == "File"
]
def _collect_clang_modules(target):
"""Returns a struct with lists of Clang pcms and module maps found on the given target."""
if not _is_swift_target(target):
return struct(module_maps = [], precompiled_modules = [])

module_maps = []
precompiled_modules = []

for module in target[SwiftInfo].transitive_modules.to_list():
if module.clang == None:
continue

# Collect precompiled modules
if module.clang.precompiled_module:
precompiled_module = struct(
module = module.clang.precompiled_module,
name = module.name,
)
precompiled_modules.append(precompiled_module)

# Collect module maps
if type(module.clang.module_map) == "File":
module_maps.append(module.clang.module_map)

return struct(module_maps = module_maps, precompiled_modules = precompiled_modules)

def _collect_objc_strict_includes(target, rule_attr):
"""Returns a depset of strict includes found on the deps of given target."""
Expand Down Expand Up @@ -753,8 +773,9 @@ def _tulsi_sources_aspect(target, ctx):
is_swift_target = _is_swift_target(target)

if is_swift_target:
clang_modules = _collect_clang_modules(target)
swift_transitive_modules = depset([_file_metadata(f) for f in _collect_swift_modules(target)])
objc_module_maps = depset([_file_metadata(f) for f in _collect_module_maps(target)])
objc_module_maps = depset([_file_metadata(f) for f in clang_modules.module_maps])
else:
swift_transitive_modules = depset()
objc_module_maps = depset()
Expand Down Expand Up @@ -1092,12 +1113,16 @@ def _tulsi_outputs_aspect(target, ctx):
# A list of bundle infos corresponding to the dependencies of this target.
direct_embedded_bundles = []

# A list of all explicit modules that have been built from this targets dependencies.
transitive_explicit_modules = []

for attr_name in _TULSI_COMPILE_DEPS:
deps = _collect_dependencies(rule_attr, attr_name)
for dep in deps:
if TulsiOutputAspectInfo in dep:
transitive_generated_files.append(dep[TulsiOutputAspectInfo].transitive_generated_files)
transitive_embedded_bundles.append(dep[TulsiOutputAspectInfo].transitive_embedded_bundles)
transitive_explicit_modules.append(dep[TulsiOutputAspectInfo].transitive_explicit_modules)

# Retrieve the bundle info for embeddable attributes.
if attr_name not in _TULSI_NON_EMBEDDEDABLE_ATTRS:
Expand Down Expand Up @@ -1162,10 +1187,11 @@ def _tulsi_outputs_aspect(target, ctx):
if cc_info:
all_files_depsets.append(cc_info.compilation_context.headers)

clang_modules = _collect_clang_modules(target)
if _is_swift_target(target):
all_files_depsets.append(_collect_swift_header(target))
all_files_depsets.append(depset(_collect_swift_modules(target)))
all_files_depsets.append(depset(_collect_module_maps(target)))
all_files_depsets.append(depset(clang_modules.module_maps))

source_files = [
x
Expand All @@ -1187,6 +1213,11 @@ def _tulsi_outputs_aspect(target, ctx):
transitive = transitive_generated_files,
)

explicit_modules = depset([
struct(name = m.name, path = m.module.path)
for m in clang_modules.precompiled_modules
], transitive = transitive_explicit_modules)

has_dsym = _has_dsym(target)

info = _struct_omitting_none(
Expand All @@ -1197,6 +1228,7 @@ def _tulsi_outputs_aspect(target, ctx):
bundle_name = bundle_name,
embedded_bundles = embedded_bundles.to_list(),
has_dsym = has_dsym,
explicit_modules = explicit_modules.to_list(),
)

output = ctx.actions.declare_file(target.label.name + ".tulsiouts")
Expand All @@ -1205,6 +1237,7 @@ def _tulsi_outputs_aspect(target, ctx):
return [
OutputGroupInfo(tulsi_outputs = [output]),
TulsiOutputAspectInfo(
transitive_explicit_modules = explicit_modules,
transitive_generated_files = generated_files,
transitive_embedded_bundles = embedded_bundles,
),
Expand All @@ -1222,7 +1255,6 @@ tulsi_sources_aspect = aspect(
)),
},
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
incompatible_use_toolchain_transition = True,
fragments = [
"apple",
"cpp",
Expand Down
8 changes: 6 additions & 2 deletions src/TulsiGenerator/BazelAspectInfoExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,16 @@ final class BazelAspectInfoExtractor: QueuedLogging {
"--features=-parse_headers",
// Don't run validation actions during project generation; validation actions could
// slow down the project generation or fail it.
"--experimental_run_validations=0",
// TODO: Switch to --norun_validations when we no longer need to support Bazel 4.
"--noexperimental_run_validations",
// The following flags WILL affect Bazel analysis caching.
// Keep this consistent with bazel_build.py.
"--aspects",
"@tulsi//:tulsi/tulsi_aspects.bzl%\(aspect)",
"--output_groups=tulsi_info,-_,-default", // Build only the aspect artifacts.
// Build only the aspect artifacts. We explicitly disable the
// rules_apple `dsyms` output group since it may trigger a full build
// and we've seen some folks enabling it in their rc file.
"--output_groups=tulsi_info,-dsyms",
])
arguments.append(contentsOf: targets)

Expand Down
5 changes: 2 additions & 3 deletions src/TulsiGenerator/BazelQueryInfoExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ final class BazelQueryInfoExtractor: QueuedLogging {
let profilingStart = localizedMessageLogger.startProfiling("extracting_skylark_files",
message: "Finding Skylark files for \(targets.count) rules")

let labelDeps = targets.map {"deps(\($0.value))"}
let joinedLabelDeps = labelDeps.joined(separator: "+")
let query = "buildfiles(\(joinedLabelDeps))"
let joinedLabels = targets.map { $0.value }.joined(separator: " + ")
let query = "buildfiles(deps(\(joinedLabels)))"
let buildFiles: Set<BuildLabel>
do {
// Errors in the BUILD structure being examined should not prevent partial extraction, so this
Expand Down
6 changes: 3 additions & 3 deletions src/TulsiGenerator/PBXObjects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class PBXReference: PBXObjectProtocol {
fileprivate weak var _parent: PBXReference?

init(name: String, path: String?, sourceTree: SourceTree, parent: PBXReference? = nil) {
self.name = name;
self.name = name
self.path = path
self.sourceTree = sourceTree
self._parent = parent
Expand Down Expand Up @@ -1330,8 +1330,8 @@ final class PBXProject: PBXObjectProtocol {
try serializer.addField("attributes", attributes)
try serializer.addField("buildConfigurationList", buildConfigurationList)
try serializer.addField("compatibilityVersion", compatibilityVersion)
try serializer.addField("mainGroup", mainGroup);
try serializer.addField("targets", targetByName.values.sorted(by: {$0.name < $1.name}));
try serializer.addField("mainGroup", mainGroup)
try serializer.addField("targets", targetByName.values.sorted(by: {$0.name < $1.name}))

// Hardcoded defaults to match Xcode behavior.
try serializer.addField("developmentRegion", "English")
Expand Down
12 changes: 8 additions & 4 deletions src/TulsiGenerator/RuleEntryMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Foundation
public class RuleEntryMap {
private var labelToEntries = [BuildLabel: [RuleEntry]]()
private var allEntries = [RuleEntry]()
private var labelsWithWarning = Set<BuildLabel>()

private let localizedMessageLogger: LocalizedMessageLogger?

Expand Down Expand Up @@ -97,10 +98,13 @@ public class RuleEntryMap {
}
}

// Must be multiple. Shoot out a warning and return the last.
localizedMessageLogger?.warning("AmbiguousRuleEntryReference",
comment: "Warning when unable to resolve a RuleEntry for a given DeploymentTarget. RuleEntry's label is in %1$@.",
values: buildLabel.description)
if labelsWithWarning.insert(buildLabel).inserted {
// Must be multiple. Shoot out a warning and return the last.
localizedMessageLogger?.warning("AmbiguousRuleEntryReference",
comment: "Warning when unable to resolve a RuleEntry for a given DeploymentTarget. RuleEntry's label is in %1$@.",
values: buildLabel.description)
}

return ruleEntries.last
}
}
Loading

0 comments on commit 84fbaf7

Please sign in to comment.