Skip to content

Commit

Permalink
chore: bump flake (#3411)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts authored Oct 23, 2023
1 parent 8e1cab2 commit ab462fb
Show file tree
Hide file tree
Showing 90 changed files with 976 additions and 399 deletions.
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ ci:

dashboard:
- apps/dashboard/*
- flake.lock
- pnpm-lock.yaml

consent:
- apps/consent/*
- flake.lock
- pnpm-lock.yaml

core:
- core/**/*
- flake.lock
- pnpm-lock.yaml
25 changes: 21 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
nixpkgs-stable,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgsStable = import nixpkgs-stable { system = system; };
overlays = [
(self: super: {
nodejs = super.nodejs_20;
pnpm = super.nodePackages.pnpm;
yarn = super.yarn.override {
nodejs = super.nodejs_20;
};
tilt = pkgsStable.tilt;
})
];
pkgs = import nixpkgs {inherit overlays system;};
Expand Down
40 changes: 18 additions & 22 deletions prelude/android/android_binary_native_library_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.

# no support for "regex" type
# @starlark-rust: allow_string_literals_in_type_expr

load("@prelude//:paths.bzl", "paths")
load(
"@prelude//android:android_providers.bzl",
Expand Down Expand Up @@ -60,7 +57,7 @@ load(
"traverse_shared_library_info",
)
load("@prelude//linking:strip.bzl", "strip_object")
load("@prelude//utils:graph_utils.bzl", "breadth_first_traversal_by", "post_order_traversal", "topo_sort", "topo_sort_by")
load("@prelude//utils:graph_utils.bzl", "breadth_first_traversal_by", "post_order_traversal", "pre_order_traversal", "pre_order_traversal_by")
load("@prelude//utils:set.bzl", "set_type") # @unused Used as a type
load("@prelude//utils:utils.bzl", "dedupe_by_value", "expect")

Expand Down Expand Up @@ -175,7 +172,6 @@ def get_android_binary_native_library_info(
native_merge_debug = ctx.actions.declare_output("native_merge.debug")
dynamic_outputs.append(native_merge_debug)

if native_library_merge_sequence:
# We serialize info about the linkable graph and the apk module mapping and pass that to an
# external subcommand to apply a merge sequence algorithm and return us the merge mapping.
for platform, deps in deps_by_platform.items():
Expand All @@ -184,7 +180,9 @@ def get_android_binary_native_library_info(
linkables_debug = ctx.actions.write("linkables." + platform, list(graph_node_map.keys()))
enhance_ctx.debug_output("linkables." + platform, linkables_debug)

flattened_linkable_graphs_by_platform[platform] = graph_node_map # _get_flattened_linkable_graph(ctx, graph_node_map)
flattened_linkable_graphs_by_platform[platform] = graph_node_map

if native_library_merge_sequence:
native_library_merge_input_file = ctx.actions.write_json("mergemap.input", {
"linkable_graphs_by_platform": encode_linkable_graph_for_mergemap(flattened_linkable_graphs_by_platform),
"native_library_merge_sequence": ctx.attrs.native_library_merge_sequence,
Expand All @@ -201,8 +199,6 @@ def get_android_binary_native_library_info(
enhance_ctx.debug_output("compute_merge_sequence", native_library_merge_dir)

dynamic_inputs.append(native_library_merge_map)
elif has_native_merging:
flattened_linkable_graphs_by_platform = {platform: {} for platform in platform_to_original_native_linkables.keys()}

mergemap_gencode_jar = None
if has_native_merging and ctx.attrs.native_library_merge_code_generator:
Expand Down Expand Up @@ -243,12 +239,12 @@ def get_android_binary_native_library_info(
raw_target = str(target.raw_target())
merge_result = None
for merge_lib, patterns in ctx.attrs.native_library_merge_map.items():
if merge_result:
break
for pattern in patterns:
if pattern.match(raw_target):
if regex(pattern).match(raw_target):
merge_result = merge_lib
break
if merge_result:
break
if merge_result:
merge_map[str(target)] = merge_result
merge_map = ctx.actions.write_json("merge.map", merge_map_by_platform)
Expand All @@ -260,7 +256,7 @@ def get_android_binary_native_library_info(
ctx,
{
platform: LinkableMergeData(
glue_linkable = glue_linkables[platform],
glue_linkable = glue_linkables[platform] if glue_linkables else None,
default_shared_libs = platform_to_original_native_linkables[platform],
linkable_nodes = flattened_linkable_graphs_by_platform[platform],
merge_map = merge_map_by_platform[platform],
Expand Down Expand Up @@ -679,7 +675,7 @@ MergedLinkablesDebugInfo = record(
# may be just one constituent)
MergedSharedLibrary = record(
soname = str,
lib = SharedLibrary.type,
lib = SharedLibrary,
apk_module = str,
# this only includes solib constituents that are included in the android merge map
solib_constituents = list[str],
Expand All @@ -691,7 +687,7 @@ MergedSharedLibrary = record(
MergedLinkables = record(
# dict[platform, dict[final_soname, MergedSharedLibrary]]
shared_libs_by_platform = dict[str, dict[str, MergedSharedLibrary]],
debug_info = dict[str, MergedLinkablesDebugInfo.type],
debug_info = dict[str, MergedLinkablesDebugInfo],
)

# Input data to the linkables merge process
Expand Down Expand Up @@ -828,7 +824,7 @@ def _get_merged_linkables(
linkable_nodes = merge_data.linkable_nodes

linkable_nodes_graph = {k: dedupe(v.deps + v.exported_deps) for k, v in linkable_nodes.items()}
topo_sorted_targets = topo_sort(linkable_nodes_graph)
topo_sorted_targets = pre_order_traversal(linkable_nodes_graph)

# first we collect basic information about each link group, this will populate the fields in LinkGroupData and
# map target labels to their link group name.
Expand All @@ -839,7 +835,7 @@ def _get_merged_linkables(
expect(target not in target_to_link_group, "prelude internal error, target seen twice?")
target_apk_module = merge_data.apk_module_graph(str(target.raw_target()))

link_group = merge_data.merge_map[str(target)]
link_group = merge_data.merge_map.get(str(target), None)
if not link_group:
link_group = str(target)
link_groups[link_group] = LinkGroupData(
Expand Down Expand Up @@ -938,8 +934,8 @@ def _get_merged_linkables(
len(node_data.shared_libs) == 1,
"unexpected shared_libs length for somerge of {} ({})".format(target, node_data.shared_libs),
)
expect(not node_data.deps, "prebuilt shared libs with deps not supported by somerge")
expect(not node_data.exported_deps, "prebuilt shared libs with exported_deps not supported by somerge")
expect(not node_data.deps, "prebuilt shared library `{}` with deps not supported by somerge".format(target))
expect(not node_data.exported_deps, "prebuilt shared library `{}` with exported_deps not supported by somerge".format(target))
soname, shlib = node_data.shared_libs.items()[0]
shared_lib = SharedLibrary(
lib = shlib,
Expand Down Expand Up @@ -1034,7 +1030,7 @@ def _get_merged_linkables(

solib_constituents = []
link_group_deps = []
ordered_group_constituents = topo_sort_by(group_data.constituents, get_merged_graph_traversal(group, False))
ordered_group_constituents = pre_order_traversal_by(group_data.constituents, get_merged_graph_traversal(group, False))
representative_label = ordered_group_constituents[0]
for key in ordered_group_constituents:
real_constituents.append(key)
Expand Down Expand Up @@ -1187,7 +1183,7 @@ def relink_libraries(ctx: AnalysisContext, libraries_by_platform: dict[str, dict
shlib_graph[soname].append(dep)
rev_shlib_graph.setdefault(dep, []).append(soname)
needed_symbols_files = {}
for soname in topo_sort(shlib_graph):
for soname in pre_order_traversal(shlib_graph):
if soname in unsupported_libs:
relinked_libraries[soname] = shared_libraries[soname]
continue
Expand All @@ -1201,7 +1197,7 @@ def relink_libraries(ctx: AnalysisContext, libraries_by_platform: dict[str, dict
create_relinker_version_script(
ctx.actions,
output = relinker_version_script,
relinker_blocklist = [experimental_regex(s) for s in ctx.attrs.relinker_whitelist],
relinker_blocklist = [regex(s) for s in ctx.attrs.relinker_whitelist],
provided_symbols = provided_symbols_file,
needed_symbols = needed_symbols_for_this,
)
Expand Down Expand Up @@ -1229,7 +1225,7 @@ def relink_libraries(ctx: AnalysisContext, libraries_by_platform: dict[str, dict
def extract_provided_symbols(ctx: AnalysisContext, toolchain: CxxToolchainInfo, lib: Artifact) -> Artifact:
return extract_global_syms(ctx, toolchain, lib, "relinker_extract_provided_symbols")

def create_relinker_version_script(actions: AnalysisActions, relinker_blocklist: list["regex"], output: Artifact, provided_symbols: Artifact, needed_symbols: list[Artifact]):
def create_relinker_version_script(actions: AnalysisActions, relinker_blocklist: list[regex], output: Artifact, provided_symbols: Artifact, needed_symbols: list[Artifact]):
def create_version_script(ctx, artifacts, outputs):
all_needed_symbols = {}
for symbols_file in needed_symbols:
Expand Down
6 changes: 3 additions & 3 deletions prelude/android/android_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ ExopackageResourcesInfo = record(
)

AndroidBinaryNativeLibsInfo = record(
apk_under_test_prebuilt_native_library_dirs = list[PrebuiltNativeLibraryDir.type],
apk_under_test_prebuilt_native_library_dirs = list[PrebuiltNativeLibraryDir],
# Indicates which shared lib producing targets are included in the binary. Used by instrumentation tests
# to exclude those from the test apk.
apk_under_test_shared_libraries = list["target_label"],
apk_under_test_shared_libraries = list[TargetLabel],
exopackage_info = ["ExopackageNativeInfo", None],
root_module_native_lib_assets = list[Artifact],
non_root_module_native_lib_assets = list[Artifact],
Expand All @@ -54,7 +54,7 @@ AndroidBinaryNativeLibsInfo = record(

AndroidBinaryResourcesInfo = record(
# Optional information about resources that should be exopackaged
exopackage_info = [ExopackageResourcesInfo.type, None],
exopackage_info = [ExopackageResourcesInfo, None],
# manifest to be used by the APK
manifest = Artifact,
# per-module manifests (packaged as assets)
Expand Down
3 changes: 1 addition & 2 deletions prelude/android/tools/unpack_aar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import argparse
import pathlib
import shlex
import shutil
import zipfile
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -166,7 +165,7 @@ def main():
with open(jars_list, "w") as f:
f.write("\n".join([str(jar) for jar in all_jars]))

combine_all_jars_cmd = shlex.split(jar_builder_tool) + [
combine_all_jars_cmd = utils.shlex_split(jar_builder_tool) + [
"--entries-to-jar",
jars_list,
"--output",
Expand Down
17 changes: 16 additions & 1 deletion prelude/apple/apple_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ load(":apple_bundle_utility.bzl", "get_bundle_infos_from_graph", "merge_bundle_l
load(":apple_code_signing_types.bzl", "AppleEntitlementsInfo")
load(":apple_dsym.bzl", "DSYM_SUBTARGET", "get_apple_dsym")
load(":apple_frameworks.bzl", "get_framework_search_path_flags")
load(":apple_genrule_deps.bzl", "get_apple_build_genrule_deps_attr_value", "get_apple_genrule_deps_outputs")
load(":apple_sdk_metadata.bzl", "IPhoneSimulatorSdkMetadata", "MacOSXCatalystSdkMetadata")
load(":apple_target_sdk_version.bzl", "get_min_deployment_version_for_node", "get_min_deployment_version_target_linker_flags", "get_min_deployment_version_target_preprocessor_flags")
load(":apple_toolchain_types.bzl", "AppleToolchainInfo")
Expand Down Expand Up @@ -108,11 +109,16 @@ def apple_binary_impl(ctx: AnalysisContext) -> [list[Provider], Promise]:
swift_compile,
)

genrule_deps_outputs = []
if get_apple_build_genrule_deps_attr_value(ctx):
genrule_deps_outputs = get_apple_genrule_deps_outputs(cxx_attr_deps(ctx))

stripped = get_apple_stripped_attr_value_with_default_fallback(ctx)
constructor_params = CxxRuleConstructorParams(
rule_type = "apple_binary",
headers_layout = get_apple_cxx_headers_layout(ctx),
extra_link_flags = extra_link_flags,
extra_hidden = genrule_deps_outputs,
srcs = cxx_srcs,
additional = CxxRuleAdditionalParams(
srcs = swift_srcs,
Expand All @@ -122,6 +128,14 @@ def apple_binary_impl(ctx: AnalysisContext) -> [list[Provider], Promise]:
# follow.
static_external_debug_info = swift_debug_info.static,
shared_external_debug_info = swift_debug_info.shared,
subtargets = {
"swift-compilation-database": [
DefaultInfo(
default_output = swift_compile.compilation_database.db if swift_compile else None,
other_outputs = [swift_compile.compilation_database.other_outputs] if swift_compile else [],
),
],
},
),
extra_link_input = swift_object_files,
extra_link_input_has_external_debug_info = True,
Expand All @@ -144,9 +158,10 @@ def apple_binary_impl(ctx: AnalysisContext) -> [list[Provider], Promise]:
unstripped_binary = None
expect(unstripped_binary != None, "Expect to save unstripped_binary when stripped is enabled")
unstripped_binary = cxx_output.unstripped_binary
cxx_output.sub_targets["unstripped"] = [DefaultInfo(default_output = unstripped_binary)]
else:
unstripped_binary = cxx_output.binary
cxx_output.sub_targets["unstripped"] = [DefaultInfo(default_output = unstripped_binary)]

dsym_artifact = get_apple_dsym(
ctx = ctx,
executable = unstripped_binary,
Expand Down
14 changes: 13 additions & 1 deletion prelude/apple/apple_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ load(":apple_bundle_resources.bzl", "get_apple_bundle_resource_part_list", "get_
load(":apple_bundle_types.bzl", "AppleBinaryExtraOutputsInfo", "AppleBundleBinaryOutput", "AppleBundleExtraOutputsInfo", "AppleBundleInfo", "AppleBundleLinkerMapInfo", "AppleBundleResourceInfo")
load(":apple_bundle_utility.bzl", "get_bundle_min_target_version", "get_default_binary_dep", "get_flattened_binary_deps", "get_product_name")
load(":apple_dsym.bzl", "DSYM_INFO_SUBTARGET", "DSYM_SUBTARGET", "get_apple_dsym", "get_apple_dsym_ext", "get_apple_dsym_info")
load(":apple_genrule_deps.bzl", "get_apple_build_genrule_deps_attr_value", "get_apple_genrule_deps_outputs")
load(":apple_sdk.bzl", "get_apple_sdk_name")
load(":apple_universal_binaries.bzl", "create_universal_binary")
load(
Expand Down Expand Up @@ -294,7 +295,18 @@ def apple_bundle_impl(ctx: AnalysisContext) -> list[Provider]:

primary_binary_rel_path = get_apple_bundle_part_relative_destination_path(ctx, primary_binary_part)

sub_targets = assemble_bundle(ctx, bundle, apple_bundle_part_list_output.parts, apple_bundle_part_list_output.info_plist_part, SwiftStdlibArguments(primary_binary_rel_path = primary_binary_rel_path))
genrule_deps_outputs = []
if get_apple_build_genrule_deps_attr_value(ctx):
genrule_deps_outputs = get_apple_genrule_deps_outputs(ctx.attrs.deps)

sub_targets = assemble_bundle(
ctx,
bundle,
apple_bundle_part_list_output.parts,
apple_bundle_part_list_output.info_plist_part,
SwiftStdlibArguments(primary_binary_rel_path = primary_binary_rel_path),
genrule_deps_outputs,
)
sub_targets.update(aggregated_debug_info.sub_targets)

primary_binary_path = cmd_args([bundle, primary_binary_rel_path], delimiter = "/")
Expand Down
19 changes: 0 additions & 19 deletions prelude/apple/apple_bundle_macro_layer.bzl

This file was deleted.

Loading

0 comments on commit ab462fb

Please sign in to comment.