Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed merging. #15

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
FerrisWasTaken marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ Cargo.lock

# Visual Studio Code
*.code-workspace
/.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.history/
*.vsix
.vscode
/.vscode/

# Packaging
/packaging/**/pkg
Expand Down
23 changes: 13 additions & 10 deletions Cargo.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the resolver that is no longer the default in newer editions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the newer resolver causes extism to stop being resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find any documentation on why this has to be done? It seems strange

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[workspace]

members = [
"paxy",
"paxy-cli",
"paxy-gui", "paxy-plugin",
"tests"
]
default-members = [
"paxy",
"paxy-cli",
"paxy-gui",

"tests",
"tests"
]

resolver = "2"

resolver = "1"

[workspace.package]

Expand All @@ -20,7 +22,7 @@ homepage = "https://pax-hub.github.io/"
authors = [
"shivanandvp <[email protected], [email protected]>",
"lylythechosenone",
"ferriswastaken",
"Ishaan S <[email protected]>",
"flyingcakes85",
]
keywords = ["package", "package-manager", "paxy", "packager"]
Expand All @@ -40,6 +42,7 @@ paxy = { path = "paxy" }
tracing = "0.1"
tracing-appender = "0.2"
tracing-subscriber = "0.3"
log = "0.4"

# Configuration
figment = "0.10"
Expand All @@ -52,12 +55,12 @@ snafu = "0.8"

# Data
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0.200", features = ["derive"] }
serde-aux = "4.5"
serde_yaml = "0.9"
tracing-serde = "0.1"
speedy = "0.8"
log = "0.4"
itertools = "0.12"

# Internationalization
fluent = "0.16"
Expand All @@ -71,4 +74,4 @@ console = "0.15"

# GUI
relm4 = "0.8"
relm4-components = "0.8"
relm4-components = "0.8"
4 changes: 4 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM archlinux:latest
ENV RUSTC_WRAPPER=sccache
ENV CARGO_INCREMENTAL=0
ENV CARGO_TARGET_DIR=/paxy/podman-target
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.cargo/bin

# Install Rust
RUN pacman -Sy --noconfirm rustup cargo
Expand All @@ -13,3 +14,6 @@ RUN rustup default nightly-2024-03-17
RUN pacman -Sy --noconfirm gdk-pixbuf2 pango gtk4 pkg-config
# Extras
RUN pacman -S --noconfirm sccache
RUN cargo install cargo-make
RUN cargo install cargo-binstall
RUN cargo binstall --no-confirm wasmer-cli
2 changes: 2 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tasks.build]
args = ["build"]
53 changes: 28 additions & 25 deletions paxy-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
//! Has the [`run_cli`] function and the commandline interface template
//! [`cli_template::CliTemplate`]

