mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-22 08:01:47 +03:00
build: use new script in build-release.py
This commit is contained in:
parent
92ab3cafa9
commit
b6382e0190
14
README.md
14
README.md
@ -33,9 +33,6 @@ git clone git@github.com:kinode-dao/kinode.git
|
|||||||
cd kinode
|
cd kinode
|
||||||
cargo install wasm-tools
|
cargo install wasm-tools
|
||||||
rustup install nightly
|
rustup install nightly
|
||||||
rustup target add wasm32-wasi
|
|
||||||
rustup target add wasm32-wasi --toolchain nightly
|
|
||||||
rustup target add wasm32-wasip1
|
|
||||||
rustup target add wasm32-wasip1 --toolchain nightly
|
rustup target add wasm32-wasip1 --toolchain nightly
|
||||||
cargo install cargo-wasi
|
cargo install cargo-wasi
|
||||||
|
|
||||||
@ -43,11 +40,14 @@ cargo install cargo-wasi
|
|||||||
# https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
|
# https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
|
||||||
# If you want to skip this step, run cargo build with the environment variable SKIP_BUILD_FRONTEND=true
|
# If you want to skip this step, run cargo build with the environment variable SKIP_BUILD_FRONTEND=true
|
||||||
|
|
||||||
# Build the runtime, along with a number of "distro" Wasm modules.
|
# Build the "distro" Wasm modules.
|
||||||
# The compiled binary will be at `kinode/target/debug/kinode`
|
# Then, build the runtime.
|
||||||
# OPTIONAL: --release flag (slower build; faster runtime; binary at `kinode/target/release/kinode`)
|
# The compiled packages will be at `kinode/target/packages.zip`.
|
||||||
|
# The compiled binary will be at `kinode/target/debug/kinode`.
|
||||||
|
# OPTIONAL: --release flag (slower build; faster runtime; binary at `kinode/target/release/kinode`).
|
||||||
|
|
||||||
cargo +nightly build -p kinode
|
cargo run -p build_packages
|
||||||
|
cargo build -p kinode
|
||||||
```
|
```
|
||||||
|
|
||||||
## Security Status
|
## Security Status
|
||||||
|
@ -27,14 +27,39 @@ def build_and_move(feature, tmp_dir, architecture, os_name):
|
|||||||
|
|
||||||
zip_prefix = f"kinode-{architecture}-{os_name}"
|
zip_prefix = f"kinode-{architecture}-{os_name}"
|
||||||
release_env = os.environ.copy()
|
release_env = os.environ.copy()
|
||||||
release_env["CARGO_PROFILE_RELEASE_LTO"] = f"fat"
|
release_env["CARGO_PROFILE_RELEASE_LTO"] = "fat"
|
||||||
release_env["CARGO_PROFILE_RELEASE_CODEGEN_UNITS"] = f"1"
|
release_env["CARGO_PROFILE_RELEASE_CODEGEN_UNITS"] = "1"
|
||||||
release_env["CARGO_PROFILE_RELEASE_STRIP"] = f"symbols"
|
release_env["CARGO_PROFILE_RELEASE_STRIP"] = "symbols"
|
||||||
if feature:
|
if feature:
|
||||||
subprocess.run(["cargo", "+nightly", "build", "--release", "-p", "kinode", "--features", feature], check=True, env=release_env)
|
release_env["PATH_TO_PACKAGES_ZIP"] = f"../target/packages-{feature}.zip"
|
||||||
|
subprocess.run(
|
||||||
|
["cargo", "run", "-p", "build_packages", "--", "--features", feature],
|
||||||
|
check=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
subprocess.run(
|
||||||
|
["cargo", "build", "--release", "-p", "kinode", "--features", feature],
|
||||||
|
check=True,
|
||||||
|
env=release_env,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
zip_name = f"{zip_prefix}-{feature}.zip"
|
zip_name = f"{zip_prefix}-{feature}.zip"
|
||||||
else:
|
else:
|
||||||
subprocess.run(["cargo", "+nightly", "build", "--release", "-p", "kinode"], check=True, env=release_env)
|
subprocess.run(
|
||||||
|
["cargo", "run", "-p", "build_packages"],
|
||||||
|
check=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
subprocess.run(
|
||||||
|
["cargo", "build", "--release", "-p", "kinode"],
|
||||||
|
check=True,
|
||||||
|
env=release_env,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
zip_name = f"{zip_prefix}.zip"
|
zip_name = f"{zip_prefix}.zip"
|
||||||
|
|
||||||
# Move and rename the binary
|
# Move and rename the binary
|
||||||
@ -74,4 +99,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -84,6 +84,12 @@ fn main() -> anyhow::Result<()> {
|
|||||||
.help("Skip building the frontend")
|
.help("Skip building the frontend")
|
||||||
.action(clap::ArgAction::SetTrue),
|
.action(clap::ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("OUTPUT_FILENAME")
|
||||||
|
.long("output-filename")
|
||||||
|
.help("Set output filename (default: packages-{features}.zip)")
|
||||||
|
.action(clap::ArgAction::Set),
|
||||||
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
// kinode/target/debug/build_package
|
// kinode/target/debug/build_package
|
||||||
@ -126,12 +132,13 @@ fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let features = matches
|
let mut features = matches
|
||||||
.get_many::<String>("FEATURES")
|
.get_many::<String>("FEATURES")
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.map(|s| s.to_owned())
|
.map(|s| s.to_owned())
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>();
|
||||||
.join(",");
|
features.sort();
|
||||||
|
let features = features.join(",");
|
||||||
|
|
||||||
let results: Vec<anyhow::Result<(PathBuf, String, Vec<u8>)>> = fs::read_dir(&packages_dir)?
|
let results: Vec<anyhow::Result<(PathBuf, String, Vec<u8>)>> = fs::read_dir(&packages_dir)?
|
||||||
.filter_map(|entry| {
|
.filter_map(|entry| {
|
||||||
@ -182,7 +189,17 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let file_to_metadata_path = target_packages_dir.join("file_to_metadata.json");
|
let file_to_metadata_path = target_packages_dir.join("file_to_metadata.json");
|
||||||
fs::write(&file_to_metadata_path, file_to_metadata)?;
|
fs::write(&file_to_metadata_path, file_to_metadata)?;
|
||||||
|
|
||||||
let package_zip_path = target_dir.join("packages.zip");
|
let package_zip_file_name = match matches.get_one::<String>("OUTPUT_FILENAME") {
|
||||||
|
Some(filename) => filename.to_string(),
|
||||||
|
None => {
|
||||||
|
if features.is_empty() {
|
||||||
|
"packages.zip".to_string()
|
||||||
|
} else {
|
||||||
|
format!("packages-{features}.zip")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let package_zip_path = target_dir.join(package_zip_file_name);
|
||||||
let package_zip_contents = zip_directory(&target_packages_dir)?;
|
let package_zip_contents = zip_directory(&target_packages_dir)?;
|
||||||
fs::write(package_zip_path, package_zip_contents)?;
|
fs::write(package_zip_path, package_zip_contents)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user