4 Commits

Author SHA1 Message Date
46abec1237 Increment version 2026-03-23 11:09:19 -05:00
49eaf6dbfc Enable compilers other than gcc (#6)
issue: #1
Reviewed-on: http://192.168.1.227:3000/sfrembling/pallet/pulls/6
Co-authored-by: godsfryingpan <sfrembling@gmail.com>
Co-committed-by: godsfryingpan <sfrembling@gmail.com>
2026-03-23 10:08:35 -06:00
02009762c1 update PKGBUILD with gcc as dep (#5)
issue: #3
Reviewed-on: http://192.168.1.227:3000/sfrembling/pallet/pulls/5
Co-authored-by: godsfryingpan <sfrembling@gmail.com>
Co-committed-by: godsfryingpan <sfrembling@gmail.com>
2026-03-23 09:57:14 -06:00
e52ad0bc24 add --force-recompile flag (#4)
issue: #2
Reviewed-on: http://192.168.1.227:3000/sfrembling/pallet/pulls/4
Co-authored-by: godsfryingpan <sfrembling@gmail.com>
Co-committed-by: godsfryingpan <sfrembling@gmail.com>
2026-03-23 09:55:03 -06:00
5 changed files with 25 additions and 10 deletions

2
Cargo.lock generated
View File

@@ -247,7 +247,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "pallet"
version = "1.0.5"
version = "1.0.6"
dependencies = [
"clap",
"clap_complete",

View File

@@ -1,6 +1,6 @@
[package]
name = "pallet"
version = "1.0.5"
version = "1.0.6"
edition = "2024"
description = "A project manager and build system for C inspired by Rust's Cargo"

View File

@@ -1,12 +1,12 @@
# Maintainer: Shea Frembling <sfrembling@gmail.com>
pkgname=pallet
pkgver=1.0.5
pkgver=1.0.6
pkgrel=1
pkgdesc="A simple C project manager inspired by Cargo"
arch=('x86_64')
url=""
license=('MIT')
depends=()
depends=('gcc')
makedepends=('rust' 'cargo')
source=()

View File

@@ -29,6 +29,9 @@ enum Subcommand {
Init,
/// Run the local project
Run {
/// Force recompilation of the project
#[arg(long, short)]
force_recompile: bool,
/// The build mode to use
mode: Option<String>,
/// Arguments to pass to the project binary
@@ -37,6 +40,9 @@ enum Subcommand {
},
/// Build the local project
Build {
/// Force recompilation of the project
#[arg(long, short)]
force_recompile: bool,
/// The build mode to use
mode: Option<String>,
},
@@ -86,8 +92,12 @@ impl App {
}
_ => {}
},
Subcommand::Run { mode, args } => {
match build(&mode) {
Subcommand::Run {
mode,
args,
force_recompile,
} => {
match build(&mode, force_recompile) {
Err(e) => {
eprintln!("Error building project: {e}");
std::process::exit(1);
@@ -99,7 +109,10 @@ impl App {
std::process::exit(1);
}
}
Subcommand::Build { mode } => match build(&mode) {
Subcommand::Build {
mode,
force_recompile,
} => match build(&mode, force_recompile) {
Err(e) => {
eprintln!("Error building project: {e}");
std::process::exit(1);
@@ -220,7 +233,7 @@ fn get_config() -> Option<crate::config::Config> {
toml::from_str(&raw).ok()
}
fn build(mode: &Option<String>) -> std::io::Result<()> {
fn build(mode: &Option<String>, force_recompile: bool) -> std::io::Result<()> {
let conf = match get_config() {
Some(conf) => conf,
None => {
@@ -249,7 +262,7 @@ fn build(mode: &Option<String>) -> std::io::Result<()> {
let old_compute_path = PathBuf::from(format!("target/{}/.build_hash", build_config.name));
if old_compute_path.exists() {
if old_compute_path.exists() && !force_recompile {
let text = std::fs::read_to_string(old_compute_path)?;
if hash.trim() == text.trim() {
@@ -261,7 +274,7 @@ fn build(mode: &Option<String>) -> std::io::Result<()> {
}
}
let mut command = Command::new("gcc");
let mut command = Command::new(conf.compiler.as_deref().unwrap_or("gcc"));
for arg in &build_config.args {
command.arg(arg);

View File

@@ -1,5 +1,7 @@
#[derive(serde::Deserialize, serde::Serialize, Default)]
pub struct Config {
/// The C compiler to use (defaults to "gcc")
pub compiler: Option<String>,
/// The name of the output binary
pub name: String,
/// The default build to use