Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #27 from prysmaticlabs/add-gazelle
Browse files Browse the repository at this point in the history
Add gazelle, generated BUILDs for examples, update rules_go
  • Loading branch information
prestonvanloon authored Feb 11, 2019
2 parents 8be727f + c1a8652 commit 0e61c30
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 9 deletions.
14 changes: 10 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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(
Expand Down
16 changes: 13 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions bls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
15 changes: 15 additions & 0 deletions example/aggregate-verify/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)
15 changes: 15 additions & 0 deletions example/hash-map-to-g2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)
15 changes: 15 additions & 0 deletions example/parallelize-verification/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)
15 changes: 15 additions & 0 deletions example/single-sign-verify/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)

0 comments on commit 0e61c30

Please sign in to comment.