Skip to content

Commit

Permalink
Added odra-build crate.
Browse files Browse the repository at this point in the history
Bumped version to 0.8.1.
  • Loading branch information
kubaplas committed Feb 26, 2024
1 parent b2ff2db commit 70ae2eb
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 46 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

Changelog for `odra`.

## [0.9.0] - 2024-XX-XX
## [0.8.1] - 2024-XX-XX
### Added
- `ContractRef` trait with `new` and `address` functions. All contract references now implement it.
- `odra-build` crate for including the code in contract's build.rs file.

### Changed
- Traits implemented by modules are now also implemented by their `ContractRefs` and `HostRefs`.

## [0.8.0] - 2024-XX-XX
## [0.8.0] - 2024-02-06

### Changed
- Replaced `contract_env::` with `self.env()` in the contract context (of type `ContractEnv`).
Expand Down
18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ members = [
"odra-casper/livenet-env",
"odra-casper/wasm-env",
"odra-casper/test-vm",
"odra-test"]
"odra-test",
"odra-build"
]
exclude = [ "examples", "modules", "benchmark", "odra-casper/proxy-caller", "templates/blank", "templates/full", "templates/workspace", "tests"]
resolver = "2"

[workspace.package]
version = "0.8.0"
version = "0.8.1"
authors = ["Jakub Płaskonka <kuba@odra.dev>", "Krzysztof Pobiarżyn <krzysztof@odra.dev>", "Maciej Zieliński <maciej@odra.dev>"]
license = "MIT"
homepage = "https://odra.dev/docs"
repository = "https://github.com/odradev/odra"

[workspace.dependencies]
odra-core = { path = "core", version = "0.8.0" }
odra-macros = { path = "odra-macros", version = "0.8.0" }
odra-casper-test-vm = { path = "odra-casper/test-vm", version = "0.8.0" }
odra-casper-rpc-client = { path = "odra-casper/rpc-client", version = "0.8.0" }
odra-vm = { path = "odra-vm", version = "0.8.0" }
odra-casper-wasm-env = { path = "odra-casper/wasm-env", version = "0.8.0"}
odra-core = { path = "core", version = "0.8.1" }
odra-macros = { path = "odra-macros", version = "0.8.1" }
odra-casper-test-vm = { path = "odra-casper/test-vm", version = "0.8.1" }
odra-casper-rpc-client = { path = "odra-casper/rpc-client", version = "0.8.1" }
odra-vm = { path = "odra-vm", version = "0.8.1" }
odra-casper-wasm-env = { path = "odra-casper/wasm-env", version = "0.8.1"}
casper-contract = { version = "3.0.0", default-features = false }
casper-types = { version = "3.0.0", default-features = false }
casper-execution-engine = "5.0.0"
Expand Down
5 changes: 4 additions & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "odra-examples"
version = "0.8.0"
version = "0.8.1"
edition = "2021"

