Files
ore/program/build.rs
Fernando Otero 07d8b4cedd Add Codama IDL to program binary (#105)
* Add Codama IDL

* Add IDL to program binary

* Update dependency

* Use published crate

---------

Co-authored-by: Hardhat Chad <155858888+HardhatChad@users.noreply.github.com>
2024-11-01 17:00:49 -05:00

19 lines
585 B
Rust

use std::env;
use std::path::PathBuf;
use solana_include_idl::compress_idl;
/// Build script to compress the IDL file to a zip file when building the program.
///
/// The compressed IDL is then included in a separate ELF section on the program binary
/// when the program is built.
fn main() {
// Get the IDL path.
let idl_path = PathBuf::from("../api").join("idl.json");
// Compress the IDL file to a zip file.
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = PathBuf::from(out_dir).join("codama.idl.zip");
compress_idl(&idl_path, &dest_path);
}