-
Notifications
You must be signed in to change notification settings - Fork 1
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
build: add bazel rules #3
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
============================================
- Coverage 100.00% 35.00% -65.00%
============================================
Files 1 2 +1
Lines 7 20 +13
Branches 7 20 +13
============================================
Hits 7 7
- Misses 0 13 +13 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @alon-dotan-starkware and @TzahiTaub)
crates/committer/BUILD
line 10 at r1 (raw file):
edition = "2021", proc_macro_deps = all_crate_deps(proc_macro = True), visibility = ["//visibility:public"],
why does blockifier repo use "//crates:__subpackages__"
visibility?
Code quote:
visibility = ["//visibility:public"],
crates/committer/BUILD
line 11 at r1 (raw file):
proc_macro_deps = all_crate_deps(proc_macro = True), visibility = ["//visibility:public"], deps = all_crate_deps(),
same format and order as the blockifier BUILD file
Suggestion:
name="committer_exe",
srcs=glob(["src/**/*.rs"]),
visibility=["//visibility:public"],
deps=all_crate_deps(),
proc_macro_deps=all_crate_deps(proc_macro=True),
edition="2021",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 4 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @alon-dotan-starkware and @TzahiTaub)
crates/committer/src/main.rs
line 5 at r1 (raw file):
/// Gets a binary input and an output file from the command line. /// Reads the input file, adds 1 to each byte, and writes the result to the output file.
forward-facing comment
Suggestion:
/// Main entry point of the committer CLI.
crates/committer/src/main.rs
line 7 at r1 (raw file):
/// Reads the input file, adds 1 to each byte, and writes the result to the output file. fn main() { // Open the input file
we don't have comment linter scripts ATM
Suggestion:
// Open the input file.
crates/committer/src/main.rs
line 22 at r1 (raw file):
} std::fs::write(output_file_name, bytes).expect("Failed to write output"); }
remove the dummy logic before merging (we keep the input-output file logic, it will be useful)
Suggestion:
use std::env;
use std::path::Path;
/// Gets a binary input and an output file from the command line.
/// Reads the input file, adds 1 to each byte, and writes the result to the output file.
fn main() {
// Open the input file
let args: Vec<String> = env::args().collect();
let input_file_name = Path::new(&args[1]);
let output_file_name = Path::new(&args[2]);
assert!(
input_file_name.is_absolute() && output_file_name.is_absolute(),
"Given paths must be absolute"
);
// Business logic to be implemented here.
let output = std::fs::read(input_file_name).unwrap();
// Output to file.
std::fs::write(output_file_name, output).expect("Failed to write output");
}
ec08531
to
56a74f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 5 files reviewed, 5 unresolved discussions (waiting on @alon-dotan-starkware and @dorimedini-starkware)
crates/committer/BUILD
line 10 at r1 (raw file):
Previously, dorimedini-starkware wrote…
why does blockifier repo use
"//crates:__subpackages__"
visibility?
I had to change it to use it in the main repo. As far as I understand, the blockifier repo target you mention is not used externally, but is a dependency of the py_lib
under crates/native_blockifier/BUILD
which is the one that is used externally, and also has a visibility public. We use the target above directly.
crates/committer/BUILD
line 11 at r1 (raw file):
Previously, dorimedini-starkware wrote…
same format and order as the blockifier BUILD file
Done.
crates/committer/src/main.rs
line 5 at r1 (raw file):
Previously, dorimedini-starkware wrote…
forward-facing comment
Done.
crates/committer/src/main.rs
line 7 at r1 (raw file):
Previously, dorimedini-starkware wrote…
we don't have comment linter scripts ATM
Done.
crates/committer/src/main.rs
line 22 at r1 (raw file):
Previously, dorimedini-starkware wrote…
remove the dummy logic before merging (we keep the input-output file logic, it will be useful)
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alon-dotan-starkware and @TzahiTaub)
crates/committer/src/lib.rs
line 0 at r3 (raw file):
ah... didn't notice the file locations...
the committer
crate should be a lib crate.
- restore this file
- move
main.rs
intocrates/committer_cli/src/main.rs
(will need another Cargo.toml for this)
56a74f2
to
847df7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 7 files reviewed, 1 unresolved discussion (waiting on @alon-dotan-starkware and @dorimedini-starkware)
crates/committer/src/lib.rs
line at r3 (raw file):
Previously, dorimedini-starkware wrote…
ah... didn't notice the file locations...
thecommitter
crate should be a lib crate.
- restore this file
- move
main.rs
intocrates/committer_cli/src/main.rs
(will need another Cargo.toml for this)
Done.
847df7e
to
166dcb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 9 files reviewed, 2 unresolved discussions (waiting on @alon-dotan-starkware and @dorimedini-starkware)
Cargo.lock
line 13 at r4 (raw file):
[[package]] name = "committer_cli"
Does this make sense? It's like one package in the repo states in depends on another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 7 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @alon-dotan-starkware and @TzahiTaub)
crates/committer_cli/Cargo.toml
line 7 at r4 (raw file):
repository.workspace = true license-file.workspace = true description = "Cli for the committer package."
should this be all caps?
Suggestion:
CLI
crates/committer_cli/Cargo.toml
line 10 at r4 (raw file):
[lints] workspace = true
you sure this is how we get both clippy and rust lints?
Code quote:
[lints]
workspace = true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @alon-dotan-starkware and @TzahiTaub)
crates/committer/BUILD
line 0 at r4 (raw file):
delete this?
166dcb8
to
94821f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @alon-dotan-starkware and @TzahiTaub)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @alon-dotan-starkware and @dorimedini-starkware)
crates/committer_cli/Cargo.toml
line 10 at r4 (raw file):
Previously, dorimedini-starkware wrote…
you sure this is how we get both clippy and rust lints?
Yes, for rust/cargo 1.74 and above
crates/committer/BUILD
line at r4 (raw file):
Previously, dorimedini-starkware wrote…
delete this?
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 7 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware)
Cargo.lock
line 13 at r4 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
Does this make sense? It's like one package in the repo states in depends on another?
Why do we need a different crate here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware)
Cargo.lock
line 13 at r4 (raw file):
Previously, alon-dotan-starkware wrote…
Why do we need a different crate here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alon-dotan-starkware and @TzahiTaub)
Cargo.lock
line 13 at r4 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
because this crate is an executable; we want to separate the business logic (library crate) from an executable that wraps it.
the lib crate will be published to crates.io, the executable (only used in our python backend) will not.
This change is