-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from cloudflare/fix/missing-nodes
Fix missing node errors when importing annotations
- Loading branch information
Showing
7 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
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,9 +1,23 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
println!("cargo::rerun-if-changed=schemas"); | ||
|
||
recapnc::CapnpCommand::new() | ||
.src_prefix("schemas") | ||
.file("schemas/build.capnp") | ||
.file("schemas/bar.capnp") | ||
.write_to_out_dir(); | ||
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
|
||
macro_rules! run { | ||
($base:literal: $($path:literal),*) => { | ||
recapnc::CapnpCommand::new() | ||
.src_prefix(concat!("schemas/", $base)) | ||
$(.file(concat!("schemas/", $base, "/", $path)))* | ||
.write_to(out_dir.join($base)) | ||
}; | ||
} | ||
|
||
// Simple test with imports | ||
run!("build_rs": "build.capnp", "bar.capnp"); | ||
|
||
// Test that we ignore missing nodes when generating | ||
run!("missing_annotation": "foo.capnp"); | ||
} |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@0xb8db38b1a3d69f76; | ||
|
||
annotation test(file) :Text; | ||
|
||
annotation unused(file) :Text; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@0xb782057765b9e46e; | ||
|
||
# Add a test annotation, but don't use the "unused" annotation. It should be missing in the | ||
# CodeGeneratorRequest and originally caused an error to occur in the code generator. | ||
$import "annotate.capnp".test("hi!"); | ||
|
||
struct Foo {} | ||
|
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