Skip to content

Commit

Permalink
Remove orig_srcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky committed Aug 13, 2024
1 parent 517a1f9 commit 3e2b05e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 0 additions & 2 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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": {},
Expand Down
1 change: 0 additions & 1 deletion go/private/rules/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion go/private/tools/path.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
9 changes: 0 additions & 9 deletions go/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`` |
Expand Down Expand Up @@ -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 |
Expand Down
19 changes: 8 additions & 11 deletions go/tools/gopackagesdriver/aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 3e2b05e

Please sign in to comment.