Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cfcd14e0a | |||
| 130525a868 | |||
| a6734c45ab | |||
| b14662a666 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -440,7 +440,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pallet"
|
name = "pallet"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pallet"
|
name = "pallet"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A project manager and build system for C inspired by Rust's Cargo"
|
description = "A project manager and build system for C inspired by Rust's Cargo"
|
||||||
|
|
||||||
|
|||||||
2
PKGBUILD
2
PKGBUILD
@@ -1,6 +1,6 @@
|
|||||||
# Maintainer: Shea Frembling <sfrembling@gmail.com>
|
# Maintainer: Shea Frembling <sfrembling@gmail.com>
|
||||||
pkgname=pallet
|
pkgname=pallet
|
||||||
pkgver=1.1.0
|
pkgver=1.1.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="A simple C project manager inspired by Cargo"
|
pkgdesc="A simple C project manager inspired by Cargo"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
|
|||||||
@@ -72,3 +72,11 @@ args = [
|
|||||||
"-O3",
|
"-O3",
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Creating Changelogs
|
||||||
|
|
||||||
|
Use the following command to create a changelog:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log --oneline (git describe --tags --abbrev=0)..HEAD | sed 's/^/- /' | xclip -selection clipboard
|
||||||
|
```
|
||||||
|
|||||||
19
src/app.rs
19
src/app.rs
@@ -95,6 +95,8 @@ enum UtilSubcommand {
|
|||||||
/// The build mode to generate for
|
/// The build mode to generate for
|
||||||
mode: Option<String>,
|
mode: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Generate the config keys for Pallet.toml
|
||||||
|
GenConfigKeys,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, clap::ValueEnum)]
|
#[derive(Clone, clap::ValueEnum)]
|
||||||
@@ -193,6 +195,15 @@ impl App {
|
|||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UtilSubcommand::GenConfigKeys => {
|
||||||
|
println!(
|
||||||
|
"{} a property with a '?' indicates that the property is optional",
|
||||||
|
"Hint".yellow().bold()
|
||||||
|
);
|
||||||
|
for (id, desc, dt) in crate::config::Config::get_config_syntax() {
|
||||||
|
println!(" - {} ({}): {desc}", id.green().bold(), dt.blue().bold());
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Subcommand::List => {
|
Subcommand::List => {
|
||||||
if let Err(e) = list() {
|
if let Err(e) = list() {
|
||||||
@@ -482,7 +493,7 @@ fn gen_compile_commands(mode: &Option<String>) -> std::io::Result<()> {
|
|||||||
let cwd = std::env::current_dir()?;
|
let cwd = std::env::current_dir()?;
|
||||||
let obj_dir = format!("target/{}/obj", build_config.name);
|
let obj_dir = format!("target/{}/obj", build_config.name);
|
||||||
|
|
||||||
let source_files: Vec<PathBuf> = glob("src/*.c")
|
let source_files: Vec<PathBuf> = glob("src/**/*.c")
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
||||||
.filter_map(|e| e.ok())
|
.filter_map(|e| e.ok())
|
||||||
.collect();
|
.collect();
|
||||||
@@ -665,7 +676,7 @@ fn build(mode: &Option<String>, force_recompile: bool) -> std::io::Result<()> {
|
|||||||
.collect();
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
let source_files: Vec<PathBuf> = glob("src/*.c")
|
let source_files: Vec<PathBuf> = glob("src/**/*.c")
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
||||||
.filter_map(|e| e.ok())
|
.filter_map(|e| e.ok())
|
||||||
.collect();
|
.collect();
|
||||||
@@ -814,7 +825,7 @@ fn clean() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fmt() -> std::io::Result<()> {
|
fn fmt() -> std::io::Result<()> {
|
||||||
let source_files: Vec<PathBuf> = glob("src/*.c")
|
let source_files: Vec<PathBuf> = glob("src/**/*.c")
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
||||||
.chain(
|
.chain(
|
||||||
glob("src/*.h")
|
glob("src/*.h")
|
||||||
@@ -846,7 +857,7 @@ fn fmt() -> std::io::Result<()> {
|
|||||||
fn lint() -> std::io::Result<()> {
|
fn lint() -> std::io::Result<()> {
|
||||||
gen_compile_commands(&None)?;
|
gen_compile_commands(&None)?;
|
||||||
|
|
||||||
let source_files: Vec<PathBuf> = glob("src/*.c")
|
let source_files: Vec<PathBuf> = glob("src/**/*.c")
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
.map_err(|e| std::io::Error::new(std::io::ErrorKind::NotFound, format!("{e}")))?
|
||||||
.filter_map(|e| e.ok())
|
.filter_map(|e| e.ok())
|
||||||
.collect();
|
.collect();
|
||||||
|
|||||||
@@ -35,6 +35,46 @@ impl Config {
|
|||||||
self.build.iter().find(|bc| bc.name == self.default_build)
|
self.build.iter().find(|bc| bc.name == self.default_build)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_config_syntax() -> Vec<(String, String, String)> {
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
"compiler?",
|
||||||
|
"the compiler used by Pallet (defeault=gcc)",
|
||||||
|
"string",
|
||||||
|
),
|
||||||
|
("name", "the name of your application", "string"),
|
||||||
|
(
|
||||||
|
"default_build",
|
||||||
|
"the name of the build to use by default when running or building",
|
||||||
|
"string",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"description?",
|
||||||
|
"a brief description of your application",
|
||||||
|
"string",
|
||||||
|
),
|
||||||
|
("version?", "the version of your application", "string"),
|
||||||
|
(
|
||||||
|
"authors?",
|
||||||
|
"the author or authors of your application",
|
||||||
|
"string[]",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"build",
|
||||||
|
"a build config that can be used when compiling",
|
||||||
|
"{name: string, args: string[]}[]",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"dependencies",
|
||||||
|
"libraries (such as zlib) used by your application that require pkg-config to be compiled correclty",
|
||||||
|
"string[]"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.map(|(a, b, c)| (a.to_owned(), b.to_owned(), c.to_owned()))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, serde::Serialize)]
|
#[derive(serde::Deserialize, serde::Serialize)]
|
||||||
|
|||||||
Reference in New Issue
Block a user