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

go_repo: Add c_srcs to cgo_library #213

Merged
merged 2 commits into from
Jan 23, 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
4 changes: 4 additions & 0 deletions tools/please_go/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.8.5
--------------
* in go_repo, add c source to the generated cgo_library (#213)

Version 1.8.4
--------------
* in go_repo's subrepo write build tags to the plz config
Expand Down
2 changes: 1 addition & 1 deletion tools/please_go/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.4
1.8.5
1 change: 1 addition & 0 deletions tools/please_go/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ func (g *Generate) ruleForPackage(pkg *build.Package, dir string) *Rule {
srcs: pkg.GoFiles,
module: g.moduleArg,
cgoSrcs: pkg.CgoFiles,
cSrcs: pkg.CFiles,
compilerFlags: pkg.CgoCFLAGS,
linkerFlags: pkg.CgoLDFLAGS,
pkgConfigs: pkg.CgoPkgConfig,
Expand Down
7 changes: 5 additions & 2 deletions tools/please_go/generate/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ type Rule struct {
module string
srcs []string
cgoSrcs []string
cSrcs []string
compilerFlags []string
linkerFlags []string
pkgConfigs []string
asmFiles []string
hdrs []string
deps []string
embedPatterns []string
// TODO(jpoole): handle external test
external, isCMD bool
isCMD bool
}

func populateRule(r *build.Rule, targetState *Rule) {
Expand All @@ -26,6 +26,9 @@ func populateRule(r *build.Rule, targetState *Rule) {
} else {
r.SetAttr("srcs", NewStringList(targetState.srcs))
}
if len(targetState.cSrcs) > 0 {
r.SetAttr("c_srcs", NewStringList(targetState.cSrcs))
}
if len(targetState.deps) > 0 {
r.SetAttr("deps", NewStringList(targetState.deps))
}
Expand Down
Loading