Skip to content

Write librusty_v8.a sha-256 checksum to file. #547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ jobs:
run: cargo fmt -- --check

- name: Prepare binary publish
run: cp
target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }}
target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
env:
SOURCE: target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }}
TARGET: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
run: |
cp ${{ env.SOURCE }} ${{ env.TARGET }}
cp ${{ env.SOURCE }}.sha256sum ${{ env.TARGET }}.sha256sum

- name: Binary publish
uses: softprops/action-gh-release@v1
Expand All @@ -182,8 +185,11 @@ jobs:
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
with:
files: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
files: |
${{ env.TARGET }}
${{ env.TARGET }}.sha256sum

# TODO: add clang-format and maybe cpplint.

Expand Down
72 changes: 72 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ bitflags = "1.2.1"
[build-dependencies]
cargo_gn = "0.0.15"
which = "4.0.2"
sha2 = "0.9.2"

[dev-dependencies]
trybuild = "1.0.35"
Expand Down
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use sha2::Digest;
use sha2::Sha256;
use std::env;
use std::fs;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::process::exit;
Expand Down Expand Up @@ -114,6 +117,14 @@ fn build_v8() {
assert!(gn_out.exists());
assert!(gn_out.join("args.gn").exists());
cargo_gn::build("rusty_v8", None);

let filename = static_lib_path();
let mut file = fs::File::open(&filename).expect("archive not found");
let mut hasher = Sha256::new();
io::copy(&mut file, &mut hasher).unwrap();
let hash = format!("{:x}", hasher.finalize());
let filename = format!("{}.sha256sum", filename.to_str().unwrap());
fs::write(&filename, hash).unwrap();
}

fn maybe_install_sysroot(arch: &str) {
Expand Down