2023-12-09 20:56:41 +03:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
def build_and_move(feature, tmp_dir):
|
|
|
|
print("\n" + "=" * 50)
|
|
|
|
print(f"BUILDING {feature if feature else 'default'}")
|
|
|
|
print("=" * 50 + "\n")
|
|
|
|
|
|
|
|
if feature:
|
|
|
|
subprocess.run(["cargo", "+nightly", "build", "--release", "--features", feature], check=True)
|
2024-01-08 23:02:14 +03:00
|
|
|
binary_name = f"nectar-{feature}"
|
2023-12-09 20:56:41 +03:00
|
|
|
else:
|
|
|
|
subprocess.run(["cargo", "+nightly", "build", "--release"], check=True)
|
2024-01-08 23:02:14 +03:00
|
|
|
binary_name = "nectar"
|
2023-12-09 20:56:41 +03:00
|
|
|
|
|
|
|
# Move and rename the binary
|
2024-01-08 23:02:14 +03:00
|
|
|
source_path = "target/release/nectar"
|
2023-12-09 20:56:41 +03:00
|
|
|
dest_path = os.path.join(tmp_dir, binary_name)
|
|
|
|
shutil.move(source_path, dest_path)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
# Features to compile with
|
|
|
|
features = ["", "simulation-mode"] # Add more features as needed
|
|
|
|
|
|
|
|
# Ensure the tmp directory is clean
|
2024-01-08 23:02:14 +03:00
|
|
|
tmp_dir = "/tmp/nectar-release"
|
2023-12-09 20:56:41 +03:00
|
|
|
if os.path.exists(tmp_dir):
|
|
|
|
shutil.rmtree(tmp_dir)
|
|
|
|
os.makedirs(tmp_dir)
|
|
|
|
|
|
|
|
# Loop through the features and build
|
|
|
|
for feature in features:
|
|
|
|
build_and_move(feature, tmp_dir)
|
|
|
|
|
2023-12-22 03:12:01 +03:00
|
|
|
print(f"Build and move process completed.\nFind release in {tmp_dir}.")
|
2023-12-09 20:56:41 +03:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
|
|
|
|