Skip to content
Merged
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: 3 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ common --incompatible_enable_cc_toolchain_resolution
common --incompatible_strict_action_env

common --@llvm//config:experimental_stub_libgcc_s
common:linux --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
common:macos --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
common:linux --extra_toolchains=@llvm//toolchain:all
common:macos --extra_toolchains=@llvm//toolchain:all
common --repo_env=BAZEL_MSVC_RUNTIME_VISUAL_STUDIO_EULA=1
common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
common --extra_toolchains=@llvm//toolchain:all

common -c opt
common --@rules_rust//:extra_rustc_flags=-Clto=fat
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.2
9.1.0
4 changes: 3 additions & 1 deletion .github/workflows/build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set -eux

#bazel build --remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY" //:for_all_platforms
# Windows cross-compilation doesn't work with current toolchains...
bazel build //:for_non_windows_platforms
bazel build //:for_all_platforms

copy_out() {
src="$(bazel cquery --output=files "$1")"
Expand All @@ -13,5 +13,7 @@ copy_out //:for_aarch64-unknown-linux-musl toml2json_linux_arm64
copy_out //:for_x86_64-unknown-linux-musl toml2json_linux_amd64
copy_out //:for_aarch64-apple-darwin toml2json_darwin_arm64
copy_out //:for_x86_64-apple-darwin toml2json_darwin_amd64
copy_out //:for_aarch64-pc-windows-msvc toml2json_windows_arm64
copy_out //:for_x86_64-pc-windows-msvc toml2json_windows_amd64

shasum -a 256 toml2json_* > SHA256.txt
4 changes: 0 additions & 4 deletions .github/workflows/build_release_windows_amd64.bat

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/build_release_windows_arm64.bat

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,3 @@ jobs:

- name: Build
run: .github/workflows/build_release.sh

build_windows_amd64:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build
run: .github/workflows/build_release_windows_amd64.bat

build_windows_arm64:
runs-on: windows-11-arm
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build
run: .github/workflows/build_release_windows_arm64.bat
32 changes: 0 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,3 @@ jobs:
files: |
toml2json_*
SHA256.txt

release_windows_amd64:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build
run: .github/workflows/build_release_windows_amd64.bat

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
toml2json_windows_amd64.exe
SHA256_windows_amd64.txt

release_windows_arm64:
runs-on: windows-11-arm
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build
run: .github/workflows/build_release_windows_arm64.bat

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
toml2json_windows_arm64.exe
SHA256_windows_arm64.txt
16 changes: 11 additions & 5 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ rust_binary(
name = "toml2json",
srcs = ["src/main.rs"],
crate_root = "src/main.rs",
rustc_flags = select({
"@rules_rs//rs/experimental/platforms/constraints:windows_msvc": ["-Ctarget-feature=+crt-static"],
"//conditions:default": [],
}),
deps = [
"@crates//:serde_json",
"@crates//:serde-transcode",
"@crates//:serde_json",
"@crates//:toml",
],
)
Expand All @@ -29,27 +33,29 @@ rust_binary(
]

filegroup(
name = "for_non_windows_platforms",
name = "for_all_platforms",
srcs = [
"for_aarch64-apple-darwin",
"for_x86_64-apple-darwin",
"for_aarch64-pc-windows-msvc",
"for_aarch64-unknown-linux-musl",
"for_x86_64-apple-darwin",
"for_x86_64-pc-windows-msvc",
"for_x86_64-unknown-linux-musl",
],
)

platform(
name = "local_linux_platform",
parents = ["@platforms//host"],
constraint_values = [
"@llvm//constraints/libc:gnu.2.28",
],
parents = ["@platforms//host"],
)

platform(
name = "local_windows_platform",
parents = ["@platforms//host"],
constraint_values = [
"@rules_rs//rs/experimental/platforms/constraints:windows_msvc",
],
parents = ["@platforms//host"],
)
55 changes: 53 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
bazel_dep(name = "bazel_lib", version = "3.2.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "llvm", version = "0.6.0")
bazel_dep(name = "rules_rs", version = "0.0.37")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "llvm", version = "0.7.5")
bazel_dep(name = "rules_rs", version = "0.0.58")
bazel_dep(name = "windows_support", version = "0.1.1")

# TODO(archangelx360): remove once https://github.com/hermeticbuild/hermetic-llvm/pull/187 is merged
archive_override(
module_name = "llvm",
integrity = "sha256-vaQy8Ut+vqF72oZKUpBUhpEIAz1gHnC4A0Y6kaxLVy8=",
strip_prefix = "toolchains_llvm_bootstrapped-1dd9c3dabf5d56ce8a2905a4e2fa752acefa09b4",
urls = ["https://github.com/ArchangelX360/toolchains_llvm_bootstrapped/archive/1dd9c3dabf5d56ce8a2905a4e2fa752acefa09b4.tar.gz"],
)

# TODO(archangelx360): remove once https://github.com/bazelbuild/rules_cc/pull/561 is merged
archive_override(
module_name = "rules_cc",
integrity = "sha256-w4NREZoF1GQJaBI+z3SP0ceb54vl9s221+mjor/UBRA=",
strip_prefix = "rules_cc-2d9cb5a3c0b94ee408cd3946185a9608d2113ebd",
urls = ["https://github.com/ArchangelX360/rules_cc/archive/2d9cb5a3c0b94ee408cd3946185a9608d2113ebd.tar.gz"],
)

# TODO(archangelx360): remove once MSVC support is merged to `rules_rs`
archive_override(
module_name = "rules_rs",
integrity = "sha256-Khmf5nhdCyPkbvBd0+9Hr0phupjQ2/+0bXGiiHU83+Y=",
strip_prefix = "rules_rs-ee8aae35332bb2e0efe2598ff7b7edc56ec92687",
urls = ["https://github.com/ArchangelX360/rules_rs/archive/ee8aae35332bb2e0efe2598ff7b7edc56ec92687.tar.gz"],
)

rules_rust = use_extension("@rules_rs//rs/experimental:rules_rust.bzl", "rules_rust")
use_repo(rules_rust, "rules_rust")
Expand Down Expand Up @@ -32,3 +58,28 @@ crate.from_cargo(
use_experimental_platforms = True,
)
use_repo(crate, "crates")

msvc_runtime = use_extension("@windows_support//windows:extensions.bzl", "msvc_runtime")
msvc_runtime.configure(
msvc_version = "14.50.35717",
visual_studio_installer_manifest_integrity = "sha256-qOhU+p8/uurCfXME4pfxZg1xN0ATid61fPeYPzPBb+8=",
visual_studio_installer_manifest_url = "https://download.visualstudio.microsoft.com/download/pr/fdc37f6e-59f6-4054-838a-b476eeaa6ec3/1d82370739911457e0a2f6be15d8b5f569531b352b2eabb961429eea1e99e356/VisualStudio.vsman",
)
use_repo(msvc_runtime, "msvc_runtime")

windows_sdk = use_extension("@windows_support//windows:extensions.bzl", "windows_sdk")
windows_sdk.configure(
transformations = {
# TODO: change using vfs when available
"**/*.h": "lowercase",
"**/*.lib": "lowercase",
"**/*.Lib": "lowercase",
},
windows_sdk_integrity = {
"Microsoft.Windows.SDK.CPP": "sha256-/0VWYL7gcadEcVqWZWZvopwHaBV509gVlZqe7FpVZCQ=",
"Microsoft.Windows.SDK.CPP.x64": "sha256-rWzpD/lAEGmdKVSLPCseUsieuBFD4hmRVdmlw4ABtSs=",
"Microsoft.Windows.SDK.CPP.arm64": "sha256-A7wMA9Q5zvhQdLvNQl+dXTptO0Z5Z6zSHaO6bf7q+mc=",
},
windows_sdk_version = "10.0.26100.7705",
)
use_repo(windows_sdk, "windows_sdk")
Loading
Loading