Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ def swift_bazel_dependencies():
maybe(
http_archive,
name = "cgrindel_bazel_starlib",
sha256 = "3f04ca2e3bef99563c6d96728b0a09f8484bc3c61ca804d29f67e86e6043c038",
strip_prefix = "bazel-starlib-0.11.0",
sha256 = "b4c92b66569c3371c08ef359883600c46bd51951e453cf12daa3b062ebea368a",
urls = [
"http://github.com/cgrindel/bazel-starlib/archive/v0.11.0.tar.gz",
"https://github.com/cgrindel/bazel-starlib/releases/download/v0.12.0/bazel-starlib.v0.12.0.tar.gz",
],
)

Expand Down
20 changes: 4 additions & 16 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ sh_binary(
[
bazel_integration_tests(
name = example + "_test",
timeout = _timeouts.get(
example,
default = _default_timeout,
),
timeout = _timeouts.get(example, _default_timeout),
bazel_versions = SUPPORTED_BAZEL_VERSIONS,
test_runner = ":test_runner",
workspace_files = integration_test_utils.glob_workspace_files(example) + [
Expand All @@ -85,10 +82,7 @@ sh_binary(
example + "_test",
CURRENT_BAZEL_VERSION,
),
timeout = _timeouts.get(
example,
default = _default_timeout,
),
timeout = _timeouts.get(example, _default_timeout),
bazel_version = CURRENT_BAZEL_VERSION,
test_runner = ":test_runner",
workspace_files = integration_test_utils.glob_workspace_files(example) + [
Expand All @@ -105,10 +99,7 @@ sh_binary(
example + "_test",
CURRENT_BAZEL_VERSION,
),
timeout = _timeouts.get(
example,
default = _default_timeout,
),
timeout = _timeouts.get(example, _default_timeout),
bazel_version = CURRENT_BAZEL_VERSION,
target_compatible_with = ["@platforms//os:macos"],
test_runner = ":test_runner",
Expand All @@ -126,10 +117,7 @@ sh_binary(
example + "_test",
CURRENT_BAZEL_VERSION,
),
timeout = _timeouts.get(
example,
default = _default_timeout,
),
timeout = _timeouts.get(example, _default_timeout),
bazel_version = CURRENT_BAZEL_VERSION,
target_compatible_with = ["@platforms//os:linux"],
test_runner = ":test_runner",
Expand Down
2 changes: 1 addition & 1 deletion swiftpkg/internal/build_decls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _uniq(decls):
kind = decl.kind,
name = decl.name,
)
existing_values = index_by_type_name.get(key, default = [])
existing_values = index_by_type_name.get(key, [])
existing_values.append(decl)
index_by_type_name[key] = existing_values

Expand Down
6 changes: 3 additions & 3 deletions swiftpkg/internal/bzl_selects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def _to_starlark(values, kind_handlers = {}):

# We are assuming that the select will always result in a list.
# Hence, we wrap the transformed value in a list.
kind_handler = kind_handlers.get(v.kind, default = _noop_kind_handler)
kind_handler = kind_handlers.get(v.kind, _noop_kind_handler)
tv = lists.flatten(kind_handler.transform(v.value))
if v.condition != None:
select_dict = selects_by_kind.get(v.kind, default = {})
select_dict = selects_by_kind.get(v.kind, {})
select_dict[v.condition] = tv
selects_by_kind[v.kind] = select_dict
else:
Expand All @@ -179,7 +179,7 @@ def _to_starlark(values, kind_handlers = {}):
k: select_dict[k]
for k in sorted_keys
}
kind_handler = kind_handlers.get(kind, default = _noop_kind_handler)
kind_handler = kind_handlers.get(kind, _noop_kind_handler)
if kind_handler.default != None:
new_select_dict[_bazel_select_default_condition] = kind_handler.default
select_fn = scg.new_fn_call("select", new_select_dict)
Expand Down
8 changes: 4 additions & 4 deletions swiftpkg/internal/deps_indexes.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def _new_from_json(json_str):

# buildifier: disable=uninitialized
def _add_module(m):
entries = mi.get(m.name, default = [])
entries = mi.get(m.name, [])
entries.append(m)
mi[m.name] = entries
if m.name != m.c99name:
entries = mi.get(m.c99name, default = [])
entries = mi.get(m.c99name, [])
entries.append(m)
mi[m.c99name] = entries

Expand Down Expand Up @@ -55,7 +55,7 @@ def _new_module_from_dict(mod_dict):
return _new_module(
name = mod_dict["name"],
c99name = mod_dict["c99name"],
src_type = mod_dict.get("src_type", default = "unknown"),
src_type = mod_dict.get("src_type", "unknown"),
label = bazel_labels.parse(mod_dict["label"]),
)

Expand Down Expand Up @@ -109,7 +109,7 @@ def _resolve_module_label(
Returns:
A `struct` as returned by `bazel_labels.new`.
"""
modules = deps_index.modules.get(module_name, default = [])
modules = deps_index.modules.get(module_name, [])
if len(modules) == 0:
return None
labels = [m.label for m in modules]
Expand Down
2 changes: 1 addition & 1 deletion swiftpkg/internal/load_statements.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _index(load_stmts):
index_by_location = {}
for load_stmt in load_stmts:
location = load_stmt.location
existing_values = index_by_location.get(location, default = [])
existing_values = index_by_location.get(location, [])
existing_values.append(load_stmt)
index_by_location[location] = existing_values
return index_by_location
Expand Down
4 changes: 2 additions & 2 deletions swiftpkg/tests/swiftpkg_build_files_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ def new_exec_result(return_code = 0, stdout = "", stderr = ""):

def new_stub_repository_ctx(repo_name, file_contents = {}, find_results = {}):
def read(path):
return file_contents.get(path, default = "")
return file_contents.get(path, "")

# buildifier: disable=unused-variable
def execute(args, quiet = True):
# The find command that we expect is `find -H -L path`.
# See repository_files.list_files_under for details.
if len(args) >= 4 and args[0] == "find":
path = args[3]
results = find_results.get(path, default = [])
results = find_results.get(path, [])
exec_result = new_exec_result(
stdout = "\n".join(results),
)
Expand Down