Skip to content

Commit

Permalink
heph fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvigee committed Nov 20, 2023
1 parent 0aa9a6e commit 691d7e5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 39 deletions.
45 changes: 22 additions & 23 deletions backend/go/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ def _find_go_work():
parts = heph.path.split(heph.pkg.dir())

prefix = "."
for i in range(0, len(parts)+1):
p = prefix+"/go.work"
for i in range(0, len(parts) + 1):
p = prefix + "/go.work"

if len(glob(p)) > 0:
return p

prefix += "/.."

fail("unable to locate work file from "+heph.pkg.dir())
fail("unable to locate work file from " + heph.pkg.dir())

def go_mod(
mod_pkgs = [],
Expand Down Expand Up @@ -166,7 +166,7 @@ def go_mod(
if work:
p = _find_go_work()
godeps_deps += [p]
godeps_deps += glob(p+".sum")
godeps_deps += glob(p + ".sum")

imports = target(
name = "_go_mod_gen_imports",
Expand All @@ -181,19 +181,17 @@ def go_mod(
(pkg, _, _) = heph.split(go)

mod_pkgs_gen = [
"//"+pkg+":_std_pkgs_*",
"//" + pkg + ":_std_pkgs_*",
"go_lib",
"go_build_bin",
"test",
"thirdparty",
"go-test",
"//thirdparty/go/**:_go_mod_download*"
"//thirdparty/go/**:_go_mod_download*",
]

for pkg in mod_pkgs+['//thirdparty/go']:
mod_pkgs_gen += [
pkg+"/**:_go_lib*",
]
for pkg in mod_pkgs + ["//thirdparty/go"]:
mod_pkgs_gen += [pkg + "/**:_go_lib*"]

# Add labels defined in cfg
for pkg in cfg.values():
Expand All @@ -203,21 +201,22 @@ def go_mod(
labels = pkg["test"]["run"]["labels"]
if type(labels) != "list":
labels = [labels]

mod_pkgs_gen += labels

mod_pkgs_gen += [
heph.pkg.addr()+"/**:_go_lib*",
heph.pkg.addr()+"/**:go_bin#build*",
heph.pkg.addr()+"/**:_go_test_lib*",
heph.pkg.addr()+"/**:_go_xtest_lib*",
heph.pkg.addr()+"/**:_go_testmain_lib*",
heph.pkg.addr()+"/**:_go_xtestmain_lib*",
heph.pkg.addr()+"/**:_go_gen_testmain*",
heph.pkg.addr()+"/**:_go_gen_xtestmain*",
heph.pkg.addr()+"/**:_go_test#build*",
heph.pkg.addr()+"/**:_go_xtest#build*",
heph.pkg.addr()+"/**:go_test*",
heph.pkg.addr()+"/**:go_xtest*",
heph.pkg.addr() + "/**:_go_lib*",
heph.pkg.addr() + "/**:go_bin#build*",
heph.pkg.addr() + "/**:_go_test_lib*",
heph.pkg.addr() + "/**:_go_xtest_lib*",
heph.pkg.addr() + "/**:_go_testmain_lib*",
heph.pkg.addr() + "/**:_go_xtestmain_lib*",
heph.pkg.addr() + "/**:_go_gen_testmain*",
heph.pkg.addr() + "/**:_go_gen_xtestmain*",
heph.pkg.addr() + "/**:_go_test#build*",
heph.pkg.addr() + "/**:_go_xtest#build*",
heph.pkg.addr() + "/**:go_test*",
heph.pkg.addr() + "/**:go_xtest*",
]

target(
Expand Down Expand Up @@ -330,7 +329,7 @@ def go_library(
src_dep = None,
gen_embed = False,
):
pvt_name = name if name[0] == "_" else "_"+name
pvt_name = name if name[0] == "_" else "_" + name

p = dir + "/" if dir else ""

Expand Down
6 changes: 3 additions & 3 deletions test/features/deep-gen.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ target(
deps = deep_gen_1,
out = "deep-gen-0.BUILD",
gen = [
':deep_gen_1',
':hello_build',
":deep_gen_1",
":hello_build",
# deep:
':hello-deep-gen',
":hello-deep-gen",
],
)

Expand Down
10 changes: 1 addition & 9 deletions test/go/mod-custom-labels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@ load("//backend/go", "go_mod")
load("//backend/go", "go_bin")

go_mod(
cfg={
"...": {
"test": {
"run": {
"labels": "mytest"
}
}
}
}
cfg = {"...": {"test": {"run": {"labels": "mytest"}}}},
)
6 changes: 2 additions & 4 deletions test/go/work/mod-a/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("//backend/go", "go_mod")

go_mod(
mod_pkgs = [
'//test/go/work/mod-b'
],
work = True
mod_pkgs = ["//test/go/work/mod-b"],
work = True,
)

0 comments on commit 691d7e5

Please sign in to comment.