[WIP] Fix cargo clippy lint build
This commit is contained in:
51
Earthfile
51
Earthfile
@@ -459,20 +459,6 @@ tauri-build:
|
|||||||
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
|
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
|
||||||
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"
|
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 ...
|
# Just for debugging ...
|
||||||
# RUN ls -R ./binaries
|
# RUN ls -R ./binaries
|
||||||
|
|
||||||
@@ -634,39 +620,14 @@ tauri-release:
|
|||||||
END
|
END
|
||||||
|
|
||||||
tauri-lint:
|
tauri-lint:
|
||||||
FROM +tauri-src
|
FROM +rust-base
|
||||||
|
|
||||||
# Clippy (rust linter) will try to build the project before it runs the linter.
|
|
||||||
# Make sure we have evrything needed to build the project.
|
|
||||||
ARG target="x86_64-unknown-linux-gnu"
|
ARG target="x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
# if we want tauri to create the installer bundles we also need to provide all external binaries
|
WORKDIR /app
|
||||||
# we need to do some magic here because tauri expects the binaries to include the rust target tripple.
|
COPY --keep-ts ./assets ./assets
|
||||||
# We already know that triple because it's a required argument. From that triple, we use +RUST_TO_GO_ARCH_STRING
|
COPY --keep-ts ./desktop/tauri ./desktop/tauri
|
||||||
# function from below to parse the triple and guess wich GOOS and GOARCH we need.
|
RUN mkdir -p ./desktop/angular/dist/tauri-builtin
|
||||||
RUN mkdir /tmp/gobuild
|
WORKDIR /app/desktop/tauri/src-tauri
|
||||||
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
|
|
||||||
RUN cargo clippy --all-targets --all-features -- -D warnings
|
RUN cargo clippy --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
kext-build:
|
kext-build:
|
||||||
|
|||||||
@@ -61,10 +61,6 @@ func recoverIPTablesCmd() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// func init() {
|
|
||||||
// rootCmd.AddCommand(recoverIPTablesCmd)
|
|
||||||
// }
|
|
||||||
|
|
||||||
func formatNfqErrors(es []error) string {
|
func formatNfqErrors(es []error) string {
|
||||||
if len(es) == 1 {
|
if len(es) == 1 {
|
||||||
return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0])
|
return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0])
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub struct Config {
|
|||||||
pub theme: Theme,
|
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<()> {
|
pub fn save(app: &AppHandle, config: Config) -> tauri::Result<()> {
|
||||||
let config_dir = app.path().app_config_dir()?;
|
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() {
|
if let Ok(value) = USER_THEME.read() {
|
||||||
return *value.deref();
|
return *value.deref();
|
||||||
}
|
}
|
||||||
return dark_light::detect();
|
dark_light::detect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_green_icon() -> &'static [u8] {
|
fn get_green_icon() -> &'static [u8] {
|
||||||
@@ -88,8 +88,7 @@ fn get_blue_icon() -> &'static [u8] {
|
|||||||
fn get_red_icon() -> &'static [u8] {
|
fn get_red_icon() -> &'static [u8] {
|
||||||
const LIGHT_RED_ICON: &[u8] =
|
const LIGHT_RED_ICON: &[u8] =
|
||||||
include_bytes!("../../../../assets/data/icons/pm_light_red_64.png");
|
include_bytes!("../../../../assets/data/icons/pm_light_red_64.png");
|
||||||
const DARK_RED_ICON: &'static [u8] =
|
const DARK_RED_ICON: &[u8] = include_bytes!("../../../../assets/data/icons/pm_dark_red_64.png");
|
||||||
include_bytes!("../../../../assets/data/icons/pm_dark_red_64.png");
|
|
||||||
match get_theme_mode() {
|
match get_theme_mode() {
|
||||||
dark_light::Mode::Light => DARK_RED_ICON,
|
dark_light::Mode::Light => DARK_RED_ICON,
|
||||||
_ => LIGHT_RED_ICON,
|
_ => LIGHT_RED_ICON,
|
||||||
@@ -421,7 +420,7 @@ pub async fn tray_handler(cli: PortAPI, app: tauri::AppHandle) {
|
|||||||
match payload.parse::<SPNStatus>() {
|
match payload.parse::<SPNStatus>() {
|
||||||
Ok(value) => {
|
Ok(value) => {
|
||||||
debug!("SPN status update: {}", value.status);
|
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());
|
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") {
|
if let Some(window) = app.get_webview_window("splash") {
|
||||||
return window.hide();
|
return window.hide();
|
||||||
}
|
}
|
||||||
return Err(tauri::Error::WindowNotFound);
|
Err(tauri::Error::WindowNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_window_icon(window: &WebviewWindow) {
|
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.
|
# TODO(ppacher): add --disable-software-updates once it's merged and the release process changed.
|
||||||
WorkingDirectory=/var/lib/portmaster/data
|
WorkingDirectory=/var/lib/portmaster/data
|
||||||
ExecStart=/usr/lib/portmaster/portmaster-core --data /var/lib/portmaster/data -devmode -- $PORTMASTER_ARGS
|
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]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
Reference in New Issue
Block a user