/// Calls the [`ui::run_common::<C>`] function supplying it with the commandline
/// interface template as a type. Any errors are thrown back to the calling
/// function. A debug message is then displayed conveying that the program is
/// being run in the CLI mode.
pub fn run_cli() -> Result<(), paxy::Error> {
let (_cli_input, _worker_guards) = ui::run_common::<CliTemplate>()?;
let (_cli_input, _logging_worker_guards) = ui::run_common::<CliTemplate>()?;

tracing::debug!(
"Running in {} mode... {}",
Expand Down Expand Up @@ -51,7 +58,7 @@ mod cli_template {
)]
pub struct CliTemplate {
#[command(flatten)]
pub global_arguments: ui::cli_template::GlobalArgs<clap_verbosity_flag::InfoLevel>,
pub global_args: ui::cli_template::GlobalArgs<clap_verbosity_flag::InfoLevel>,

#[command(subcommand)]
pub entity: Option<EntitySubcommand>,
Expand All @@ -60,43 +67,39 @@ mod cli_template {
/// Implement a trait that can extract standard global arguments from our
/// own CLI template
impl ui::GlobalArguments for CliTemplate {
type L = clap_verbosity_flag::InfoLevel;

fn config_file(&self) -> &Option<PathBuf> {
&self
.global_arguments
.config_file
fn config_filepath(&self) -> &Option<PathBuf> {
self.global_args
.config_filepath()
}

fn is_json(&self) -> bool {
self.global_arguments
.json_flag
self.global_args
.is_json()
}

fn is_plain(&self) -> bool {
self.global_arguments
.plain_flag
self.global_args
.is_plain()
}

fn is_debug(&self) -> bool {
self.global_arguments
.debug_flag
self.global_args
.is_debug()
}

fn is_no_color(&self) -> bool {
self.global_arguments
.no_color_flag
fn is_test(&self) -> bool {
self.global_args
.is_test()
}

fn is_test(&self) -> bool {
self.global_arguments
.test_flag
fn is_no_color(&self) -> bool {
self.global_args
.is_no_color()
}

fn verbosity(&self) -> &clap_verbosity_flag::Verbosity<Self::L> {
&self
.global_arguments
.verbose
fn verbosity_filter(&self) -> log::LevelFilter {
self.global_args
.verbosity_filter()
}
}

Expand Down Expand Up @@ -408,6 +411,6 @@ mod cli_template {

// region: RE-EXPORTS

pub use cli_template::*;
pub use cli_template::*; // Flatten the module heirarchy for easier access

// endregion: RE-EXPORTS
7 changes: 7 additions & 0 deletions paxy-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//! Starts execution at the [`main`] function. Offloads the implemenation
//! details to its corresponding library crate.

/// Calls the [`paxy_cli::run_cli`] function and captures the returned
/// [`Result`]. If there was an error, the error message chain is printed to the
/// standard error stream (`stderr`). The program then returns an `0` or `1`
/// corresponding to "no error" or "error" based on the result.
fn main() -> process::ExitCode {
let return_value = paxy_cli::run_cli();
match return_value {
Expand Down
49 changes: 29 additions & 20 deletions paxy-gui/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
//! Has the [`run_gui`] function and the commandline interface template
//! [`gui_cli_template::CliTemplate`]

/// Calls the [`ui::run_common::<C>`] function supplying it with the commandline
/// interface template as a type. Any errors are thrown back to the calling
/// function. A debug message is then displayed conveying that the program is
/// being run in the GUI mode.
pub fn run_gui() -> Result<(), paxy::Error> {
let (_cli_input, _worker_guards) = ui::run_common::<CliTemplate>()?;
let (_cli_input, _logging_worker_guards) = ui::run_common::<CliTemplate>()?;

tracing::debug!(
"Running in {} mode... {}",
Expand All @@ -15,7 +22,7 @@ pub fn run_gui() -> Result<(), paxy::Error> {
pub enum Error {
#[non_exhaustive]
#[snafu(display(""), visibility(pub))]
GuiDummy {},
GuiDummy {}, // No errors implemented yet
}

// region: IMPORTS
Expand All @@ -28,52 +35,54 @@ use snafu::Snafu;

// region: MODULES

/// The commandline interface for the GUI program. Allows one to specify flags
/// that control output on a console.
mod gui_cli_template {

/// The base commandline template consists of global arguments
#[derive(Parser, Debug)]
#[command(version, author, about, args_conflicts_with_subcommands = true)]
pub struct CliTemplate {
#[clap(flatten)]
pub global_args: ui::cli_template::GlobalArgs<clap_verbosity_flag::InfoLevel>,
}

/// Implement a trait that can extract standard global arguments from our
/// own CLI template
impl ui::GlobalArguments for CliTemplate {
type L = clap_verbosity_flag::InfoLevel;

fn config_file(&self) -> &Option<PathBuf> {
&self
.global_args
.config_file
fn config_filepath(&self) -> &Option<PathBuf> {
self.global_args
.config_filepath()
}

fn is_json(&self) -> bool {
self.global_args
.json_flag
.is_json()
}

fn is_plain(&self) -> bool {
self.global_args
.plain_flag
.is_plain()
}

fn is_debug(&self) -> bool {
self.global_args
.debug_flag
.is_debug()
}

fn is_no_color(&self) -> bool {
fn is_test(&self) -> bool {
self.global_args
.no_color_flag
.is_test()
}

fn is_test(&self) -> bool {
fn is_no_color(&self) -> bool {
self.global_args
.test_flag
.is_no_color()
}

fn verbosity(&self) -> &clap_verbosity_flag::Verbosity<Self::L> {
&self
.global_args
.verbose
fn verbosity_filter(&self) -> log::LevelFilter {
self.global_args
.verbosity_filter()
}
}

Expand All @@ -91,6 +100,6 @@ mod gui_cli_template {

// region: RE-EXPORTS

pub use gui_cli_template::*;
pub use gui_cli_template::*; // Flatten the module heirarchy for easier access

// endregion: RE-EXPORTS
7 changes: 7 additions & 0 deletions paxy-gui/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//! Starts execution at the [`main`] function. Offloads the implemenation
//! details to its corresponding library crate.

/// Calls the [`paxy_gui::run_gui`] function and captures the returned
/// [`Result`]. If there was an error, the error message chain is printed to the
/// standard error stream (`stderr`). The program then returns an `0` or `1`
/// corresponding to "no error" or "error" based on the result.
fn main() -> process::ExitCode {
let return_value = paxy_gui::run_gui();
match return_value {
Expand Down
25 changes: 25 additions & 0 deletions paxy-plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cargo-features = ["per-package-target"]
[package]
name = "paxy-plugin"
version.workspace = true
description.workspace = true
repository.workspace = true
homepage.workspace = true
authors.workspace = true
keywords.workspace = true
exclude.workspace = true
categories.workspace = true
documentation.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
default-target = "wasm32-wasi"

[dependencies]
extism-pdk = "1.1.0"
toml = "0.8.12"
semver = {git = "https://github.com/FerrisWasTaken/semver.git", features = ["extism_support"]}
reqwest = { version = "0.11", features = ["blocking", "json"] }

[lib]
crate-type = ["cdylib"]
13 changes: 13 additions & 0 deletions paxy-plugin/examples/paxy.px
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "Paxy"
repo = "https://github.com/Pax-Hub/paxy"

[[version]]
ver = "0.1.0"
src = "https://github.com/Pax-hub/paxy/releases/tag/0.1.0"
dependencies = ["rust >= 1.72.0"]
install_inst = "mv pkg/paxy /usr/bin"

[[version]]
ver = "0.1.1"
src = "https://github.com/Pax-hub/paxy/releases/tag/0.1.1"
install_inst = "mv /pkg/paxy /usr/bin"
Loading
Loading