diff --git a/BUILD.bazel b/BUILD.bazel index 2ae572c..55bf1c6 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("@bazel_gazelle//:def.bzl", "gazelle") + +# gazelle:prefix github.com/prysmaticlabs/go-bls +gazelle(name = "gazelle") + +# gazelle:exclude bls.c go_library( name = "go_default_library", @@ -7,14 +13,14 @@ go_library( "crypto.go", ], cdeps = [ - "go-lib", + "go-lib", ], cgo = True, - clinkopts = ["-lstdc++"], - copts = ["-DMCLBN_FP_UNIT_SIZE=6 -DMCL_DONT_USE_OPENSSL"], + clinkopts = ["-lstdc++"], # keep + copts = ["-DMCLBN_FP_UNIT_SIZE=6 -DMCL_DONT_USE_OPENSSL"], # keep importpath = "github.com/prysmaticlabs/go-bls", visibility = ["//visibility:public"], - x_defs = { "bazel": "true" }, + x_defs = {"bazel": "true"}, ) cc_library( diff --git a/WORKSPACE b/WORKSPACE index c69fda3..e77b4ae 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,16 +2,26 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.6/rules_go-0.16.6.tar.gz", - sha256 = "ade51a315fa17347e5c31201fdc55aa5ffb913377aa315dceb56ee9725e620ee", + urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"], + sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1", ) -load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") +http_archive( + name = "bazel_gazelle", + urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"], + sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb", +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() go_register_toolchains() +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +gazelle_dependencies() + load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( diff --git a/bls.c b/bls.c index dcf0bc6..4bfa2b0 100644 --- a/bls.c +++ b/bls.c @@ -8,9 +8,9 @@ void blsSignatureAdd(blsSignature *sig, const blsSignature *rhs){} int blsVerify(const blsSignature *sig, const blsPublicKey *pub, const void *m, mclSize size){ return 0; } void mclBnFr_add(mclBnFr *z, const mclBnFr *x, const mclBnFr *y){} void mclBnFr_clear(mclBnFr *x){} -mclSize mclBnFr_deserialize(mclBnFr *x, const void *buf, mclSize bufSize){} +mclSize mclBnFr_deserialize(mclBnFr *x, const void *buf, mclSize bufSize){ return 0; } void mclBnFr_div(mclBnFr *z, const mclBnFr *x, const mclBnFr *y){} -mclSize mclBnFr_getStr(char *buf, mclSize maxBufSize, const mclBnFr *x, int ioMode){} +mclSize mclBnFr_getStr(char *buf, mclSize maxBufSize, const mclBnFr *x, int ioMode){ return 0; } int mclBnFr_setStr(mclBnFr *x, const char *buf, mclSize bufSize, int ioMode){ return 0; } void mclBnFr_inv(mclBnFr *y, const mclBnFr *x){} int mclBnFr_isEqual(const mclBnFr *x, const mclBnFr *y){ return 0; } diff --git a/example/aggregate-verify/BUILD.bazel b/example/aggregate-verify/BUILD.bazel new file mode 100644 index 0000000..901e5cc --- /dev/null +++ b/example/aggregate-verify/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/prysmaticlabs/go-bls/example/aggregate-verify", + visibility = ["//visibility:private"], + deps = ["//:go_default_library"], +) + +go_binary( + name = "aggregate-verify", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) diff --git a/example/hash-map-to-g2/BUILD.bazel b/example/hash-map-to-g2/BUILD.bazel new file mode 100644 index 0000000..4748b57 --- /dev/null +++ b/example/hash-map-to-g2/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/prysmaticlabs/go-bls/example/hash-map-to-g2", + visibility = ["//visibility:private"], + deps = ["//:go_default_library"], +) + +go_binary( + name = "hash-map-to-g2", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) diff --git a/example/parallelize-verification/BUILD.bazel b/example/parallelize-verification/BUILD.bazel new file mode 100644 index 0000000..0c8f2a9 --- /dev/null +++ b/example/parallelize-verification/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/prysmaticlabs/go-bls/example/parallelize-verification", + visibility = ["//visibility:private"], + deps = ["//:go_default_library"], +) + +go_binary( + name = "parallelize-verification", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) diff --git a/example/single-sign-verify/BUILD.bazel b/example/single-sign-verify/BUILD.bazel new file mode 100644 index 0000000..b0c36c8 --- /dev/null +++ b/example/single-sign-verify/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/prysmaticlabs/go-bls/example/single-sign-verify", + visibility = ["//visibility:private"], + deps = ["//:go_default_library"], +) + +go_binary( + name = "single-sign-verify", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +)