Skip to content

Bump golang.org/x/net from 0.17.0 to 0.23.0 in /test #1

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions erlang_grpc.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load(
"//private:erlang_grpc.bzl",
_erlang_grpc = "erlang_grpc",
)

def erlang_grpc(**kwargs):
_erlang_grpc(**kwargs)
7 changes: 7 additions & 0 deletions erlang_release.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load(
"//private:erlang_release.bzl",
_erlang_release = "erlang_release",
)

def erlang_release(**kwargs):
_erlang_release(**kwargs)
4 changes: 4 additions & 0 deletions gazelle/rebar_config_to_json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ mapify_dep({Name, Version, {git = Kind, Remote, Ref}, [raw]}) ->
%% other formats
mapify_dep({Name, {pkg, _}}) ->
#{name => Name,
kind => hex};
mapify_dep({Name, Version, {pkg, _}}) ->
#{name => Name,
version => Version,
kind => hex}.

conformErlOpt(Opt) when is_atom(Opt)->
Expand Down
4 changes: 3 additions & 1 deletion private/ct.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def _impl(ctx):
log_dir = ct_logdir if ct_logdir != "" else "${TEST_UNDECLARED_OUTPUTS_DIR}"

output = ctx.actions.declare_file(ctx.label.name)
script = """set -eo pipefail
script = """#!/bin/bash

set -eo pipefail

{maybe_install_erlang}

Expand Down
3 changes: 2 additions & 1 deletion private/dialyze.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def _impl(ctx):

if not ctx.attr.is_windows:
output = ctx.actions.declare_file(ctx.label.name)
script = """set -euo pipefail
script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

Expand Down
88 changes: 88 additions & 0 deletions private/erlang_grpc.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
load("//:erlang_app_info.bzl", "ErlangAppInfo", "flat_deps")
load("//:util.bzl", "path_join")
load(":util.bzl", "erl_libs_contents")
load(":erlang_bytecode.bzl", "unique_dirnames")
load(
"//tools:erlang_toolchain.bzl",
"erlang_dirs",
"maybe_install_erlang",
)

def _impl(ctx):
outputs = [
ctx.actions.declare_file(f.name)
for f in ctx.attr.outs
]

out_dir = unique_dirnames(outputs)
if len(out_dir) > 1:
fail(ctx.attr.outs, "do not share a common parent directory")
out_dir = out_dir[0]

erl_libs_dir = ctx.attr.name + "_deps"

erl_libs_files = erl_libs_contents(
ctx,
deps = flat_deps(ctx.attr.deps),
dir = erl_libs_dir,
)

erl_libs_path = path_join(ctx.bin_dir.path, ctx.label.package, erl_libs_dir)

(erlang_home, _, runfiles) = erlang_dirs(ctx)

proto_lib = ctx.attr.proto_lib
proto_files = proto_lib[ProtoInfo].transitive_sources

script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

export ERL_LIBS=$PWD/{erl_libs_path}

set -x
"{erlang_home}"/bin/erl \\
-noshell \\
-eval "grpcbox_gen:from_proto(\\"{proto}\\" , \\"{out_dir}\\")" \\
-s erlang halt
""".format(
proto = ctx.attr.proto,
erl_libs_path = erl_libs_path,
out_dir = out_dir,
maybe_install_erlang = maybe_install_erlang(ctx),
erlang_home = erlang_home,
)

inputs = depset(
transitive = [depset(erl_libs_files), runfiles.files, proto_files],
)

ctx.actions.run_shell(
command = script,
inputs = inputs,
outputs = outputs,
mnemonic = "ERLGRPC",
)

return [DefaultInfo(files = depset(outputs))]

erlang_grpc = rule(
implementation = _impl,
attrs = {
"proto": attr.string(
mandatory = True,
doc = "The path to the .proto file to generate code from.",
),
"proto_lib": attr.label(
mandatory = True,
doc = "The proto_library target to generate code from.",
providers = [ProtoInfo],
),
"deps": attr.label_list(providers = [ErlangAppInfo]),
"outs": attr.output_list(
mandatory = True,
),
},
toolchains = ["//tools:toolchain_type"],
)
66 changes: 66 additions & 0 deletions private/erlang_release.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
load("//:erlang_app_info.bzl", "ErlangAppInfo", "flat_deps")
load("//:util.bzl", "path_join")
load(":util.bzl", "erl_libs_contents")
load(
"//tools:erlang_toolchain.bzl",
"erlang_dirs",
"maybe_install_erlang",
)

def _impl(ctx):
erl_libs_dir = ctx.attr.name + "_deps"

erl_libs_files = erl_libs_contents(
ctx,
deps = flat_deps(ctx.attr.deps),
dir = erl_libs_dir,
)

erl_libs_path = path_join(ctx.bin_dir.path, ctx.label.package, erl_libs_dir)
out_dir = path_join(ctx.bin_dir.path, ctx.label.package)

(erlang_home, _, runfiles) = erlang_dirs(ctx)

output = ctx.actions.declare_file(ctx.attr.out)

script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

export ERL_LIBS=$PWD/{erl_libs_path}
export LIBDIR="{erl_libs_path}"
export OUTDIR="{out_dir}"

