-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add local debug options as a dependency, but only if local_debug_options_enabled #98
Changes from 1 commit
e230690
2556a04
3e82f9b
2b769bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
|
||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") | ||
|
||
|
||
exports_files( | ||
glob(["*.bzl"]), | ||
visibility = ["//docs:__pkg__"], | ||
) | ||
|
||
genrule( | ||
name = "empty", | ||
outs = ["empty.swift"], | ||
cmd = "touch $(OUTS)", | ||
) | ||
|
||
# A dummy target that enables serialize-debugging-options but only in local development, | ||
# so that swiftmodule paths will refer to paths on the local machine and LLDB will work. | ||
swift_library( | ||
name = "_LocalDebugOptions", | ||
srcs = [":empty"], | ||
copts = [ | ||
"-Xfrontend", | ||
"-serialize-debugging-options", | ||
], | ||
module_name = "_LocalDebugOptions", | ||
tags = ["no-remote"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
|
||
bool_flag(name = "local_debug_options_enabled", build_setting_default = False) | ||
|
||
config_setting( | ||
name = "local_debug_options", | ||
flag_values = { | ||
":local_debug_options_enabled": "True", | ||
} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,9 +61,16 @@ def ios_application(name, apple_library = apple_library, **kwargs): | |
application_kwargs["launch_storyboard"] = application_kwargs.pop("launch_storyboard", library.launch_screen_storyboard_name) | ||
application_kwargs["families"] = application_kwargs.pop("families", ["iphone", "ipad"]) | ||
|
||
local_debug_options_for_swift = [] | ||
if library.has_swift_sources: | ||
local_debug_options_for_swift += ["@build_bazel_rules_ios//rules:_LocalDebugOptions"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we update some documentation / readme to reflect this important flag? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added comments in the BUILD.bazel where the _LocalDebugOptions target is defined. I will also reference this README: https://github.com/ios-bazel-users/ios-bazel-users/blob/master/DebuggableRemoteSwift.md There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding separate docs shouldn't be necessary, since the xcodeproj rule automatically enables the flag when necessary |
||
|
||
rules_apple_ios_application( | ||
name = name, | ||
deps = library.deps, | ||
deps = library.deps + select({ | ||
"@build_bazel_rules_ios//rules:local_debug_options": local_debug_options_for_swift, | ||
"//conditions:default": [], | ||
}), | ||
infoplists = infoplists, | ||
**application_kwargs | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ cd $(dirname $0) | |
|
||
xcodebuild -project Single-Application-Project-DirectTargetsOnly.xcodeproj -quiet | ||
xcodebuild -project Single-Application-Project-AllTargets.xcodeproj -quiet | ||
xcodebuild -project Test-Target-With-Test-Host-Project.xcodeproj -quiet | ||
xcodebuild -project Test-Target-With-Test-Host-Project.xcodeproj -quiet | ||
# TODO: use strings to test that absolute paths and debug-prefix-map are present in the LocalDebug.swiftmodule. Not sure if this is the right palce to do it. We could also grep out the build event text file maybe. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trailing newline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: spelling of place |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
$BAZEL_PATH build --experimental_execution_log_file=$BAZEL_BUILD_EXECUTION_LOG_FILENAME --build_event_text_file=$BAZEL_BUILD_EVENT_TEXT_FILENAME --build_event_publish_all_actions $1 2>&1 | $BAZEL_OUTPUT_PROCESSOR | ||
$BAZEL_PATH build --experimental_execution_log_file=$BAZEL_BUILD_EXECUTION_LOG_FILENAME --build_event_text_file=$BAZEL_BUILD_EVENT_TEXT_FILENAME --build_event_publish_all_actions $1 --@build_bazel_rules_ios//rules:local_debug_options_enabled 2>&1 | $BAZEL_OUTPUT_PROCESSOR | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run the following to get test fixtures updated:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we also tag as manual?