Skip to content

Commit

Permalink
Remove source-db subtarget
Browse files Browse the repository at this point in the history
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
  • Loading branch information
grievejia authored and facebook-github-bot committed Nov 27, 2024
1 parent 333cb50 commit 4a78c69
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
4 changes: 1 addition & 3 deletions prelude/python/python_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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)
Expand All @@ -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)],
})

Expand Down
3 changes: 1 addition & 2 deletions prelude/python/python_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions prelude/python/source_db.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 4a78c69

Please sign in to comment.