set -x
"{erlang_home}"/bin/erl \\
-noshell \\
-eval "{release_fun}" \\
-s erlang halt > /dev/null
""".format(
erl_libs_path = erl_libs_path,
release_fun = ctx.attr.release_fun,
out_dir = out_dir,
maybe_install_erlang = maybe_install_erlang(ctx),
erlang_home = erlang_home,
)

ctx.actions.run_shell(
command = script,
inputs = erl_libs_files,
outputs = [output],
mnemonic = "ERLRELEASE",
)


return [DefaultInfo(files = depset([output]))]

erlang_release = rule(
implementation = _impl,
attrs = {
"release_fun": attr.string(),
"deps": attr.label_list(providers = [ErlangAppInfo]),
"out": attr.string(),
},
toolchains = ["//tools:toolchain_type"],
)
4 changes: 3 additions & 1 deletion private/eunit.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def _impl(ctx):
test_env_commands.append("export {}=\"{}\"".format(k, v))

output = ctx.actions.declare_file(ctx.label.name)
script = """set -eo pipefail
script = """#!/bin/bash

set -eo pipefail

{maybe_install_erlang}

Expand Down
3 changes: 2 additions & 1 deletion private/plt.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def _impl(ctx):

(erlang_home, _, runfiles) = erlang_dirs(ctx)

script = """set -euo pipefail
script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

Expand Down
5 changes: 3 additions & 2 deletions private/shell.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ def _impl(ctx):

if not ctx.attr.is_windows:
output = ctx.actions.declare_file(ctx.label.name)
script = """set -euo pipefail

script = """#!/bin/bash
set -euo pipefail
{maybe_install_erlang}


export ERL_LIBS=$PWD/{erl_libs_path}

set -x
Expand Down
3 changes: 2 additions & 1 deletion private/xref.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def _impl(ctx):

if not ctx.attr.is_windows:
output = ctx.actions.declare_file(ctx.label.name)
script = """set -euo pipefail
script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

Expand Down
6 changes: 4 additions & 2 deletions private/xref2.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def _impl(ctx):

if not ctx.attr.is_windows:
output = ctx.actions.declare_file(ctx.label.name)
script = """set -euo pipefail
script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

Expand Down Expand Up @@ -206,7 +207,8 @@ def _query_impl(ctx):

if not ctx.attr.is_windows:
output = ctx.actions.declare_file(ctx.label.name)
script = """set -euo pipefail
script = """#!/bin/bash
set -euo pipefail

{maybe_install_erlang}

Expand Down
6 changes: 3 additions & 3 deletions test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
Expand Down
27 changes: 25 additions & 2 deletions tools/app_file_tool/src/app_file_tool.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,37 @@ main([KeyString, AppSrc]) ->
{ok, [AppInfo]} = file:consult(AppSrc),
{application, AppName, Props} = AppInfo,
NewProps = lists:keystore(Key, 1, Props, {Key, Value}),
io:format("~tp.~n", [{application, AppName, NewProps}]),
io:format("~tp.~n", [{application, AppName, ensure_relx_compliant(NewProps)}]),
halt();
main([AppSrc]) ->
{ok, Entries} = io:read(""),
{ok, [AppInfo]} = file:consult(AppSrc),
{application, AppName, Props} = AppInfo,
NewProps = Props ++ Entries,
io:format("~tp.~n", [{application, AppName, NewProps}]),
io:format("~tp.~n", [{application, AppName, ensure_relx_compliant(NewProps)}]),
halt();
main(_) ->
halt(1).

ensure_relx_compliant(AppData) ->
ensure_registered(ensure_string_vsn(AppData)).

%% https://github.com/erlware/relx/issues/32
ensure_registered(AppData) ->
case lists:keyfind(registered, 1, AppData) of
false ->
[{registered, []} | AppData];
{registered, _} ->
AppData
end.

%% https://github.com/for-GET/jesse/blob/master/src/jesse.app.src#L4
ensure_string_vsn(AppData) ->
case proplists:get_value(vsn, AppData, undefined) of
undefined ->
AppData;
VSN when is_atom(VSN)->
proplists:delete(vsn, AppData) ++ [{vsn, atom_to_list(VSN)}];
_ ->
AppData
end.
34 changes: 34 additions & 0 deletions util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,37 @@ def without(item, elements):
c = list(elements)
c.remove(item)
return c

def _common_root_as_var(ctx):
if ctx.attr.var_name != "":
key = ctx.attr.var_name
else:
key = ctx.label.name.upper()

value = ctx.files.srcs[0].dirname
for src in ctx.files.srcs:
if value.startswith(src.dirname):
value = src.dirname
elif src.dirname.startswith(value):
pass
elif value == src.dirname:
pass
else:
fail("%s and %s do not share a common root" % (value, src.dirname))

return [
platform_common.TemplateVariableInfo({
key: value,
}),
]

common_root_as_var = rule(
implementation = _common_root_as_var,
attrs = {
"var_name": attr.string(),
"srcs": attr.label_list(
allow_files = True,
mandatory = True,
),
},
)