-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
159 changed files
with
29,062 additions
and
46,981 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,54 @@ | ||
// The custom build script, needed as we use flatbuffers. | ||
// The custo build script, used to (1) generate the Rust classes for the | ||
// protobuf implementation and (2) use pbjson for proto3 JSON serialization. | ||
|
||
use std::{env, path::PathBuf}; | ||
|
||
fn main() -> Result<(), anyhow::Error> { | ||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("protos"); | ||
let proto_files = vec![ | ||
"annonars/clinvar/minimal.proto", | ||
"annonars/clinvar/per_gene.proto", | ||
"annonars/clinvar/sv.proto", | ||
"annonars/cons/base.proto", | ||
"annonars/dbsnp/base.proto", | ||
"annonars/functional/refseq.proto", | ||
"annonars/genes/base.proto", | ||
"annonars/gnomad/exac_cnv.proto", | ||
"annonars/gnomad/gnomad2.proto", | ||
"annonars/gnomad/gnomad3.proto", | ||
"annonars/gnomad/gnomad_cnv4.proto", | ||
"annonars/gnomad/gnomad_sv2.proto", | ||
"annonars/gnomad/gnomad_sv4.proto", | ||
"annonars/gnomad/mtdna.proto", | ||
"annonars/gnomad/vep_common.proto", | ||
"annonars/gnomad/vep_gnomad2.proto", | ||
"annonars/gnomad/vep_gnomad3.proto", | ||
"annonars/helixmtdb/base.proto", | ||
] | ||
.iter() | ||
.map(|f| root.join(f)) | ||
.collect::<Vec<_>>(); | ||
|
||
// Tell cargo to recompile if any of these proto files are changed | ||
for proto_file in &proto_files { | ||
println!("cargo:rerun-if-changed={}", proto_file.display()); | ||
} | ||
|
||
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin"); | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=src/proto/annonars/clinvar/v1/minimal.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/clinvar/v1/per_gene.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/clinvar/v1/sv.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/cons/v1/base.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/dbsnp/v1/base.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/functional/v1/refseq.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gene/v1/base.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/exac_cnv.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/gnomad2.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/gnomad3.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/gnomad_cnv4.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/gnomad_sv2.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/gnomad_sv4.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/mtdna.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/vep_common.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/vep_gnomad2.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/gnomad/v1/vep_gnomad3.proto"); | ||
println!("cargo:rerun-if-changed=src/proto/annonars/helixmtdb/v1/base.proto"); | ||
prost_build::Config::new() | ||
.protoc_arg("-Isrc/proto") | ||
// Add serde serialization and deserialization to the generated code. | ||
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") | ||
// Skip serializing `None` values. | ||
.type_attribute(".", "#[serde_with::skip_serializing_none]") | ||
// Rename the field attributes such that we can properly decode | ||
// ucsc-annotation TSV file with serde. | ||
.field_attribute( | ||
"annonars.cons.v1.base.Record.chrom", | ||
"#[serde(rename = \"chromosome\")]", | ||
) | ||
.field_attribute( | ||
"annonars.cons.v1.base.Record.begin", | ||
"#[serde(rename = \"start\")]", | ||
) | ||
.field_attribute( | ||
"annonars.cons.v1.base..Record.end", | ||
"#[serde(rename = \"stop\")]", | ||
) | ||
// Save descriptors to file | ||
.file_descriptor_set_path(&descriptor_path) | ||
// Override prost-types with pbjson-types | ||
.compile_well_known_types() | ||
.extern_path(".google.protobuf", "::pbjson_types") | ||
// Define the protobuf files to compile. | ||
.compile_protos( | ||
&[ | ||
"annonars/clinvar/v1/minimal.proto", | ||
"annonars/clinvar/v1/per_gene.proto", | ||
"annonars/clinvar/v1/sv.proto", | ||
"annonars/cons/v1/base.proto", | ||
"annonars/dbsnp/v1/base.proto", | ||
"annonars/gene/v1/base.proto", | ||
"annonars/gnomad/v1/exac_cnv.proto", | ||
"annonars/functional/v1/refseq.proto", | ||
"annonars/gnomad/v1/gnomad2.proto", | ||
"annonars/gnomad/v1/gnomad3.proto", | ||
"annonars/gnomad/v1/gnomad_cnv4.proto", | ||
"annonars/gnomad/v1/gnomad_sv2.proto", | ||
"annonars/gnomad/v1/gnomad_sv4.proto", | ||
"annonars/gnomad/v1/mtdna.proto", | ||
"annonars/gnomad/v1/vep_common.proto", | ||
"annonars/gnomad/v1/vep_gnomad2.proto", | ||
"annonars/gnomad/v1/vep_gnomad3.proto", | ||
"annonars/helixmtdb/v1/base.proto", | ||
], | ||
&["src/"], | ||
) | ||
.unwrap(); | ||
.compile_protos(&proto_files, &[root])?; | ||
|
||
let descriptor_set = std::fs::read(descriptor_path).unwrap(); | ||
pbjson_build::Builder::new() | ||
.register_descriptors(&descriptor_set)? | ||
.build(&[".annonars"])?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/proto/annonars/cons/v1/base.proto → protos/annonars/cons/base.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/proto/annonars/dbsnp/v1/base.proto → protos/annonars/dbsnp/base.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/proto/annonars/gene/v1/base.proto → protos/annonars/genes/base.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.