mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
[WIP] Fix cargo clippy lint build
This commit is contained in:
parent
a452f0cbf6
commit
3411e08500
6 changed files with 12 additions and 56 deletions
51
Earthfile
51
Earthfile
|
@ -459,20 +459,6 @@ tauri-build:
|
|||
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
|
||||
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"
|
||||
|
||||
# Our tauri app has externalBins configured so tauri will try to embed them when it finished compiling
|
||||
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
|
||||
# See documentation for externalBins for more information on how tauri searches for the binaries.
|
||||
COPY (+go-build/output --CMDS="portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
|
||||
|
||||
# Place them in the correct folder with the rust target tripple attached.
|
||||
FOR bin IN $(ls /tmp/gobuild)
|
||||
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
|
||||
# snippet here:
|
||||
RUN set -e ; \
|
||||
dest="./binaries/${bin}" ; \
|
||||
cp "/tmp/gobuild/${bin}" "${dest}" ;
|
||||
END
|
||||
|
||||
# Just for debugging ...
|
||||
# RUN ls -R ./binaries
|
||||
|
||||
|
@ -634,39 +620,14 @@ tauri-release:
|
|||
END
|
||||
|
||||
tauri-lint:
|
||||
FROM +tauri-src
|
||||
|
||||
# Clippy (rust linter) will try to build the project before it runs the linter.
|
||||
# Make sure we have evrything needed to build the project.
|
||||
FROM +rust-base
|
||||
ARG target="x86_64-unknown-linux-gnu"
|
||||
|
||||
# if we want tauri to create the installer bundles we also need to provide all external binaries
|
||||
# we need to do some magic here because tauri expects the binaries to include the rust target tripple.
|
||||
# We already know that triple because it's a required argument. From that triple, we use +RUST_TO_GO_ARCH_STRING
|
||||
# function from below to parse the triple and guess wich GOOS and GOARCH we need.
|
||||
RUN mkdir /tmp/gobuild
|
||||
RUN mkdir ./binaries
|
||||
|
||||
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
|
||||
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"
|
||||
|
||||
# Our tauri app has externalBins configured so tauri will try to embed them when it finished compiling
|
||||
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
|
||||
# See documentation for externalBins for more information on how tauri searches for the binaries.
|
||||
COPY (+go-build/output --CMDS="portmaster-start portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
|
||||
|
||||
# Place them in the correct folder with the rust target tripple attached.
|
||||
FOR bin IN $(ls /tmp/gobuild)
|
||||
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
|
||||
# snippet here:
|
||||
RUN set -e ; \
|
||||
dest="./binaries/${bin}-${target}" ; \
|
||||
if [ -z "${bin##*.exe}" ]; then \
|
||||
dest="./binaries/${bin%.*}-${target}.exe" ; \
|
||||
fi ; \
|
||||
cp "/tmp/gobuild/${bin}" "${dest}" ;
|
||||
END
|
||||
DO rust+SET_CACHE_MOUNTS_ENV
|
||||
WORKDIR /app
|
||||
COPY --keep-ts ./assets ./assets
|
||||
COPY --keep-ts ./desktop/tauri ./desktop/tauri
|
||||
RUN mkdir -p ./desktop/angular/dist/tauri-builtin
|
||||
WORKDIR /app/desktop/tauri/src-tauri
|
||||
RUN cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
kext-build:
|
||||
|
|
|
@ -61,10 +61,6 @@ func recoverIPTablesCmd() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// func init() {
|
||||
// rootCmd.AddCommand(recoverIPTablesCmd)
|
||||
// }
|
||||
|
||||
func formatNfqErrors(es []error) string {
|
||||
if len(es) == 1 {
|
||||
return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0])
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct Config {
|
|||
pub theme: Theme,
|
||||
}
|
||||
|
||||
const CONFIG_FILE_NAME: &'static str = "config.json";
|
||||
const CONFIG_FILE_NAME: &str = "config.json";
|
||||
|
||||
pub fn save(app: &AppHandle, config: Config) -> tauri::Result<()> {
|
||||
let config_dir = app.path().app_config_dir()?;
|
||||
|
|
|
@ -59,7 +59,7 @@ fn get_theme_mode() -> dark_light::Mode {
|
|||
if let Ok(value) = USER_THEME.read() {
|
||||
return *value.deref();
|
||||
}
|
||||
return dark_light::detect();
|
||||
dark_light::detect()
|
||||
}
|
||||
|
||||
fn get_green_icon() -> &'static [u8] {
|
||||
|
@ -88,8 +88,7 @@ fn get_blue_icon() -> &'static [u8] {
|
|||
fn get_red_icon() -> &'static [u8] {
|
||||
const LIGHT_RED_ICON: &[u8] =
|
||||
include_bytes!("../../../../assets/data/icons/pm_light_red_64.png");
|
||||
const DARK_RED_ICON: &'static [u8] =
|
||||
include_bytes!("../../../../assets/data/icons/pm_dark_red_64.png");
|
||||
const DARK_RED_ICON: &[u8] = include_bytes!("../../../../assets/data/icons/pm_dark_red_64.png");
|
||||
match get_theme_mode() {
|
||||
dark_light::Mode::Light => DARK_RED_ICON,
|
||||
_ => LIGHT_RED_ICON,
|
||||
|
@ -421,7 +420,7 @@ pub async fn tray_handler(cli: PortAPI, app: tauri::AppHandle) {
|
|||
match payload.parse::<SPNStatus>() {
|
||||
Ok(value) => {
|
||||
debug!("SPN status update: {}", value.status);
|
||||
spn_status = value.status.clone();
|
||||
spn_status.clone_from(&value.status);
|
||||
|
||||
update_icon(icon.clone(), app.menu(), subsystems.clone(), spn_status.clone());
|
||||
},
|
||||
|
|
|
@ -98,7 +98,7 @@ pub fn hide_splash_window(app: &AppHandle) -> Result<()> {
|
|||
if let Some(window) = app.get_webview_window("splash") {
|
||||
return window.hide();
|
||||
}
|
||||
return Err(tauri::Error::WindowNotFound);
|
||||
Err(tauri::Error::WindowNotFound)
|
||||
}
|
||||
|
||||
pub fn set_window_icon(window: &WebviewWindow) {
|
||||
|
|
|
@ -36,7 +36,7 @@ StateDirectory=portmaster
|
|||
# TODO(ppacher): add --disable-software-updates once it's merged and the release process changed.
|
||||
WorkingDirectory=/var/lib/portmaster/data
|
||||
ExecStart=/usr/lib/portmaster/portmaster-core --data /var/lib/portmaster/data -devmode -- $PORTMASTER_ARGS
|
||||
ExecStopPost=-/usr/bin/portmaster/portmaster-core recover-iptables
|
||||
ExecStopPost=-/usr/lib/portmaster/portmaster-core -recover-iptables
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Add table
Reference in a new issue