Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove orig_srcs #4038

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,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 = 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 @@ -216,7 +216,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"] = depset(transitive = [source["cover"], s.cover])
source["deps"] = source["deps"] + s.deps
Expand Down Expand Up @@ -267,7 +266,6 @@ def _library_to_source(go, attr, library, coverage_instrumented):
"library": library,
"mode": go.mode,
"srcs": srcs,
"orig_srcs": srcs,
"embedsrcs": embedsrcs,
"cover": depset(attr_srcs) if coverage_instrumented else depset(),
"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 @@ -672,7 +672,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,
fmeum marked this conversation as resolved.
Show resolved Hide resolved
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