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

Sync upstream #75

Merged
merged 83 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 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
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
d3c7c71
Update Tulsi python 2.7 scripts to python 3. This will silence the wa…
ivanhernandez13 Jan 5, 2022
c677e4f
Increase timeout of //src/TulsiGeneratorIntegrationTests:EndToEndGene…
thii Jan 6, 2022
0236b16
Updates version number to 0.4.419907671.20220105.
ivanhernandez13 Jan 5, 2022
4eb4edc
minor README updates (#298)
skofgar Jan 6, 2022
89b2e96
Add minimum bazel version check (#302)
keith Jan 22, 2022
907dde2
Update rules_apple (#281)
keith Jan 23, 2022
a23f0a7
Switch back to building with latest Bazel (#306)
thii Feb 18, 2022
5662dfa
Move the attributes for which Tulsi will search for dependencies into…
ivanhernandez13 Jan 6, 2022
6432208
Add the ability to specify extra build flags via the CLI during proje…
DavidGoldman Jan 28, 2022
b591ddb
Fetch E2E build flags from the BazelIntegrationTestCase
DavidGoldman Feb 1, 2022
a148834
Update to build with Xcode 13.2.1
DavidGoldman Feb 2, 2022
f17f58e
Update GitHub Actions' `xcode_version` config to 13.2.1
thii Feb 21, 2022
1c768c8
Fix minor warning in TulsiGenerator
DavidGoldman Feb 3, 2022
fe55135
Updates version number to 0.4.427587075.20220209.
DavidGoldman Feb 10, 2022
e9b40a0
Do not override user-defined output groups
thii Mar 2, 2022
18d0ca9
Add swiftsourceinfo/swiftdoc to list of copied includes (#317)
erikkerber Mar 11, 2022
e241b42
Use an unreleased revision of rules_apple for now (#319)
thii Mar 15, 2022
2b8fbf5
Add support for stub binaries
DavidGoldman Feb 11, 2022
955d42b
Always build Tulsi with WMO for now
thii Mar 20, 2022
2f206d7
Change size of AspectTests
thii Mar 23, 2022
97f645b
Update dependencies
keith Mar 23, 2022
1bb2f18
Add CODEOWNERS
keith Apr 29, 2022
b0c0bf7
Fix CODEOWNERS format
keith May 3, 2022
26fa79d
Update rules_apple
keith May 2, 2022
ebe65c4
Added "ios_dynamic_framework" in filteredFileTypes
ivoleko May 22, 2022
e69bbfb
wip[
wendyliga Apr 21, 2022
791c784
fix typo
wendyliga Apr 21, 2022
b8906ec
Update rules_apple
keith Jun 17, 2022
a93a265
Remove RULES_SWIFT_BUILD_DUMMY_WORKER
keith May 24, 2022
8f0ebdf
Use rolling release for `macos_latest_head_deps`
thii Jul 25, 2022
d8f05bc
Add support for resigning UI tests with the new build system
DavidGoldman Feb 11, 2022
5f6e382
Added announcement banner class for announcing things to Tulsi users
a-googler Feb 16, 2022
3e6c282
Added announcement message to CLI output
a-googler Feb 22, 2022
be38baf
Updates version number to 0.4.433764481.20220310.
DavidGoldman Mar 10, 2022
518f18d
Change default Tulsi location to $HOME/Applications in generate_xcode…
kkpattern Jul 29, 2022
cef8cee
Collect framework paths from xcframework imports (#351)
thii Aug 3, 2022
e91ee77
Add `testonly = True` to `swift_library` targets in tests (#355)
thii Aug 4, 2022
b4c82ea
Add document for integrating Tulsi into project (#354)
kkpattern Aug 4, 2022
bb302ff
Merge remote-tracking branch 'upstream/master' into sync_upstream
wendyliga Sep 13, 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
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
macos_latest:
name: macos_latest
uses: bazelbuild/tulsi/.github/workflows/macos.yml@master
with:
bazel: latest
name: macos_latest
macos_last_green:
name: macos_last_green
uses: bazelbuild/tulsi/.github/workflows/macos.yml@master
with:
bazel: last_green
name: macos_last_green
macos_latest_head_deps:
name: macos_latest_head_deps
uses: bazelbuild/tulsi/.github/workflows/macos.yml@master
with:
bazel: rolling
name: macos_latest_head_deps
shell_commands: .bazelci/update_workspace_to_deps_heads.sh
50 changes: 50 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
workflow_call:
inputs:
name:
type: string
bazel:
type: string
default: latest
xcode_version:
type: string
default: "13.2.1"
build_targets:
type: string
default: //:tulsi
test_flags:
type: string
default: --nocheck_visibility --sandbox_writable_path=/Users/runner/Library/Application\ Support
test_targets:
type: string
default: //:tests
shell_commands:
type: string
default: ""

jobs:
macos:
runs-on: macos-11
env:
USE_BAZEL_VERSION: ${{ inputs.bazel }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install bazelisk
run: mv -f `which bazelisk` `which bazel`
- name: Shell commands
run: ${{ inputs.shell_commands }}
- name: Xcode select
run: sudo xcode-select -s /Applications/Xcode_${{ inputs.xcode_version }}.app/Contents/Developer
- name: Build
run: bazel build -- ${{ inputs.build_targets }}
- name: Test
run: bazel test ${{ inputs.test_flags }} --test_env=USE_BAZEL_VERSION -- ${{ inputs.test_targets }}
- name: Copy testlogs
run: rsync -rmL --include "*/" --include "test.log" --exclude "*" bazel-testlogs testlogs
if: failure()
- uses: actions/upload-artifact@v2
if: failure()
with:
name: testlogs-${{ inputs.name }}
path: testlogs/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ src/build/
binary/
binary/appcast.xml
.build/

# CI collected testlogs
/testlogs
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @BalestraPatrick @brentleyjones @keith @segiddins @thii
85 changes: 80 additions & 5 deletions src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ load(
"TULSI_COMPILE_DEPS",
"attrs_for_target_kind",
)
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")

ObjcInfo = apple_common.Objc
Expand Down Expand Up @@ -203,9 +204,11 @@ def _convert_outpath_to_symlink_path(path):

def _is_file_a_directory(f):
"""Returns True is the given file is a directory."""

# Starting Bazel 3.3.0, the File type as a is_directory attribute.
if getattr(f, "is_directory", None):
return f.is_directory

# If is_directory is not in the File type, fall back to the old method:
# As of Oct. 2016, Bazel disallows most files without extensions.
# As a temporary hack, Tulsi treats File instances pointing at extension-less
Expand Down Expand Up @@ -370,14 +373,32 @@ def _collect_framework_imports(rule_attr):
".framework",
)

def _collect_xcframework_imports(rule_attr):
"""Extracts xcframework directories from the given rule attributes."""
return _collect_bundle_paths(
def _collect_framework_imports_from_xcframework_imports(
rule_attr,
target_triplet):
"""Extracts framework directories from xcframework imports for the current target platform."""
all_framework_paths = _collect_bundle_paths(
rule_attr,
["xcframework_imports"],
".xcframework",
".framework",
)

framework_imports = []
for p in all_framework_paths:
path = p.path
library_identifier = paths.basename(paths.dirname(path))
if not library_identifier.startswith(target_triplet.os):
continue
if target_triplet.architecture not in library_identifier:
continue
if target_triplet.environment != "simulator" and library_identifier.endswith("-simulator"):
continue
if target_triplet.environment == "simulator" and not library_identifier.endswith("-simulator"):
continue
framework_imports.append(p)

return framework_imports

def _collect_xcdatamodeld_files(obj, attr_path):
"""Returns artifact_location's for xcdatamodeld's for attr_path in obj."""
files = _collect_files(obj, attr_path)
Expand Down Expand Up @@ -923,6 +944,14 @@ def _tulsi_sources_aspect(target, ctx):
test_deps = None
module_name = None

cc_toolchain = find_cpp_toolchain(ctx)
target_triplet = _get_apple_clang_triplet(cc_toolchain)
framework_imports = _collect_framework_imports(rule_attr) + \
_collect_framework_imports_from_xcframework_imports(
rule_attr,
target_triplet,
)

info = _struct_omitting_none(
artifacts = artifacts,
attr = _struct_omitting_none(**all_attributes),
Expand All @@ -935,7 +964,7 @@ def _tulsi_sources_aspect(target, ctx):
test_deps = test_deps,
extensions = extensions,
app_clips = app_clips,
framework_imports = _collect_framework_imports(rule_attr),
framework_imports = framework_imports,
generated_files = generated_files,
generated_non_arc_files = generated_non_arc_files,
includes = target_includes,
Expand Down Expand Up @@ -1089,6 +1118,52 @@ def _filter_deps(filter, deps):
kept_deps.append(dep)
return kept_deps

# Copied from https://github.com/bazelbuild/rules_apple/blob/8533494fa029f0fc44009c4532c191f349acf193/apple/internal/cc_toolchain_info_support.bzl
# TODO: Remove once rules_apple has been updated to include that.
def _get_apple_clang_triplet(cc_toolchain):
"""Parses and performs normalization on Clang target triplet string reference.

The C++ ToolchainInfo provider `target_gnu_system_name` field references an LLVM target triple.
This support method parses this target triplet and normalizes information for Apple targets.

See: https://clang.llvm.org/docs/CrossCompilation.html#target-triple

Args:
cc_toolchain: CcToolchainInfo provider.
Returns:
A normalized Clang target triplet struct for Apple targets.
"""
components = cc_toolchain.target_gnu_system_name.split("-")
raw_triplet = struct(
architecture = components[0],
vendor = components[1],
os = components[2],
environment = components[3] if len(components) > 3 else None,
)

if raw_triplet.vendor != "apple":
return raw_triplet

environment = "device" if (raw_triplet.environment == None) else "simulator"

# strip version from Apple platforms
os = raw_triplet.os
for index in range(len(raw_triplet.os)):
if raw_triplet.os[index].isdigit():
os = raw_triplet.os[:index]
break

# normalize MacOS names
if os in ("macos", "macosx", "darwin"):
os = "macos"

return struct(
architecture = raw_triplet.architecture,
vendor = raw_triplet.vendor,
os = os,
environment = environment,
)

def _tulsi_outputs_aspect(target, ctx):
"""Collects outputs of each build invocation."""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

<Scheme version="1.3" LastUpgradeVersion="1000">
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
<BuildActionEntries>
<BuildActionEntry buildForAnalyzing="YES" buildForRunning="YES" buildForProfiling="YES" buildForArchiving="YES" buildForTesting="YES">
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
<PreActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a build pre action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<PostActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a build post action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
</BuildAction>
<TestAction shouldUseLaunchSchemeArgsEnv="YES" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" buildConfiguration="__TulsiTestRunner_Debug">
<Testables>
<TestableReference skipped="NO">
<BuildableReference BuildableName="XCTest.xctest" BlueprintName="XCTest" BlueprintIdentifier="7E9AFE6285821F1A00000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</TestableReference>
</Testables>
<PreActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a test pre action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<PostActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a test post action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<MacroExpansion>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction debugServiceExtension="internal" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" buildConfiguration="Debug" debugDocumentVersioning="YES" launchStyle="0" ignoresPersistentStateOnLaunch="NO" allowLocationSimulation="YES" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" useCustomWorkingDirectory="NO">
<CommandLineArguments>
<CommandLineArgument isEnabled="YES" argument="--project-flag"></CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable value="projectValue" isEnabled="YES" key="projectKey"></EnvironmentVariable>
</EnvironmentVariables>
<PreActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a lauch pre action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<PostActions>
<ExecutionAction ActionType="Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent scriptText="This is a launch post action script" title="Run Script">
<EnvironmentBuildable>
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction useCustomWorkingDirectory="NO" shouldUseLaunchSchemeArgsEnv="YES" debugDocumentVersioning="YES" buildConfiguration="__TulsiTestRunner_Release">
<BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BuildableName="Application.app" BlueprintName="Application" BlueprintIdentifier="7E9AFE6267D9455000000000" ReferencedContainer="container:SimpleProject.xcodeproj" BuildableIdentifier="primary"></BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
<ArchiveAction revealArchiveInOrganizer="YES" buildConfiguration="Release"></ArchiveAction>
</Scheme>
Loading