Files
revive/crates/llvm-builder/tests/common.rs
T
Cyrill Leutwiler 7f81f37e0c revive llvm builder utility (#154)
Pre-eliminary support for LLVM releases and resolc binary releases by streamlining the build process for all supported hosts platforms.

- Introduce the revive-llvm-builder crate with the revive-llvm builder utilty.
- Do not rely on the LLVM dependency in $PATH to decouple the system LLVM installation from the LLVM host dependency.
- Fix the emscripten build by decoupling the host and native LLVM dependencies. Thus allowing a single LLVM emscripten release that can be used on any host platform.
- An example Dockerfile building an alpine container with a fully statically linked resolc ELF binary.
- Remove the Debian builder utilities and workflow.
2025-01-13 15:58:27 +01:00

37 lines
1.1 KiB
Rust

use assert_fs::fixture::FileWriteStr;
pub const REVIVE_LLVM: &str = "revive-llvm";
pub const REVIVE_LLVM_REPO_URL: &str = "https://github.com/llvm/llvm-project";
pub const REVIVE_LLVM_REPO_TEST_BRANCH: &str = "release/18.x";
pub struct TestDir {
_lockfile: assert_fs::NamedTempFile,
path: std::path::PathBuf,
}
/// Creates a temporary lock file for testing.
impl TestDir {
pub fn with_lockfile(reference: Option<String>) -> anyhow::Result<Self> {
let file =
assert_fs::NamedTempFile::new(revive_llvm_builder::lock::LLVM_LOCK_DEFAULT_PATH)?;
let lock = revive_llvm_builder::Lock {
url: REVIVE_LLVM_REPO_URL.to_string(),
branch: REVIVE_LLVM_REPO_TEST_BRANCH.to_string(),
r#ref: reference,
};
file.write_str(toml::to_string(&lock)?.as_str())?;
Ok(Self {
path: file
.parent()
.expect("lockfile parent dir always exists")
.into(),
_lockfile: file,
})
}
pub fn path(&self) -> &std::path::Path {
&self.path
}
}