-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
schema-version = 1 | ||
release-version = "1.0.0" | ||
|
||
[sdk] | ||
registry = "twoliter.alpha" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
use crate::cargo_make::CargoMake; | ||
use crate::project; | ||
use crate::tools; | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Debug, Parser)] | ||
pub(crate) struct BuildClean { | ||
/// Path to Twoliter.toml. Will search for Twoliter.toml when absent. | ||
#[clap(long = "project-path")] | ||
project_path: Option<PathBuf>, | ||
// /// The architecture to build for. | ||
// #[clap(long = "arch", default_value = "x86_64")] | ||
// arch: String, | ||
// | ||
// /// The kit to build. | ||
// name: String, | ||
// | ||
// /// The URL to the lookaside cache where sources are stored to avoid pulling them from upstream. | ||
// /// Defaults to https://cache.bottlerocket.aws | ||
// lookaside_cache: Option<String>, | ||
// /// If sources are not found in the lookaside cache, this flag will cause buildsys to pull them | ||
// /// from the upstream URL found in a package's `Cargo.toml`. | ||
// #[clap(long = "upstream-source-fallback")] | ||
// upstream_source_fallback: bool, | ||
} | ||
|
||
impl BuildClean { | ||
pub(super) async fn run(&self) -> Result<()> { | ||
let project = project::load_or_find_project(self.project_path.clone()).await?; | ||
let toolsdir = project.project_dir().join("build/tools"); | ||
tools::install_tools(&toolsdir).await?; | ||
let makefile_path = toolsdir.join("Makefile.toml"); | ||
|
||
CargoMake::new(&project)? | ||
.env("TWOLITER_TOOLS_DIR", toolsdir.display().to_string()) | ||
// .env("BUILDSYS_ARCH", &self.arch) | ||
// .env("BUILDSYS_VARIANT", &self.variant) | ||
// .env("BUILDSYS_SBKEYS_DIR", sbkeys_dir.display().to_string()) | ||
// .env("BUILDSYS_VERSION_IMAGE", project.release_version()) | ||
// .env("GO_MODULES", project.find_go_modules().await?.join(" ")) | ||
// .env("TLPRIVATE_KIT_NAME", &self.name) | ||
// .env( | ||
// "BUILDSYS_UPSTREAM_SOURCE_FALLBACK", | ||
// self.upstream_source_fallback.to_string(), | ||
// ) | ||
// .envs(optional_envs.into_iter()) | ||
.makefile(makefile_path) | ||
.project_dir(project.project_dir()) | ||
.exec("clean") | ||
.await?; | ||
|
||
Ok(()) | ||
|
||
// let mut envs = Vec::new(); | ||
|
||
// if let Some(lookaside_cache) = &self.lookaside_cache { | ||
// optional_envs.push(("BUILDSYS_LOOKASIDE_CACHE", lookaside_cache)) | ||
// } | ||
// | ||
// // Hold the result of the cargo make call so we can clean up the project directory first. | ||
// let res = CargoMake::new(&project, &self.arch)? | ||
// .env("TWOLITER_TOOLS_DIR", toolsdir.display().to_string()) | ||
// .env("BUILDSYS_ARCH", &self.arch) | ||
// .env("BUILDSYS_VARIANT", &self.variant) | ||
// .env("BUILDSYS_SBKEYS_DIR", sbkeys_dir.display().to_string()) | ||
// .env("BUILDSYS_VERSION_IMAGE", project.release_version()) | ||
// .env("GO_MODULES", project.find_go_modules().await?.join(" ")) | ||
// .env( | ||
// "BUILDSYS_UPSTREAM_SOURCE_FALLBACK", | ||
// self.upstream_source_fallback.to_string(), | ||
// ) | ||
// .envs(optional_envs.into_iter()) | ||
// .makefile(makefile_path) | ||
// .project_dir(project.project_dir()) | ||
// .exec("build") | ||
// .await; | ||
// | ||
// // Clean up all of the files we created | ||
// for file_name in created_files { | ||
// let added = Path::new(&file_name); | ||
// if added.is_file() { | ||
// fs::remove_file(added).await?; | ||
// } else if added.is_dir() { | ||
// fs::remove_dir_all(added).await?; | ||
// } | ||
// } | ||
// | ||
// res | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod build; | ||
mod build_clean; | ||
mod debug; | ||
mod make; | ||
|
||
|