From 3e2b05ee39d7677090b124a2508ad8c2786b1587 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Tue, 13 Aug 2024 19:07:03 -0400 Subject: [PATCH] Remove orig_srcs --- go/private/actions/archive.bzl | 1 - go/private/context.bzl | 2 -- go/private/rules/test.bzl | 1 - go/private/tools/path.bzl | 2 +- go/providers.rst | 9 --------- go/tools/gopackagesdriver/aspect.bzl | 19 ++++++++----------- 6 files changed, 9 insertions(+), 25 deletions(-) diff --git a/go/private/actions/archive.bzl b/go/private/actions/archive.bzl index 9ed030ff8..7226849c2 100644 --- a/go/private/actions/archive.bzl +++ b/go/private/actions/archive.bzl @@ -172,7 +172,6 @@ def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_d # GoSource fields srcs = as_tuple(source.srcs), - orig_srcs = as_tuple(source.orig_srcs), _cover = as_tuple(source.cover), _embedsrcs = as_tuple(source.embedsrcs), _x_defs = tuple(source.x_defs.items()), diff --git a/go/private/context.bzl b/go/private/context.bzl index 172206210..6cce089b1 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -219,7 +219,6 @@ def _new_library(go, name = None, importpath = None, resolver = None, importable def _merge_embed(source, embed): s = get_source(embed) source["srcs"] = s.srcs + source["srcs"] - source["orig_srcs"] = s.orig_srcs + source["orig_srcs"] source["embedsrcs"] = source["embedsrcs"] + s.embedsrcs source["cover"] = source["cover"] + s.cover source["deps"] = source["deps"] + s.deps @@ -272,7 +271,6 @@ def _library_to_source(go, attr, library, coverage_instrumented): "library": library, "mode": go.mode, "srcs": srcs, - "orig_srcs": srcs, "cover": [], "embedsrcs": embedsrcs, "x_defs": {}, diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl index ab3cf2eb6..e6ee31eaa 100644 --- a/go/private/rules/test.bzl +++ b/go/private/rules/test.bzl @@ -673,7 +673,6 @@ def _recompile_external_deps(go, external_source, internal_archive, library_labe library = library, mode = go.mode, srcs = as_list(arc_data.srcs), - orig_srcs = as_list(arc_data.orig_srcs), cover = arc_data._cover, embedsrcs = as_list(arc_data._embedsrcs), x_defs = dict(arc_data._x_defs), diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl index f7b935e79..cbf1c836c 100644 --- a/go/private/tools/path.bzl +++ b/go/private/tools/path.bzl @@ -57,7 +57,7 @@ def _go_path_impl(ctx): pkg = struct( importpath = importpath, dir = "src/" + pkgpath, - srcs = as_list(archive.orig_srcs), + srcs = as_list(archive.srcs), runfiles = archive.runfiles, embedsrcs = as_list(archive._embedsrcs), pkgs = {mode: archive.file}, diff --git a/go/providers.rst b/go/providers.rst index fe7161031..7dd794343 100644 --- a/go/providers.rst +++ b/go/providers.rst @@ -129,11 +129,6 @@ method. In general, only rules_go should need to build or handle these. +--------------------------------+-----------------------------------------------------------------+ | The sources to compile into the archive. | +--------------------------------+-----------------------------------------------------------------+ -| :param:`orig_srcs` | :type:`list of File` | -+--------------------------------+-----------------------------------------------------------------+ -| The original source files this library is based on. This may differ from | -| :param:`srcs` if processing tools such as cgo or cover are applied. | -+--------------------------------+-----------------------------------------------------------------+ | :param:`embedsrcs` | :type:`list of File` | +--------------------------------+-----------------------------------------------------------------+ | Files that may be embedded into the compiled package using ``//go:embed`` | @@ -266,10 +261,6 @@ rule. Instead, it's referenced in the ``data`` field of GoArchive_. | The .go sources compiled into the archive. May have been generated or | | transformed with tools like cgo and cover. | +--------------------------------+-----------------------------------------------------------------+ -| :param:`orig_srcs` | :type:`tuple of File` | -+--------------------------------+-----------------------------------------------------------------+ -| The unmodified sources provided to the rule, including .go, .s, .h, .c files. | -+--------------------------------+-----------------------------------------------------------------+ | :param:`runfiles` | :type:`runfiles` | +--------------------------------+-----------------------------------------------------------------+ | Data files that should be available at runtime to binaries and tests built | diff --git a/go/tools/gopackagesdriver/aspect.bzl b/go/tools/gopackagesdriver/aspect.bzl index fccda50a3..71ab6374e 100644 --- a/go/tools/gopackagesdriver/aspect.bzl +++ b/go/tools/gopackagesdriver/aspect.bzl @@ -50,23 +50,20 @@ def file_path(f): return paths.join(prefix, f.path) def _go_archive_to_pkg(archive): + go_files = [ + file_path(src) + for src in archive.data.srcs + if src.path.endswith(".go") + ] return struct( ID = str(archive.data.label), PkgPath = archive.data.importpath, ExportFile = file_path(archive.data.export_file), - GoFiles = [ - file_path(src) - for src in archive.data.orig_srcs - if src.path.endswith(".go") - ], - CompiledGoFiles = [ - file_path(src) - for src in archive.data.srcs - if src.path.endswith(".go") - ], + GoFiles = go_files, + CompiledGoFiles = go_files, OtherFiles = [ file_path(src) - for src in archive.data.orig_srcs + for src in archive.data.srcs if not src.path.endswith(".go") ], Imports = {