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

Sync with upstream #46

Merged
merged 50 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
00a73c9
Fix broken external BuildLabel filename parsing (#257)
cpsauer Sep 10, 2021
63bab0d
Add support for ios_sim_arm64 CPU type
thii Sep 29, 2021
c7609aa
Point External Paths into Stable External Directory instead of Unstab…
cpsauer Oct 14, 2021
88bb140
Add `generates_header = True` to `swift_library` targets used by Tuls…
a-googler Apr 6, 2021
81c650c
Add a setting to the Tulsi-generated lldbinit to explicitly enable im…
ivanhernandez13 May 4, 2021
bc7e6c9
Updates version number to 0.4.372144887.20210505.
ivanhernandez13 May 5, 2021
50cef26
Internal Change
a-googler May 11, 2021
bf9aeba
Only show one amibigous rule warning per build label.
ivanhernandez13 May 18, 2021
a69355d
Updates version number to 0.4.374474001.20210518.
ivanhernandez13 May 18, 2021
ef064f5
Change 1/3 to add a new tool that handles pruning the LLDB module cac…
ivanhernandez13 Jun 8, 2021
ee758c3
Change 2/3 to add a new tool that handles pruning the LLDB module cac…
ivanhernandez13 Jun 9, 2021
5d43e09
Change 3/3 to add a new tool that handles pruning the LLDB module cac…
ivanhernandez13 Jun 10, 2021
a21f4fe
Disable legacy build system error in Xcode 13
DavidGoldman Jun 11, 2021
3608a9f
Removing this ios_static_framework target that isn't covered by any t…
nglevin Jun 11, 2021
f03c721
Revert "Point External Paths into Stable External Directory instead o…
thii Oct 22, 2021
ea2d59e
Prevent a crash in lldb-rpc-server that can occur after migrating a r…
ivanhernandez13 Jun 11, 2021
fb42ee4
Updates version number to 0.4.374498161.20210614.
ivanhernandez13 Jun 14, 2021
547c972
Add @discardableResult to pruneModuleCache function so we can avoid n…
ivanhernandez13 Jun 29, 2021
f77310d
Move entitlements handling into the rule implementations.
a-googler Jun 30, 2021
72346f3
Move usage of bazel_cache_reader behind a Tulsi option and leave it d…
ivanhernandez13 Jul 1, 2021
44d0200
Skip over unsupported test targets in test_suites
DavidGoldman Jul 1, 2021
c9ffd24
Updates version number to 0.4.384524523.20210713.
ivanhernandez13 Jul 13, 2021
96b352e
Automatic code cleanup.
a-googler Jul 26, 2021
8ff249a
Improve failure messages when goldens are outdated
DavidGoldman Aug 10, 2021
e65f985
Improve performance of fetching build/bzl files for a project
DavidGoldman Aug 10, 2021
2bb4432
Swap to build and test with Xcode 12.5.1
DavidGoldman Aug 11, 2021
2eb1def
Updates version number to 0.4.391542404.20210818.
DavidGoldman Aug 18, 2021
d88dacc
Slight tweaks to build flags used for project generation
DavidGoldman Aug 30, 2021
498a680
Updates version number to 0.4.396915249.20210915.
DavidGoldman Sep 15, 2021
dcaf13d
Update iOS sim device to use for E2E tests
DavidGoldman Sep 29, 2021
739fdcb
Update Tulsi to Xcode 13.0.
ivanhernandez13 Oct 18, 2021
fe2721c
Automatic code cleanup.
a-googler Oct 28, 2021
afd7ee9
Fix some warnings in the Tulsi module
DavidGoldman Oct 29, 2021
9c7b6eb
Fix some warnings in TulsiGenerator + a xib
DavidGoldman Nov 3, 2021
179d062
Updates version number to 0.4.408971104.20211110.
DavidGoldman Nov 10, 2021
d736378
Add GitHub Actions
thii Dec 13, 2021
9ffda6c
Use rules_apple and rules_swift at HEADs
thii Dec 18, 2021
e6b3292
Update golden
thii Dec 18, 2021
697ad1a
Revert "Revert "Point External Paths into Stable External Directory i…
thii Dec 18, 2021
703eb7b
Point to master branch for the reusing workflow
thii Dec 21, 2021
0c791e3
Merge remote-tracking branch 'upstream/master' into upstream
wendyliga Dec 21, 2021
662867a
remove unused file
wendyliga Dec 21, 2021
ab32fb8
use bazel 5.0.0rc1
wendyliga Dec 21, 2021
7caf69b
Fix tulsi tests after unknown commit.
a-googler Nov 23, 2021
068aaaa
Fix signing of test runners with Xcode 13
DavidGoldman Dec 21, 2021
27981b2
Add UseLegacyBuildSystem option to swap between new/old build systems
DavidGoldman Dec 21, 2021
3dd2bed
Use `--noexperimental_run_validations` instead of `--norun_validation…
thii Dec 29, 2021
4618326
Merge branch 'master_upstream' into sync_with_upstream
wendyliga Jan 5, 2022
2c4eaf2
fix conflict merge
wendyliga Jan 5, 2022
9ee9ae1
reset makefile
wendyliga Jan 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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