-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Move common build code to sails-builder
- Loading branch information
Showing
12 changed files
with
141 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,65 @@ | ||
[workspace.package] | ||
version = "0.0.1" | ||
authors = ["Gear Technologies"] | ||
edition = "2021" | ||
license = "GPL-3.0" | ||
|
||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"client-gen", | ||
"examples/puppeteer/app", | ||
"examples/puppeteer/wasm", | ||
"examples/rmrk/catalog/app", | ||
"examples/rmrk/catalog/wasm", | ||
"examples/rmrk/resource/app", | ||
"examples/rmrk/resource/wasm", | ||
"examples/this-that-svc/app", | ||
"examples/this-that-svc/wasm", | ||
"idl-meta", | ||
"idlgen", | ||
"idlparser", | ||
"macros", | ||
"macros/core", | ||
"rtl", | ||
] | ||
|
||
[workspace.dependencies] | ||
anyhow = "1" | ||
convert-case = { package = "convert_case", version = "0.6" } | ||
futures = { version = "0.3", default-features = false } | ||
gear-core-errors = "1.1.1" | ||
git-download = "0.1" | ||
gstd = "1.1.1" | ||
gtest = "1.1.1" | ||
gwasm-builder = { package = "gear-wasm-builder", version = "1.1.1" } | ||
handlebars = "4.4" | ||
hashbrown = "0.14" | ||
hex = { version = "0.4", default-features = false } | ||
insta = "1.34" | ||
itertools = "0.12" | ||
lalrpop = { version = "0.20", default-features = false } | ||
lalrpop-util = "0.20" | ||
logos = "0.13" | ||
parity-scale-codec = { version = "3.6", default-features = false } | ||
prettyplease = "0.2" | ||
proc-macro-error = "1.0" | ||
proc-macro2 = { version = "1", default-features = false } | ||
quote = "1.0" | ||
sails-clientgen = { path = "client-gen" } | ||
sails-exec-context-gstd = { path = "exec-context/gstd" } | ||
sails-idl-meta = { path = "idl-meta" } | ||
sails-idlgen = { path = "idlgen" } | ||
sails-idlparser = { path = "idlparser" } | ||
sails-macros = { path = "macros" } | ||
sails-rtl = { path = "rtl" } | ||
scale-info = { version = "2.10", default-features = false } | ||
serde = "1.0" | ||
serde-json = { package = "serde_json", version = "1.0" } | ||
syn = "2.0" | ||
thiserror = "1.0" | ||
thiserror-no-std = "2.0" | ||
tokio = "1.36" | ||
trybuild = "1" | ||
[workspace.package] | ||
version = "0.0.1" | ||
authors = ["Gear Technologies"] | ||
edition = "2021" | ||
license = "GPL-3.0" | ||
|
||
[workspace] | ||
members = [ | ||
"builder", | ||
"client-gen", | ||
"examples/puppeteer/app", | ||
"examples/puppeteer/wasm", | ||
"examples/rmrk/catalog/app", | ||
"examples/rmrk/catalog/wasm", | ||
"examples/rmrk/resource/app", | ||
"examples/rmrk/resource/wasm", | ||
"examples/this-that-svc/app", | ||
"examples/this-that-svc/wasm", | ||
"idl-meta", | ||
"idlgen", | ||
"idlparser", | ||
"macros", | ||
"macros/core", | ||
"rtl", | ||
] | ||
resolver = "2" | ||
|
||
[workspace.dependencies] | ||
anyhow = "1" | ||
convert-case = { package = "convert_case", version = "0.6" } | ||
futures = { version = "0.3", default-features = false } | ||
gear-core-errors = "1.1.1" | ||
git-download = "0.1" | ||
gstd = "1.1.1" | ||
gtest = "1.1.1" | ||
gwasm-builder = { package = "gear-wasm-builder", version = "1.1.1" } | ||
handlebars = "4.4" | ||
hashbrown = "0.14" | ||
hex = { version = "0.4", default-features = false } | ||
insta = "1.34" | ||
itertools = "0.12" | ||
lalrpop = { version = "0.20", default-features = false } | ||
lalrpop-util = "0.20" | ||
logos = "0.13" | ||
parity-scale-codec = { version = "3.6", default-features = false } | ||
prettyplease = "0.2" | ||
proc-macro-error = "1.0" | ||
proc-macro2 = { version = "1", default-features = false } | ||
quote = "1.0" | ||
sails-builder = { path = "builder" } | ||
sails-clientgen = { path = "client-gen" } | ||
sails-exec-context-gstd = { path = "exec-context/gstd" } | ||
sails-idl-meta = { path = "idl-meta" } | ||
sails-idlgen = { path = "idlgen" } | ||
sails-idlparser = { path = "idlparser" } | ||
sails-macros = { path = "macros" } | ||
sails-rtl = { path = "rtl" } | ||
scale-info = { version = "2.10", default-features = false } | ||
serde = "1.0" | ||
serde-json = { package = "serde_json", version = "1.0" } | ||
syn = "2.0" | ||
thiserror = "1.0" | ||
thiserror-no-std = "2.0" | ||
tokio = "1.36" | ||
trybuild = "1" |
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,13 @@ | ||
[package] | ||
name = "sails-builder" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
sails-idlgen.workspace = true | ||
gwasm-builder.workspace = true | ||
sails-idl-meta.workspace = true |
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,37 @@ | ||
use sails_idl_meta::{ProgramMeta, ServiceMeta}; | ||
use std::{env, fs::File, path::PathBuf}; | ||
|
||
pub struct Builder { | ||
idl_file_path: PathBuf, | ||
} | ||
|
||
impl Builder { | ||
pub fn new() -> Self { | ||
let pkg_name = env::var("CARGO_PKG_NAME").unwrap(); | ||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
|
||
let idl_file_path = PathBuf::from(manifest_dir).join(format!("{}.idl", pkg_name)); | ||
|
||
Self { idl_file_path } | ||
} | ||
|
||
pub fn build(self) -> Self { | ||
gwasm_builder::build(); | ||
|
||
self | ||
} | ||
|
||
pub fn generate_service_idl<S: ServiceMeta>(self) -> Self { | ||
let idl_file = File::create(&self.idl_file_path).unwrap(); | ||
sails_idlgen::service::generate_idl::<S>(idl_file).unwrap(); | ||
|
||
self | ||
} | ||
|
||
pub fn generate_program_idl<P: ProgramMeta>(self) -> Self { | ||
let idl_file = File::create(&self.idl_file_path).unwrap(); | ||
sails_idlgen::program::generate_idl::<P>(idl_file).unwrap(); | ||
|
||
self | ||
} | ||
} |
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,3 +1,5 @@ | ||
use sails_builder::Builder; | ||
|
||
fn main() { | ||
gwasm_builder::build(); | ||
Builder::new().build(); | ||
} |
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,15 +1,6 @@ | ||
use rmrk_catalog_app::Program; | ||
use sails_idlgen::program; | ||
use std::{env, fs::File, path::PathBuf}; | ||
use sails_builder::Builder; | ||
|
||
fn main() { | ||
gwasm_builder::build(); | ||
|
||
let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
|
||
let idl_file_path = manifest_dir_path.join("rmrk-catalog.idl"); | ||
|
||
let idl_file = File::create(idl_file_path).unwrap(); | ||
|
||
program::generate_idl::<Program>(idl_file).unwrap(); | ||
Builder::new().build().generate_program_idl::<Program>(); | ||
} |
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,15 +1,6 @@ | ||
use rmrk_resource_app::Program; | ||
use sails_idlgen::program; | ||
use std::{env, fs::File, path::PathBuf}; | ||
use sails_builder::Builder; | ||
|
||
fn main() { | ||
gwasm_builder::build(); | ||
|
||
let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
|
||
let idl_file_path = manifest_dir_path.join("rmrk-resource.idl"); | ||
|
||
let idl_file = File::create(idl_file_path).unwrap(); | ||
|
||
program::generate_idl::<Program>(idl_file).unwrap(); | ||
Builder::new().build().generate_program_idl::<Program>(); | ||
} |
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,15 +1,6 @@ | ||
use sails_idlgen::service; | ||
use std::{env, fs::File, path::PathBuf}; | ||
use this_that_svc_app::MyService; | ||
use sails_builder::Builder; | ||
|
||
fn main() { | ||
gwasm_builder::build(); | ||
|
||
let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
|
||
let idl_file_path = manifest_dir_path.join("this-that-svc.idl"); | ||
|
||
let idl_file = File::create(idl_file_path).unwrap(); | ||
|
||
service::generate_idl::<MyService>(idl_file).unwrap(); | ||
Builder::new().build().generate_service_idl::<MyService>(); | ||
} |