Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/git
1 result
Show changes
Commits on Source (9)
Showing
with 358 additions and 21929 deletions
# Enable `bzlmod`
common --enable_bzlmod
# Pre-release registry
common --registry=https://bcr.bazel.build
common --registry=https://gitlab.arm.com/bazel/rules_git/-/releases/v1.0.0-alpha.6/downloads/
# Build cache
build --experimental_guard_against_concurrent_changes
......
7.0.0
7.3.1
load("@rules_diff//diff/file/test:defs.bzl", "diff_file_test")
# TODO: remove when we have *real* testing
diff_file_test(
name = "placeholder",
size = "small",
a = ":MODULE.bazel",
b = ":MODULE.bazel",
)
# [1.0.0-alpha.10](https://git.gitlab.arm.com/bazel/git/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2024-08-30)
### Bug Fixes
- **archive:** correctly add `g+w` to regular files ([e136d02](https://git.gitlab.arm.com/bazel/git/commit/e136d02010c2ebf7f92c882765a45955439cf75c))
- **archive:** submodule entries are directories ([641b45b](https://git.gitlab.arm.com/bazel/git/commit/641b45bfaa423450e4e0b018bab9879f072c3ef5))
# [1.0.0-alpha.9](https://git.gitlab.arm.com/bazel/git/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2024-05-22)
### Features
......
* @bazel
[Go] @lukasz.okraszewski @matthew.clarkson
[Go] @alex.tercete @matthew.clarkson
*.go
/go.mod
......@@ -27,7 +27,7 @@
[Branding] @matthew.clarkson
/icon.svg
[Bazel] @matthew.clarkson @lukasz.okraszewski
[Bazel] @alex.tercete @matthew.clarkson
/.bazelrc
/.bazelrc.ci
/.bazelignore
......
......@@ -8,6 +8,12 @@
$ bazelisk test //...
```
To test against a local `rules_git` add a `.bazelrc.user`:
```
common --override_module=rules_git=<path-to-rules_git>
```
## Gazelle
Update `BUILD.bazel` files with:
......
module(
name = "bazel-git",
version = "1.0.0-alpha.9",
version = "1.0.0-alpha.10",
bazel_compatibility = [
">=7.0.0",
],
compatibility_level = 1,
)
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.4")
bazel_dep(name = "rules_coreutils", version = "1.0.0-alpha.8")
bazel_dep(name = "rules_go", version = "0.46.0")
bazel_dep(name = "rules_diff", version = "1.0.0-alpha.3")
bazel_dep(name = "hermetic_cc_toolchain", version = "3.0.0")
bazel_dep(name = "gazelle", version = "0.36.0")
bazel_dep(name = "circl", version = "1.3.3")
# Need https://github.com/bazelbuild/rules_go/pull/3872 to be hermetic
# TODO: remove this when `rules_go` can be upgraded past `0.46.0`
archive_override(
module_name = "rules_go",
integrity = "sha256-noUIrypWj4ZDmCk0Pttz+JpVlNw33H0wcFwmUSA+HPE=",
strip_prefix = "rules_go-75004b51080f64f74b9acd66506fbe1f7eb30b40",
urls = ["https://github.com/bazelbuild/rules_go/archive/75004b51080f64f74b9acd66506fbe1f7eb30b40.tar.gz"],
)
bazel_dep(name = "rules_go", version = "0.48.0")
bazel_dep(name = "gazelle", version = "0.37.0")
bazel_dep(name = "circl", version = "1.3.8")
# Need https://github.com/bazelbuild/bazel-central-registry/pull/1629 to support `pure = "on"`
# TODO: remove this when `circl` PR is resolved
archive_override(
module_name = "circl",
integrity = "sha256-RJcJPLdUTTDp1ddBpeYsFPuJicQnHKCpoKA6c1cLO4M=",
patch_strip = 1,
patches = [
"circl/1.3.7/patches/add_module_file.patch",
"circl/1.3.7/patches/generate_build_files.patch",
"circl/1.3.7/patches/modify_build_files.patch",
"circl/1.3.7/patches/switch_purego_build_tag_to_cgo.patch",
"circl/1.3.7/patches/add_pure_tests_for_mathmatical_libraries.patch",
],
strip_prefix = "github.com/cloudflare/circl@v1.3.7",
urls = ["https://proxy.golang.org/github.com/cloudflare/circl/@v/v1.3.7.zip"],
)
bazel_dep(name = "download_utils", version = "1.0.0-beta.2", dev_dependency = True)
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0", dev_dependency = True)
bazel_dep(name = "rules_diff", version = "1.0.0-beta.4", dev_dependency = True)
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.6", dev_dependency = True)
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.13", dev_dependency = True)
bazel_dep(name = "rules_git", version = "1.0.0-alpha.6", dev_dependency = True)
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
......@@ -66,3 +43,98 @@ register_toolchains(
"@zig_sdk//toolchain:darwin_amd64",
"@zig_sdk//toolchain:darwin_arm64",
)
# Download Bazelisk to build `bazel-git` for testing
download_file = use_repo_rule("@download_utils//download/file:defs.bzl", "download_file")
[
download_file(
name = name.removesuffix(".exe"),
executable = True,
integrity = integrity,
links = {
"bazelisk": "entrypoint",
},
output = "bazelisk",
urls = ["https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/{}".format(name)],
)
for name, integrity in (
("bazelisk-linux-amd64", "sha256-2a8fqAjAUpdTw779p1EjI2pxHZcdNIWjkFBxIhSHc6M="),
("bazelisk-linux-arm64", "sha256-Rn7DghrKXieMhXC3wl4N/BoGHShzvonkomaq9IgUhCY="),
("bazelisk-darwin-amd64", "sha256-UaYijVFwTGVt+fzqytGNZPJluXOQWz79z4pQS2h1Rb8="),
("bazelisk-darwin-arm64", "sha256-KXUzQcDdw1kx+yQOJH+7oLg++BvMwkM90HU2PsAqZ6Y="),
("bazelisk-windows-amd64.exe", "sha256-QXXOfvS1UvsX6TzkmiRWedwmo1zy+8fDFG2spv/HqB4="),
)
]
# Make sure we select the correct `bazelisk` for the host
select = use_repo_rule("@toolchain_utils//toolchain/local/select:defs.bzl", "toolchain_local_select")
select(
name = "bazelisk",
map = {
"amd64-linux": "@bazelisk-linux-amd64",
"arm64-linux": "@bazelisk-linux-arm64",
"arm64-macos": "@bazelisk-darwin-arm64",
"amd64-macos": "@bazelisk-darwin-amd64",
"amd64-windows": "@bazelisk-windows-amd64",
},
)
# Output base for the repository context build
base = use_repo_rule("//test/base:defs.bzl", "base")
base(name = "base")
# Build `bazel-git` for the current host
build = use_repo_rule("//test/build:defs.bzl", "build")
build(
name = "git",
srcs = [
".bazelrc",
"BUILD.bazel",
"MODULE.bazel",
"cmd/bazel-git/BUILD.bazel",
"cmd/bazel-git/archive.go",
"cmd/bazel-git/cat_file.go",
"cmd/bazel-git/checkout.go",
"cmd/bazel-git/config.go",
"cmd/bazel-git/error.go",
"cmd/bazel-git/fetch.go",
"cmd/bazel-git/init.go",
"cmd/bazel-git/ls_remote.go",
"cmd/bazel-git/ls_tree.go",
"cmd/bazel-git/main.go",
"cmd/bazel-git/pure.bzl",
"cmd/bazel-git/show.go",
"go.mod",
"go.sum",
"toolchain/git/BUILD.bazel",
],
out = "git",
target = "//cmd/bazel-git",
)
# Register the local `bazel-git` as a toolchain
register_toolchains("//toolchain/...")
# Perform a fetch
fetch = use_repo_rule("@rules_git//git/fetch:defs.bzl", "git_fetch")
fetch(
name = "github-git-git-2.43.0",
git = "@git",
reference = "refs/tags/v2.43.0",
remote = "https://github.com/git/git.git",
)
fetch(
name = "github-git-git-c089584ac8dedc3aa7c2c404839bc098050298a2",
commit = "c089584ac8dedc3aa7c2c404839bc098050298a2",
git = "@git",
remote = "https://github.com/git/git.git",
)
export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export")
use_repo(export, "coreutils")
This diff is collapsed.
commit f88c99d4b8d02731ede3fd7e3a5f01fe84336c31
Author: Fabian Meumertzheim <fabian@meumertzhe.im>
Date: Tue Jan 9 08:55:10 2024 +0100
Add MODULE.bazel
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..9754824
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,16 @@
+module(
+ name = "circl",
+ version = "1.3.7.bcr.1",
+)
+
+bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "io_bazel_rules_go")
+bazel_dep(name = "gazelle", version = "0.31.0")
+
+go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
+go_deps.from_file(go_mod = "//:go.mod")
+use_repo(
+ go_deps,
+ "com_github_bwesterb_go_ristretto",
+ "org_golang_x_crypto",
+ "org_golang_x_sys",
+)
From a8c4375a01c55eaef53e457a045e9874fc930d88 Mon Sep 17 00:00:00 2001
From: Matt Clarkson <mattyclarkson@gmail.com>
Date: Fri, 15 Mar 2024 12:10:45 +0000
Subject: [PATCH] Add pure tests for mathmatical libraries
The libraries have `noasm` support. These tests validate that support does not regress.
---
dh/x25519/BUILD.bazel | 16 ++++++++++++++++
dh/x448/BUILD.bazel | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/dh/x25519/BUILD.bazel b/dh/x25519/BUILD.bazel
index cacfcf1..7464c66 100644
--- a/dh/x25519/BUILD.bazel
+++ b/dh/x25519/BUILD.bazel
@@ -41,3 +41,19 @@ go_test(
"//math/fp25519",
],
)
+
+go_test(
+ name = "x25519_pure_test",
+ srcs = [
+ "curve_test.go",
+ "key_test.go",
+ ],
+ data = glob(["testdata/**"]),
+ embed = [":x25519"],
+ pure = "on",
+ deps = [
+ "//internal/conv",
+ "//internal/test",
+ "//math/fp25519",
+ ],
+)
diff --git a/dh/x448/BUILD.bazel b/dh/x448/BUILD.bazel
index 94a7b2b..b96c160 100644
--- a/dh/x448/BUILD.bazel
+++ b/dh/x448/BUILD.bazel
@@ -41,3 +41,19 @@ go_test(
"//math/fp448",
],
)
+
+go_test(
+ name = "x448_pure_test",
+ srcs = [
+ "curve_test.go",
+ "key_test.go",
+ ],
+ data = glob(["testdata/**"]),
+ embed = [":x448"],
+ pure = "on",
+ deps = [
+ "//internal/conv",
+ "//internal/test",
+ "//math/fp448",
+ ],
+)
This diff is collapsed.
commit 9e7940b9be05ca36d3ac2fdfac07b61a6e0dfefd
Author: Fabian Meumertzheim <fabian@meumertzhe.im>
Date: Tue Jan 9 09:00:27 2024 +0100
Fix Gazelle-generated BUILD files
* Added `cc_library` targets for header files referenced across packages
* Removed BUILD files for code generators
diff --git a/dh/x25519/BUILD.bazel b/dh/x25519/BUILD.bazel
index f80aba0..cacfcf1 100644
--- a/dh/x25519/BUILD.bazel
+++ b/dh/x25519/BUILD.bazel
@@ -13,6 +13,8 @@ go_library(
"key.go",
"table.go",
],
+ cgo = True,
+ cdeps = ["//math/fp25519:header"],
importpath = "github.com/cloudflare/circl/dh/x25519",
visibility = ["//visibility:public"],
deps = [
diff --git a/dh/x448/BUILD.bazel b/dh/x448/BUILD.bazel
index 31278c4..94a7b2b 100644
--- a/dh/x448/BUILD.bazel
+++ b/dh/x448/BUILD.bazel
@@ -13,6 +13,8 @@ go_library(
"key.go",
"table.go",
],
+ cgo = True,
+ cdeps = ["//math/fp448:header"],
importpath = "github.com/cloudflare/circl/dh/x448",
visibility = ["//visibility:public"],
deps = [
diff --git a/math/fp25519/BUILD.bazel b/math/fp25519/BUILD.bazel
index f423b16..8db8f9e 100644
--- a/math/fp25519/BUILD.bazel
+++ b/math/fp25519/BUILD.bazel
@@ -1,5 +1,11 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+cc_library(
+ name = "header",
+ hdrs = ["fp_amd64.h"],
+ visibility = ["//:__subpackages__"],
+)
+
go_library(
name = "fp25519",
srcs = [
diff --git a/math/fp448/BUILD.bazel b/math/fp448/BUILD.bazel
index 80715a1..fc50c6e 100644
--- a/math/fp448/BUILD.bazel
+++ b/math/fp448/BUILD.bazel
@@ -1,5 +1,11 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+cc_library(
+ name = "header",
+ hdrs = ["fp_amd64.h"],
+ visibility = ["//:__subpackages__"],
+)
+
go_library(
name = "fp448",
srcs = [
diff --git a/pke/kyber/internal/common/asm/BUILD.bazel b/pke/kyber/internal/common/asm/BUILD.bazel
deleted file mode 100644
index 8ab4e7e..0000000
--- a/pke/kyber/internal/common/asm/BUILD.bazel
+++ /dev/null
@@ -1,20 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-
-go_library(
- name = "asm_lib",
- srcs = ["src.go"],
- importpath = "github.com/cloudflare/circl/pke/kyber/internal/common/asm",
- visibility = ["//visibility:private"],
- deps = [
- "//pke/kyber/internal/common/params",
- "@com_github_mmcloughlin_avo//build:go_default_library",
- "@com_github_mmcloughlin_avo//operand:go_default_library",
- "@com_github_mmcloughlin_avo//reg:go_default_library",
- ],
-)
-
-go_binary(
- name = "asm",
- embed = [":asm_lib"],
- visibility = ["//pke/kyber:__subpackages__"],
-)
diff --git a/sign/dilithium/internal/common/asm/BUILD.bazel b/sign/dilithium/internal/common/asm/BUILD.bazel
deleted file mode 100644
index 310fca6..0000000
--- a/sign/dilithium/internal/common/asm/BUILD.bazel
+++ /dev/null
@@ -1,20 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-
-go_library(
- name = "asm_lib",
- srcs = ["src.go"],
- importpath = "github.com/cloudflare/circl/sign/dilithium/internal/common/asm",
- visibility = ["//visibility:private"],
- deps = [
- "//sign/dilithium/internal/common/params",
- "@com_github_mmcloughlin_avo//build:go_default_library",
- "@com_github_mmcloughlin_avo//operand:go_default_library",
- "@com_github_mmcloughlin_avo//reg:go_default_library",
- ],
-)
-
-go_binary(
- name = "asm",
- embed = [":asm_lib"],
- visibility = ["//sign/dilithium:__subpackages__"],
-)
diff --git a/simd/keccakf1600/internal/asm/BUILD.bazel b/simd/keccakf1600/internal/asm/BUILD.bazel
deleted file mode 100644
index b595042..0000000
--- a/simd/keccakf1600/internal/asm/BUILD.bazel
+++ /dev/null
@@ -1,18 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-
-go_library(
- name = "asm_lib",
- srcs = ["src.go"],
- importpath = "github.com/cloudflare/circl/simd/keccakf1600/internal/asm",
- visibility = ["//visibility:private"],
- deps = [
- "@com_github_mmcloughlin_avo//build:go_default_library",
- "@com_github_mmcloughlin_avo//operand:go_default_library",
- ],
-)
-
-go_binary(
- name = "asm",
- embed = [":asm_lib"],
- visibility = ["//simd/keccakf1600:__subpackages__"],
-)
From 5355997fc3f6ef137d65df3dfcb234c7df5a49d4 Mon Sep 17 00:00:00 2001
From: Matt Clarkson <mattyclarkson@gmail.com>
Date: Fri, 15 Mar 2024 16:37:13 +0000
Subject: [PATCH] Switch `purego` build tags to `cgo`
`rules_go` does not provide `purego` build tags when `pure = "on"`.
`cgo` build tag is the inverse so we can update the source files
to conditionally compile on `cgo`.
---
dh/csidh/fp511_amd64.s | 3 ++-
dh/csidh/fp511_noasm.go | 4 ++--
dh/sidh/internal/p434/arith_amd64.s | 3 ++-
dh/sidh/internal/p503/arith_amd64.s | 3 ++-
dh/sidh/internal/p751/arith_amd64.s | 3 ++-
dh/x25519/curve_amd64.go | 4 ++--
dh/x25519/curve_amd64.s | 3 ++-
dh/x25519/curve_noasm.go | 4 ++--
dh/x448/curve_amd64.go | 4 ++--
dh/x448/curve_amd64.s | 3 ++-
dh/x448/curve_noasm.go | 4 ++--
ecc/fourq/fp_amd64.go | 4 ++--
ecc/fourq/fp_amd64.s | 3 ++-
ecc/fourq/fp_noasm.go | 4 ++--
ecc/fourq/fq_amd64.go | 4 ++--
ecc/fourq/fq_amd64.s | 3 ++-
ecc/fourq/fq_noasm.go | 4 ++--
ecc/fourq/point_amd64.go | 4 ++--
ecc/fourq/point_amd64.s | 3 ++-
ecc/fourq/point_generic.go | 4 ++--
ecc/fourq/point_noasm.go | 4 ++--
ecc/p384/arith_amd64.s | 3 ++-
math/fp25519/fp_amd64.go | 4 ++--
math/fp25519/fp_amd64.s | 3 ++-
math/fp25519/fp_noasm.go | 4 ++--
math/fp448/fp_amd64.go | 4 ++--
math/fp448/fp_amd64.s | 3 ++-
math/fp448/fp_noasm.go | 4 ++--
28 files changed, 56 insertions(+), 44 deletions(-)
diff --git a/dh/csidh/fp511_amd64.s b/dh/csidh/fp511_amd64.s
index 612a0c5..2a2405c 100644
--- a/dh/csidh/fp511_amd64.s
+++ b/dh/csidh/fp511_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64
+//go:build amd64 && cgo
+// +build amd64,cgo
#include "textflag.h"
diff --git a/dh/csidh/fp511_noasm.go b/dh/csidh/fp511_noasm.go
index 72b2efd..6018821 100644
--- a/dh/csidh/fp511_noasm.go
+++ b/dh/csidh/fp511_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package csidh
diff --git a/dh/sidh/internal/p434/arith_amd64.s b/dh/sidh/internal/p434/arith_amd64.s
index 785997b..25675d5 100644
--- a/dh/sidh/internal/p434/arith_amd64.s
+++ b/dh/sidh/internal/p434/arith_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!noasm
+//go:build amd64 && cgo
+// +build amd64,cgo,!noasm
#include "textflag.h"
diff --git a/dh/sidh/internal/p503/arith_amd64.s b/dh/sidh/internal/p503/arith_amd64.s
index 2845cbd..7260c28 100644
--- a/dh/sidh/internal/p503/arith_amd64.s
+++ b/dh/sidh/internal/p503/arith_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!noasm
+//go:build amd64 && cgo
+// +build amd64,cgo,!noasm
#include "textflag.h"
diff --git a/dh/sidh/internal/p751/arith_amd64.s b/dh/sidh/internal/p751/arith_amd64.s
index 59f5fa6..488cc97 100644
--- a/dh/sidh/internal/p751/arith_amd64.s
+++ b/dh/sidh/internal/p751/arith_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!noasm
+//go:build amd64 && cgo
+// +build amd64,cgo,!noasm
#include "textflag.h"
diff --git a/dh/x25519/curve_amd64.go b/dh/x25519/curve_amd64.go
index 8a3d54c..07c8224 100644
--- a/dh/x25519/curve_amd64.go
+++ b/dh/x25519/curve_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package x25519
diff --git a/dh/x25519/curve_amd64.s b/dh/x25519/curve_amd64.s
index b772318..6309e42 100644
--- a/dh/x25519/curve_amd64.s
+++ b/dh/x25519/curve_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64
+//go:build amd64 && cgo
+// +build amd64,cgo
#include "textflag.h"
diff --git a/dh/x25519/curve_noasm.go b/dh/x25519/curve_noasm.go
index 07fab97..551eb87 100644
--- a/dh/x25519/curve_noasm.go
+++ b/dh/x25519/curve_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package x25519
diff --git a/dh/x448/curve_amd64.go b/dh/x448/curve_amd64.go
index a062266..2e3805d 100644
--- a/dh/x448/curve_amd64.go
+++ b/dh/x448/curve_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package x448
diff --git a/dh/x448/curve_amd64.s b/dh/x448/curve_amd64.s
index 810aa9e..e18a840 100644
--- a/dh/x448/curve_amd64.s
+++ b/dh/x448/curve_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64
+//go:build amd64 && cgo
+// +build amd64,cgo
#include "textflag.h"
diff --git a/dh/x448/curve_noasm.go b/dh/x448/curve_noasm.go
index 3755b7c..d5aef33 100644
--- a/dh/x448/curve_noasm.go
+++ b/dh/x448/curve_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package x448
diff --git a/ecc/fourq/fp_amd64.go b/ecc/fourq/fp_amd64.go
index da1ba4b..c2f63fc 100644
--- a/ecc/fourq/fp_amd64.go
+++ b/ecc/fourq/fp_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package fourq
diff --git a/ecc/fourq/fp_amd64.s b/ecc/fourq/fp_amd64.s
index 9543bd2..0336a12 100644
--- a/ecc/fourq/fp_amd64.s
+++ b/ecc/fourq/fp_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo,cgo
#include "textflag.h"
#include "fp_amd64.h"
diff --git a/ecc/fourq/fp_noasm.go b/ecc/fourq/fp_noasm.go
index aa35f52..586475c 100644
--- a/ecc/fourq/fp_noasm.go
+++ b/ecc/fourq/fp_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fourq
diff --git a/ecc/fourq/fq_amd64.go b/ecc/fourq/fq_amd64.go
index af880cd..579e85e 100644
--- a/ecc/fourq/fq_amd64.go
+++ b/ecc/fourq/fq_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package fourq
diff --git a/ecc/fourq/fq_amd64.s b/ecc/fourq/fq_amd64.s
index 415fc13..52adf79 100644
--- a/ecc/fourq/fq_amd64.s
+++ b/ecc/fourq/fq_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo,cgo
#include "fq_amd64.h"
diff --git a/ecc/fourq/fq_noasm.go b/ecc/fourq/fq_noasm.go
index 1c7716a..c8af974 100644
--- a/ecc/fourq/fq_noasm.go
+++ b/ecc/fourq/fq_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fourq
diff --git a/ecc/fourq/point_amd64.go b/ecc/fourq/point_amd64.go
index aeb7272..376e190 100644
--- a/ecc/fourq/point_amd64.go
+++ b/ecc/fourq/point_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package fourq
diff --git a/ecc/fourq/point_amd64.s b/ecc/fourq/point_amd64.s
index f4dd5dd..90fbe77 100644
--- a/ecc/fourq/point_amd64.s
+++ b/ecc/fourq/point_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo,cgo
#include "go_asm.h"
#include "fq_amd64.h"
diff --git a/ecc/fourq/point_generic.go b/ecc/fourq/point_generic.go
index 792cd31..beef6c2 100644
--- a/ecc/fourq/point_generic.go
+++ b/ecc/fourq/point_generic.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fourq
diff --git a/ecc/fourq/point_noasm.go b/ecc/fourq/point_noasm.go
index 22c2695..ab476a4 100644
--- a/ecc/fourq/point_noasm.go
+++ b/ecc/fourq/point_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fourq
diff --git a/ecc/p384/arith_amd64.s b/ecc/p384/arith_amd64.s
index 5f53c63..33957d1 100644
--- a/ecc/p384/arith_amd64.s
+++ b/ecc/p384/arith_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64,!noasm
+//go:build amd64 && cgo
+// +build amd64,cgo,!noasm
#include "textflag.h"
diff --git a/math/fp25519/fp_amd64.go b/math/fp25519/fp_amd64.go
index 057f0d2..fb71dbf 100644
--- a/math/fp25519/fp_amd64.go
+++ b/math/fp25519/fp_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package fp25519
diff --git a/math/fp25519/fp_amd64.s b/math/fp25519/fp_amd64.s
index 5c4aedd..d8e1eaa 100644
--- a/math/fp25519/fp_amd64.s
+++ b/math/fp25519/fp_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64
+//go:build amd64 && cgo
+// +build amd64,cgo
#include "textflag.h"
#include "fp_amd64.h"
diff --git a/math/fp25519/fp_noasm.go b/math/fp25519/fp_noasm.go
index 26ca4d0..1fb7c7a 100644
--- a/math/fp25519/fp_noasm.go
+++ b/math/fp25519/fp_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fp25519
diff --git a/math/fp448/fp_amd64.go b/math/fp448/fp_amd64.go
index 6a12209..f4097f9 100644
--- a/math/fp448/fp_amd64.go
+++ b/math/fp448/fp_amd64.go
@@ -1,5 +1,5 @@
-//go:build amd64 && !purego
-// +build amd64,!purego
+//go:build amd64 && cgo
+// +build amd64,cgo
package fp448
diff --git a/math/fp448/fp_amd64.s b/math/fp448/fp_amd64.s
index 435addf..643f07e 100644
--- a/math/fp448/fp_amd64.s
+++ b/math/fp448/fp_amd64.s
@@ -1,4 +1,5 @@
-// +build amd64
+//go:build amd64 && cgo
+// +build amd64,cgo
#include "textflag.h"
#include "fp_amd64.h"
diff --git a/math/fp448/fp_noasm.go b/math/fp448/fp_noasm.go
index a62225d..f2366c5 100644
--- a/math/fp448/fp_noasm.go
+++ b/math/fp448/fp_noasm.go
@@ -1,5 +1,5 @@
-//go:build !amd64 || purego
-// +build !amd64 purego
+//go:build !amd64 || !cgo
+// +build !amd64 !cgo
package fp448
......@@ -2,7 +2,9 @@ package main
import (
"archive/tar"
"fmt"
"io"
"io/fs"
"os"
"strings"
......@@ -169,7 +171,7 @@ func writeMetadata(repo *git.Repository, commit *object.Commit, name string, ent
func adjustName(entry object.TreeEntry, name string, prefix string) string {
name = prefix + name
if entry.Mode == filemode.Dir {
if entry.Mode == filemode.Dir || entry.Mode == filemode.Submodule {
return name + string(os.PathSeparator)
}
return name
......@@ -185,24 +187,34 @@ func objectSize(repo *git.Repository, entry object.TreeEntry) (int64, error) {
}
func fileMode(entry object.TreeEntry) (int64, error) {
osFileMode, err := entry.Mode.ToOSFileMode()
mode, err := entry.Mode.ToOSFileMode()
if err != nil {
return 0, err
}
mode := int64(osFileMode)
// We need to apply the TAR umask unless it's a symlink
// See: https://github.com/git/git/blob/0f3415f1f8478b05e64db11eb8aaa2915e48fef6/archive-tar.c#L267-L275
if entry.Mode == filemode.Symlink {
return mode, nil
// https://github.com/git/git/blob/0f3415f1f8478b05e64db11eb8aaa2915e48fef6/archive-tar.c#L267-L275
switch {
case mode.IsDir():
return (int64(mode) | 0777) & ^TarUmask, nil
case entry.Mode == filemode.Submodule:
return (int64(mode) | 0777) & ^TarUmask, nil
case mode&fs.ModeSymlink != 0:
return (int64(mode) | 0777), nil
case entry.Mode == filemode.Executable:
return (int64(mode) | 0777) & ^TarUmask, nil
case mode.IsRegular():
return (int64(mode) | 0666) & ^TarUmask, nil
default:
return 0, fmt.Errorf("unsupported file mode: 0%o (SHA1: %s)", mode, entry.Hash)
}
return mode & ^TarUmask, nil
}
func fileTypeFlag(entry object.TreeEntry) byte {
switch entry.Mode {
case filemode.Symlink:
return tar.TypeSymlink
case filemode.Submodule:
return tar.TypeDir
case filemode.Dir:
return tar.TypeDir
default:
......
exports_files(
["{{out}}"],
visibility = ["//visibility:public"],
)
load(":repository.bzl", _base = "base")
visibility("//...")
base = _base
visibility("//...")
DOC = """Provides a repository to put the `bazelisk` output base into."""
ATTRS = {}
def implementation(rctx):
rctx.file("BUILD.bazel", "")
base = repository_rule(
doc = DOC,
attrs = ATTRS,
implementation = implementation,
)
exports_files(
["{{out}}"],
visibility = ["//visibility:public"],
)