This repository was archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DRYing build scripts #1795
Merged
Merged
DRYing build scripts #1795
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f7b7d31
fix nano interface
NikVolf 7b72463
Merge branch 'master' into ipc-nano-tests
NikVolf 1732cc7
add nano tests to target
NikVolf 86db5c0
drying tests
NikVolf d8a3137
drying ethcore
NikVolf 1809961
drying hypervisor
NikVolf fbfcd48
drying sync
NikVolf 62df81f
add dot
NikVolf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ authors = ["Ethcore <[email protected]>"] | |
build = "build.rs" | ||
|
||
[build-dependencies] | ||
syntex = "*" | ||
"ethcore-ipc-codegen" = { path = "../ipc/codegen" } | ||
|
||
[dependencies] | ||
|
@@ -35,7 +34,6 @@ ethcore-ipc = { path = "../ipc/rpc" } | |
ethstore = { path = "../ethstore" } | ||
ethcore-ipc-nano = { path = "../ipc/nano" } | ||
|
||
|
||
[dependencies.hyper] | ||
git = "https://github.com/ethcore/hyper" | ||
default-features = false | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,3 +95,58 @@ pub fn register(reg: &mut rustc_plugin::Registry) { | |
|
||
reg.register_attribute("ipc".to_owned(), AttributeType::Normal); | ||
} | ||
|
||
#[derive(Debug)] | ||
pub enum Error { InvalidFileName, ExpandFailure } | ||
|
||
pub fn derive_ipc(src_path: &str) -> Result<(), Error> { | ||
use std::env; | ||
use std::path::{Path, PathBuf}; | ||
|
||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
let file_name = try!(PathBuf::from(src_path).file_name().ok_or(Error::InvalidFileName).map(|val| val.to_str().unwrap().to_owned())); | ||
|
||
let mut intermediate_file_name = file_name.clone(); | ||
intermediate_file_name.push_str("rpc.in"); | ||
|
||
let intermediate_path = Path::new(&out_dir).join(&intermediate_file_name); | ||
let final_path = Path::new(&out_dir).join(&file_name); | ||
|
||
{ | ||
let mut registry = syntex::Registry::new(); | ||
register(&mut registry); | ||
if let Err(_) = registry.expand("", &Path::new(src_path), &intermediate_path) { | ||
// will be reported by compiler | ||
return Err(Error::ExpandFailure) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth nesting original error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think syntex now prints diagnostics in the stderr, so this error does not matter --- stderr
with_attrs.rs.in:32:41: 32:41 error: this file contains an un-closed delimiter
with_attrs.rs.in:32 impl IpcConfig for BadlyNamedService {}
^
with_attrs.rs.in:26:24: 26:25 help: did you mean to close this delimiter?
with_attrs.rs.in:26 impl BadlyNamedService { |
||
} | ||
} | ||
|
||
{ | ||
let mut registry = syntex::Registry::new(); | ||
register(&mut registry); | ||
if let Err(_) = registry.expand("", &intermediate_path, &final_path) { | ||
// will be reported by compiler | ||
return Err(Error::ExpandFailure) | ||
} | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn derive_binary(src_path: &str) -> Result<(), Error> { | ||
use std::env; | ||
use std::path::{Path, PathBuf}; | ||
|
||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
let file_name = try!(PathBuf::from(src_path).file_name().ok_or(Error::InvalidFileName).map(|val| val.to_str().unwrap().to_owned())); | ||
let final_path = Path::new(&out_dir).join(&file_name); | ||
|
||
let mut registry = syntex::Registry::new(); | ||
register(&mut registry); | ||
if let Err(_) = registry.expand("", &Path::new(src_path), &final_path) { | ||
// will be reported by compiler | ||
return Err(Error::ExpandFailure) | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,4 @@ semver = "0.2" | |
log = "0.3" | ||
|
||
[build-dependencies] | ||
syntex = "*" | ||
ethcore-ipc-codegen = { path = "../codegen" } |
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
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ export TARGETS=" | |
-p ethsync \ | ||
-p ethcore-ipc \ | ||
-p ethcore-ipc-tests \ | ||
-p ethcore-ipc-nano \ | ||
-p parity" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
.rpc.in
? (will result intraits.rs.rpc.in
for instance)