[dependencies]
Expand All @@ -13,6 +13,9 @@ odra-casper-livenet-env = { path = "../odra-casper/livenet-env", optional = true
odra-test = { path = "../odra-test" }
hex = "0.4.3"

[build-dependencies]
odra-build = { path = "../odra-build" }

[features]
default = []
livenet = ["odra-casper-livenet-env"]
Expand Down
6 changes: 1 addition & 5 deletions examples/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
//! Odra's contracts build script.
use std::env;
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CARGO_ODRA_GIT_REPO := "https://github.com/odradev/cargo-odra"
CARGO_ODRA_BRANCH := "release/0.1.0"
CARGO_ODRA_BRANCH := "feature/build-dependency"
BINARYEN_VERSION := "version_116"
BINARYEN_CHECKSUM := "c55b74f3109cdae97490faf089b0286d3bba926bb6ea5ed00c8c784fc53718fd"

Expand Down
9 changes: 6 additions & 3 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "odra-modules"
version = "0.8.0"
version = "0.8.1"
edition = "2021"
authors = ["Jakub Płaskonka <kuba@odra.dev>", "Krzysztof Pobiarżyn <krzysztof@odra.dev>", "Maciej Zieliński <maciej@odra.dev>"]
license = "MIT"
Expand All @@ -10,11 +10,14 @@ keywords = ["wasm", "webassembly", "blockchain"]
categories = ["wasm"]

[dependencies]
odra = { path = "../odra", version = "0.8.0", default-features = false }
odra = { path = "../odra", version = "0.8.1", default-features = false }
hex = { version = "0.4.3", default-features = false }

[dev-dependencies]
odra-test = { path = "../odra-test", version = "0.8.0" }
odra-test = { path = "../odra-test", version = "0.8.1" }

[build-dependencies]
odra-build = { path = "../odra-build", version = "0.8.1" }

[[bin]]
name = "odra_modules_build_contract"
Expand Down
6 changes: 1 addition & 5 deletions modules/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
//! Odra's contracts build script.
use std::env;
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}
9 changes: 9 additions & 0 deletions odra-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "odra-build"
description = "Function used in build.rs files of Odra projects"
edition = "2021"
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
6 changes: 6 additions & 0 deletions odra-build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub fn build() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = std::env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
}

Check warning on line 6 in odra-build/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

odra-build/src/lib.rs#L1-L6

Added lines #L1 - L6 were not covered by tests
2 changes: 1 addition & 1 deletion odra-casper/proxy-caller/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "odra-casper-proxy-caller"
edition = "2021"
version = "0.8.0"
version = "0.8.1"
authors = ["Jakub Płaskonka <kuba@odra.dev>", "Krzysztof Pobiarżyn <krzysztof@odra.dev>", "Maciej Zieliński <maciej@odra.dev>"]
license = "MIT"
homepage = "https://odra.dev/docs"
Expand Down
3 changes: 3 additions & 0 deletions templates/blank/_Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ edition = "2021"
[dev-dependencies]
#odra_test_dependency

[build-dependencies]
#odra_build_dependency

[[bin]]
name = "{{project-name}}_build_contract"
path = "bin/build_contract.rs"
Expand Down
8 changes: 3 additions & 5 deletions templates/blank/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::env;
//! Odra's contracts build script.
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}
3 changes: 3 additions & 0 deletions templates/full/_Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ edition = "2021"
[dev-dependencies]
#odra_test_dependency

[build-dependencies]
#odra_build_dependency

[[bin]]
name = "{{project-name}}_build_contract"
path = "bin/build_contract.rs"
Expand Down
8 changes: 3 additions & 5 deletions templates/full/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::env;
//! Odra's contracts build script.
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}
1 change: 1 addition & 0 deletions templates/workspace/_Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ resolver = "2"
[workspace.dependencies]
#odra_dependency
#odra_test_dependency
#odra_build_dependency

[profile.release]
codegen-units = 1
Expand Down
3 changes: 3 additions & 0 deletions templates/workspace/flapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ odra = { workspace = true }
[dev-dependencies]
odra-test = { workspace = true }

[build-dependencies]
odra-build = { workspace = true }

[[bin]]
name = "flapper_build_contract"
path = "bin/build_contract.rs"
Expand Down
8 changes: 3 additions & 5 deletions templates/workspace/flapper/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::env;
//! Odra's contracts build script.
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}
3 changes: 3 additions & 0 deletions templates/workspace/flipper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ odra = { workspace = true }
[dev-dependencies]
odra-test = { workspace = true }

[build-dependencies]
odra-build = { workspace = true }

[[bin]]
name = "flipper_build_contract"
path = "bin/build_contract.rs"
Expand Down
8 changes: 3 additions & 5 deletions templates/workspace/flipper/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::env;
//! Odra's contracts build script.
/// Uses the ENV variable `ODRA_MODULE` to set the `odra_module` cfg flag.
pub fn main() {
println!("cargo:rerun-if-env-changed=ODRA_MODULE");
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string());
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module);
println!("{}", msg);
odra_build::build();
}

0 comments on commit 70ae2eb

Please sign in to comment.