restructure
Check and Windows preview / check (patina) (push) Successful in 2m20s
Check and Windows preview / check (rivet) (push) Successful in 1m38s
Check and Windows preview / previews (push) Successful in 1m6s
Check and Windows preview / windows (push) Successful in 1m50s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 2m21s
Check and Windows preview / check (patina) (push) Successful in 2m20s
Check and Windows preview / check (rivet) (push) Successful in 1m38s
Check and Windows preview / previews (push) Successful in 1m6s
Check and Windows preview / windows (push) Successful in 1m50s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 2m21s
This commit is contained in:
1 parent
3c5b05fdec
commit
15853e61ac
87 files changed
+2065
-1198
No files matched your search
+24
-19
@@ -1,48 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build and package CLAP without modifying a DAW's plugin directories."""
|
||||
"""Build a catalogued CLAP plugin without modifying a DAW installation."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
catalog = json.loads((root / "plugins/catalog.json").read_text())
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--plugin", choices=["motif-storyboard", "resonance-compressor"], default="motif-storyboard", help="Plugin to package")
|
||||
parser.add_argument("--plugin", choices=catalog, default="rivet", help="Plugin to package")
|
||||
parser.add_argument("--target", help="Rust target triple; defaults to rustc's host")
|
||||
parser.add_argument("--standalone", action="store_true", help="Also build the standalone preview app")
|
||||
parser.add_argument("--standalone", action="store_true", help="Also build Rivet's standalone preview")
|
||||
args = parser.parse_args()
|
||||
product = catalog[args.plugin]
|
||||
target = args.target
|
||||
if target is None:
|
||||
info = subprocess.check_output(["rustc", "-vV"], text=True)
|
||||
target = next(line.removeprefix("host: ") for line in info.splitlines() if line.startswith("host: "))
|
||||
if "windows" not in target and "linux" not in target:
|
||||
parser.error("This milestone packages Windows and Linux only.")
|
||||
if args.standalone and args.plugin != "motif-storyboard":
|
||||
parser.error("Standalone is available only for Motif Storyboard.")
|
||||
manifest = root / "plugins" / args.plugin / "Cargo.toml"
|
||||
parser.error("Packaging supports Windows releases and native Linux development builds.")
|
||||
if args.standalone and "standalone" not in product:
|
||||
parser.error(f"{product['name']} has no standalone application.")
|
||||
manifest = root / product["manifest"]
|
||||
cmd = ["cargo", "build", "--manifest-path", str(manifest), "--release", "--locked", "--target", target, "--lib"]
|
||||
if args.standalone:
|
||||
cmd += ["--features", "standalone", "--bin", "motif-storyboard"]
|
||||
cmd += ["--features", "standalone", "--bin", product["standalone"]]
|
||||
subprocess.run(cmd, cwd=root, check=True)
|
||||
target_root = Path(os.environ.get("CARGO_TARGET_DIR", root / "plugins" / args.plugin / "target"))
|
||||
target_root = Path(os.environ.get("CARGO_TARGET_DIR", manifest.parent / "target"))
|
||||
if not target_root.is_absolute():
|
||||
target_root = root / target_root
|
||||
build = target_root / target / "release"
|
||||
destination = root / "dist" / target
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
stem = args.plugin.replace("-", "_")
|
||||
stem = product["library"]
|
||||
library = build / (f"{stem}.dll" if "windows" in target else f"lib{stem}.so")
|
||||
display = "Motif Storyboard" if args.plugin == "motif-storyboard" else "Resonance Compressor"
|
||||
plugin = destination / f"{display}.clap"
|
||||
plugin = destination / f"{product['name']}.clap"
|
||||
shutil.copy2(library, plugin)
|
||||
shutil.copy2(root / "LICENSE", destination)
|
||||
guide = "fl-studio.md" if args.plugin == "motif-storyboard" else "resonance-compressor.md"
|
||||
shutil.copy2(root / "docs" / guide, destination / f"{args.plugin}-setup.md")
|
||||
if args.plugin == "resonance-compressor":
|
||||
shutil.copy2(root / "crates/resonance-ui/assets/OFL.txt", destination / "Roboto-OFL.txt")
|
||||
shutil.copy2(root / "docs/resonance-editor.png", destination / "resonance-editor.png")
|
||||
for name in ["LICENSE", "README.md", "docs/development.md", "docs/releases.md"]:
|
||||
output = destination / name
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(root / name, output)
|
||||
shutil.copytree(root / product["documentation"], destination / product["documentation"], dirs_exist_ok=True)
|
||||
for source, name in product.get("licenses", {}).items():
|
||||
output = destination / name
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(root / source, output)
|
||||
if args.standalone:
|
||||
exe = "motif-storyboard.exe" if "windows" in target else "motif-storyboard"
|
||||
exe = product["standalone"] + (".exe" if "windows" in target else "")
|
||||
shutil.copy2(build / exe, destination)
|
||||
print(f"Packaged {plugin}")
|
||||
Reference in new issue
Block a user