From 7e1c55cdf9027c562055f43d839c8a2753bfe24f Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 19 Apr 2022 15:20:40 +0300 Subject: [PATCH] use build tags to embed appropriate bundles --- build/builtin-actors/fetch-bundles.sh | 16 ++++++++++++++ build/builtin_actors_2k.go | 22 +++++++++++++++++++ build/builtin_actors_butterfly.go | 22 +++++++++++++++++++ ...n_actors.go => builtin_actors_calibnet.go} | 7 ++++-- build/builtin_actors_interop.go | 22 +++++++++++++++++++ build/builtin_actors_mainnet.go | 22 +++++++++++++++++++ 6 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 build/builtin_actors_2k.go create mode 100644 build/builtin_actors_butterfly.go rename build/{builtin_actors.go => builtin_actors_calibnet.go} (54%) create mode 100644 build/builtin_actors_interop.go create mode 100644 build/builtin_actors_mainnet.go diff --git a/build/builtin-actors/fetch-bundles.sh b/build/builtin-actors/fetch-bundles.sh index 58fb5c39d..bf4d44a55 100755 --- a/build/builtin-actors/fetch-bundles.sh +++ b/build/builtin-actors/fetch-bundles.sh @@ -58,10 +58,26 @@ fetch_bundle() { popd } +touch_bundles() { + ver=$1 + + if [ ! -e $ver ]; then + mkdir $ver + fi + + for net in mainnet caterpillarnet butterflynet calibrationnet devnet testing; do + touch $ver/builtin-actors-$net.car + done +} + if [ -n "$actors7_release" ]; then fetch v7 "$actors7_release" +else + touch_bundles v7 fi if [ -n "$actors8_release" ]; then fetch v8 "$actors8_release" +else + touch_bundles v8 fi diff --git a/build/builtin_actors_2k.go b/build/builtin_actors_2k.go new file mode 100644 index 000000000..1dfee49dc --- /dev/null +++ b/build/builtin_actors_2k.go @@ -0,0 +1,22 @@ +//go:build debug || 2k || testground +// +build debug 2k testground + +package build + +import ( + _ "embed" +) + +//go:embed builtin-actors/v8/builtin-actors-devnet.car +var actorsv8 []byte + +func BuiltinActorsV8Bundle() []byte { + return actorsv8 +} + +//go:embed builtin-actors/v7/builtin-actors-devnet.car +var actorsv7 []byte + +func BuiltinActorsV7Bundle() []byte { + return actorsv7 +} diff --git a/build/builtin_actors_butterfly.go b/build/builtin_actors_butterfly.go new file mode 100644 index 000000000..d3d76e8f9 --- /dev/null +++ b/build/builtin_actors_butterfly.go @@ -0,0 +1,22 @@ +//go:build butterflynet +// +build butterflynet + +package build + +import ( + _ "embed" +) + +//go:embed builtin-actors/v8/builtin-actors-butterflynet.car +var actorsv8 []byte + +func BuiltinActorsV8Bundle() []byte { + return actorsv8 +} + +//go:embed builtin-actors/v7/builtin-actors-butterflynet.car +var actorsv7 []byte + +func BuiltinActorsV7Bundle() []byte { + return actorsv7 +} diff --git a/build/builtin_actors.go b/build/builtin_actors_calibnet.go similarity index 54% rename from build/builtin_actors.go rename to build/builtin_actors_calibnet.go index 56bc5169a..d73760a77 100644 --- a/build/builtin_actors.go +++ b/build/builtin_actors_calibnet.go @@ -1,17 +1,20 @@ +//go:build calibnet +// +build calibnet + package build import ( _ "embed" ) -//go:embed builtin-actors/builtin-actors-v8.car +//go:embed builtin-actors/v8/builtin-actors-calibrationnet.car var actorsv8 []byte func BuiltinActorsV8Bundle() []byte { return actorsv8 } -//go:embed builtin-actors/builtin-actors-v7.car +//go:embed builtin-actors/v7/builtin-actors-calibrationnet.car var actorsv7 []byte func BuiltinActorsV7Bundle() []byte { diff --git a/build/builtin_actors_interop.go b/build/builtin_actors_interop.go new file mode 100644 index 000000000..8203e4b3d --- /dev/null +++ b/build/builtin_actors_interop.go @@ -0,0 +1,22 @@ +//go:build interopnet +// +build interopnet + +package build + +import ( + _ "embed" +) + +//go:embed builtin-actors/v8/builtin-actors-caterpillarnet.car +var actorsv8 []byte + +func BuiltinActorsV8Bundle() []byte { + return actorsv8 +} + +//go:embed builtin-actors/v7/builtin-actors-caterpillarnet.car +var actorsv7 []byte + +func BuiltinActorsV7Bundle() []byte { + return actorsv7 +} diff --git a/build/builtin_actors_mainnet.go b/build/builtin_actors_mainnet.go new file mode 100644 index 000000000..400ac7827 --- /dev/null +++ b/build/builtin_actors_mainnet.go @@ -0,0 +1,22 @@ +//go:build !debug && !2k && !testground && !calibnet && !nerpanet && !butterflynet && !interopnet +// +build !debug,!2k,!testground,!calibnet,!nerpanet,!butterflynet,!interopnet + +package build + +import ( + _ "embed" +) + +//go:embed builtin-actors/v8/builtin-actors-mainnet.car +var actorsv8 []byte + +func BuiltinActorsV8Bundle() []byte { + return actorsv8 +} + +//go:embed builtin-actors/v7/builtin-actors-mainnet.car +var actorsv7 []byte + +func BuiltinActorsV7Bundle() []byte { + return actorsv7 +}