From 4a78c696afa8d3fcdbcff1257384df0a2ba1a8f3 Mon Sep 17 00:00:00 2001 From: Jia Chen Date: Wed, 27 Nov 2024 09:15:11 -0800 Subject: [PATCH] Remove `source-db` subtarget Summary: IIRC it has been a while that the only user of the `[source-db]` subtarget is old Pyls/Jedi. Now that Pyls/Jedi is no longer a thing, I think it's time to remove the corresponding subtarget as well. Reviewed By: IanChilds Differential Revision: D66487364 fbshipit-source-id: 9dbcbeae8417f2500aee11d278b4a89f8dc1096c --- prelude/python/python_binary.bzl | 4 +--- prelude/python/python_library.bzl | 3 +-- prelude/python/source_db.bzl | 32 ------------------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/prelude/python/python_binary.bzl b/prelude/python/python_binary.bzl index 49a355f0462c..45c1e587e9b6 100644 --- a/prelude/python/python_binary.bzl +++ b/prelude/python/python_binary.bzl @@ -108,7 +108,7 @@ load( "py_resources", "qualify_srcs", ) -load(":source_db.bzl", "create_dbg_source_db", "create_python_source_db_info", "create_source_db", "create_source_db_no_deps") +load(":source_db.bzl", "create_dbg_source_db", "create_python_source_db_info", "create_source_db_no_deps") load(":toolchain.bzl", "NativeLinkStrategy", "PackageStyle", "PythonPlatformInfo", "PythonToolchainInfo", "get_package_style", "get_platform_attr") load(":typing.bzl", "create_per_target_type_check") @@ -386,7 +386,6 @@ def python_executable( shared_libraries = shared_deps, ) - source_db = create_source_db(ctx, src_manifest, python_deps) source_db_no_deps = create_source_db_no_deps(ctx, srcs) dbg_source_db = create_dbg_source_db(ctx, src_manifest, python_deps) @@ -411,7 +410,6 @@ def python_executable( "dbg-source-db": [dbg_source_db], "library-info": [library_info], "main": [DefaultInfo(default_output = ctx.actions.write_json("main.json", main))], - "source-db": [source_db], "source-db-no-deps": [source_db_no_deps, create_python_source_db_info(library_info.manifests)], }) diff --git a/prelude/python/python_library.bzl b/prelude/python/python_library.bzl index 38d627b96e50..9ea45ffbdb7f 100644 --- a/prelude/python/python_library.bzl +++ b/prelude/python/python_library.bzl @@ -58,7 +58,7 @@ load( ) load(":needed_coverage.bzl", "PythonNeededCoverageInfo") load(":python.bzl", "PythonLibraryInfo", "PythonLibraryManifests", "PythonLibraryManifestsTSet") -load(":source_db.bzl", "create_python_source_db_info", "create_source_db", "create_source_db_no_deps") +load(":source_db.bzl", "create_python_source_db_info", "create_source_db_no_deps") load(":toolchain.bzl", "PythonToolchainInfo") load(":typing.bzl", "create_per_target_type_check") @@ -387,7 +387,6 @@ def python_library_impl(ctx: AnalysisContext) -> list[Provider]: providers.append(create_python_needed_coverage_info(ctx.label, ctx.attrs.base_module, srcs.keys())) # Source DBs. - sub_targets["source-db"] = [create_source_db(ctx, src_type_manifest, deps)] sub_targets["source-db-no-deps"] = [create_source_db_no_deps(ctx, src_types), create_python_source_db_info(library_info.manifests)] # Type check diff --git a/prelude/python/source_db.bzl b/prelude/python/source_db.bzl index 4d299a03d058..589ae04f2453 100644 --- a/prelude/python/source_db.bzl +++ b/prelude/python/source_db.bzl @@ -22,38 +22,6 @@ PythonSourceDBInfo = provider(fields = { def create_python_source_db_info(manifests: [PythonLibraryManifestsTSet, None]) -> PythonSourceDBInfo: return PythonSourceDBInfo(manifests = manifests) -def create_source_db( - ctx: AnalysisContext, - srcs: [ManifestInfo, None], - python_deps: list[PythonLibraryInfo]) -> DefaultInfo: - output = ctx.actions.declare_output("db.json") - artifacts = [] - - python_toolchain = ctx.attrs._python_toolchain[PythonToolchainInfo] - cmd = cmd_args(python_toolchain.make_source_db) - cmd.add(cmd_args(output.as_output(), format = "--output={}")) - - # Pass manifests for rule's sources. - if srcs != None: - cmd.add(cmd_args(srcs.manifest, format = "--sources={}")) - artifacts.extend([a for a, _ in srcs.artifacts]) - - # Pass manifests for transitive deps. - dep_manifests = ctx.actions.tset(PythonLibraryManifestsTSet, children = [d.manifests for d in python_deps]) - - dependencies = cmd_args(dep_manifests.project_as_args("source_type_manifests"), format = "--dependency={}") - cmd.add(at_argfile( - actions = ctx.actions, - name = "source_db_dependencies", - args = dependencies, - )) - - artifacts.append(dep_manifests.project_as_args("source_type_artifacts")) - - ctx.actions.run(cmd, category = "py_source_db") - - return DefaultInfo(default_output = output, other_outputs = artifacts) - def create_dbg_source_db( ctx: AnalysisContext, srcs: [ManifestInfo, None],