From 1b891d6b38281df48e8e9e641654d3cc7e834f2b Mon Sep 17 00:00:00 2001 From: mmattbtw Date: Thu, 11 Aug 2022 22:39:57 -0500 Subject: [PATCH 01/11] added transition to navbar background color --- apps/landing/src/components/NavBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/landing/src/components/NavBar.tsx b/apps/landing/src/components/NavBar.tsx index 11db4243d..2ac773dc2 100644 --- a/apps/landing/src/components/NavBar.tsx +++ b/apps/landing/src/components/NavBar.tsx @@ -59,7 +59,7 @@ export default function NavBar() { return (
Date: Fri, 12 Aug 2022 19:20:22 -0400 Subject: [PATCH 02/11] Fixes Tauri dependencies for Debian Buster (stable), fixes warning for users without cargo or pnpm installed --- .github/scripts/setup-system.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/scripts/setup-system.sh b/.github/scripts/setup-system.sh index 83c90ae1b..e12cfa8d1 100755 --- a/.github/scripts/setup-system.sh +++ b/.github/scripts/setup-system.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -e - echo "Setting up your system for Spacedrive development!" which cargo &> /dev/null @@ -29,7 +27,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then else DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies fi - DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev" # Tauri dependencies + DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev" # Tauri dependencies DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive sudo apt-get -y update From d919dff99ec1a0707cabf274a5bc7dad95dd380b Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 19 Aug 2022 08:58:27 +0800 Subject: [PATCH 03/11] update to latest prisma-client-rust --- Cargo.lock | Bin 165043 -> 170602 bytes Cargo.toml | 11 ++++++----- core/Cargo.toml | 18 ++++++++++++++---- core/prisma/Cargo.toml | 5 ++++- core/src/api/files.rs | 12 ++++++------ core/src/api/locations.rs | 12 ++++++------ core/src/api/tags.rs | 14 +++++--------- core/src/file/cas/identifier.rs | 26 ++++++++++++++------------ core/src/file/indexer.rs | 3 ++- core/src/job/job_manager.rs | 26 +++++++++++++++----------- core/src/job/mod.rs | 4 ++-- core/src/library/library_manager.rs | 8 ++------ core/src/sys/locations.rs | 4 ++-- core/src/sys/volumes.rs | 7 ++----- core/src/util/db.rs | 13 ++++++++----- 15 files changed, 88 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c143a58ec412a659813abb47ca2d51b9943e242e..d4285c8fed94c934c71b81c163f37088f0f960a1 100644 GIT binary patch delta 6406 zcmcIoYmA)LdDa=Q*Sm`^>&q-QUNdWBCpF&9xnF3^LeiwfHej37ZDKdhxn>7;XVx=g za2zfsG${y52%qB9A1#TcQWB+#NH^)UDTzR8m8umbpeRWrVxYOSrBQ%NNGYMD?>D

69GAJ)iQp8cE84Faf5V?vfKfMc8ix;0T;3d{%Z${ORo9e>G7ubymWfJeaF8S+jjcm&v$)&{@I57>4(q_ zvwhbe8{89owA2emy;Dlr0DpTq=iJWbU#^C?@Y#4@xp=C z#U1s5V%PrN#l!pm>HIHPJaK^cPqk;pIv<{i?b(+P+_h){78%`DExzkk=Holi@a&NP z;R3CZAO8*-EGFy!a{iA{Ud-0wu^X4=qf_Y8i`#xOPTP&!25KAUhGXthzi z;{HGTjoD8=^>5>APXlM;z|FDMt~VRC?X`_~+~gsK_D)bHH6xH9hC}iP!kBl)G76az zqZBSevM^?~hs-B|avdqf)N-A4lG+yb;c9X4b4&BLj-hqM+p3H5&Yz8%h$@P>!fi)QEB?`HKMx z&P%`Fmp34^_RH@>Vo`VRVzlD|q>E23-+N^g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x9LAu50=6J diff --git a/Cargo.toml b/Cargo.toml index 5b06d38b2..bb526593c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,9 @@ [workspace] members = [ - "apps/desktop/src-tauri", - "core", - "core/prisma", - "core/derive", - "apps/server" + "apps/desktop/src-tauri", + "core", + "core/prisma", + "core/derive", + "apps/server", ] +resolver = "2" diff --git a/core/Cargo.toml b/core/Cargo.toml index 3eddc564e..f199eefdd 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -8,7 +8,8 @@ repository = "https://github.com/spacedriveapp/spacedrive" edition = "2021" [features] -p2p = [] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it). +p2p = [ +] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it). [dependencies] hostname = "0.3.1" @@ -26,8 +27,17 @@ rmp = "^0.8.11" rmp-serde = "^1.1.0" # Project dependencies -prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] } -rspc = { version = "0.0.4", features = ["axum", "tauri", "uuid", "chrono", "tracing"] } +prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [ + "rspc", + "sqlite-create-many", +] } +rspc = { version = "0.0.4", features = [ + "axum", + "tauri", + "uuid", + "chrono", + "tracing", +] } walkdir = "^2.3.2" uuid = { version = "1.1.2", features = ["v4", "serde"] } sysinfo = "0.23.9" @@ -42,7 +52,7 @@ webp = "0.2.2" ffmpeg-next = "5.0.3" fs_extra = "1.2.0" tracing = "0.1.35" -tracing-subscriber = "0.3.14" +tracing-subscriber = { version = "0.3.14", features = ["env-filter"] } async-stream = "0.3.3" once_cell = "1.13.0" ctor = "0.1.22" diff --git a/core/prisma/Cargo.toml b/core/prisma/Cargo.toml index d9b60cd5a..b24c05939 100644 --- a/core/prisma/Cargo.toml +++ b/core/prisma/Cargo.toml @@ -4,4 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] } +prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [ + "rspc", + "sqlite-create-many", +] } diff --git a/core/src/api/files.rs b/core/src/api/files.rs index bb33d9acd..e8329c6ac 100644 --- a/core/src/api/files.rs +++ b/core/src/api/files.rs @@ -26,8 +26,7 @@ pub(crate) fn mount() -> RouterBuilder { library .db .file() - .find_unique(file::id::equals(args.id)) - .update(vec![file::note::set(args.note)]) + .update(file::id::equals(args.id), vec![file::note::set(args.note)]) .exec() .await?; @@ -54,8 +53,10 @@ pub(crate) fn mount() -> RouterBuilder { library .db .file() - .find_unique(file::id::equals(args.id)) - .update(vec![file::favorite::set(args.favorite)]) + .update( + file::id::equals(args.id), + vec![file::favorite::set(args.favorite)], + ) .exec() .await?; @@ -82,8 +83,7 @@ pub(crate) fn mount() -> RouterBuilder { library .db .file() - .find_unique(file::id::equals(id)) - .delete() + .delete(file::id::equals(id)) .exec() .await?; diff --git a/core/src/api/locations.rs b/core/src/api/locations.rs index 666afcc48..d690597f5 100644 --- a/core/src/api/locations.rs +++ b/core/src/api/locations.rs @@ -133,8 +133,10 @@ pub(crate) fn mount() -> RouterBuilder { library .db .location() - .find_unique(location::id::equals(args.id)) - .update(vec![location::name::set(args.name)]) + .update( + location::id::equals(args.id), + vec![location::name::set(args.name)], + ) .exec() .await?; @@ -147,16 +149,14 @@ pub(crate) fn mount() -> RouterBuilder { library .db .file_path() - .find_many(vec![file_path::location_id::equals(Some(location_id))]) - .delete() + .delete_many(vec![file_path::location_id::equals(Some(location_id))]) .exec() .await?; library .db .location() - .find_unique(location::id::equals(location_id)) - .delete() + .delete(location::id::equals(location_id)) .exec() .await?; diff --git a/core/src/api/tags.rs b/core/src/api/tags.rs index c8a75bc9d..b7a7996d5 100644 --- a/core/src/api/tags.rs +++ b/core/src/api/tags.rs @@ -97,8 +97,10 @@ pub(crate) fn mount() -> RouterBuilder { library .db .tag() - .find_unique(tag::id::equals(args.id)) - .update(vec![tag::name::set(args.name), tag::color::set(args.color)]) + .update( + tag::id::equals(args.id), + vec![tag::name::set(args.name), tag::color::set(args.color)], + ) .exec() .await?; @@ -117,13 +119,7 @@ pub(crate) fn mount() -> RouterBuilder { .mutation("delete", |ctx, arg: LibraryArgs| async move { let (id, library) = arg.get_library(&ctx).await?; - library - .db - .tag() - .find_unique(tag::id::equals(id)) - .delete() - .exec() - .await?; + library.db.tag().delete(tag::id::equals(id)).exec().await?; invalidate_query!( library, diff --git a/core/src/file/cas/identifier.rs b/core/src/file/cas/identifier.rs index 8cbe5bbcc..ac13c7b92 100644 --- a/core/src/file/cas/identifier.rs +++ b/core/src/file/cas/identifier.rs @@ -3,7 +3,7 @@ use super::checksum::generate_cas_id; use crate::{ job::{JobError, JobReportUpdate, JobResult, JobState, StatefulJob, WorkerContext}, library::LibraryContext, - prisma::{self, file, file_path, location}, + prisma::{file, file_path, location}, }; use chrono::{DateTime, FixedOffset}; use prisma_client_rust::{prisma_models::PrismaValue, raw, raw::Raw, Direction}; @@ -160,10 +160,10 @@ impl StatefulJob for FileIdentifierJob { if let Err(e) = library_ctx .db .file_path() - .find_unique(file_path::id::equals( - *cas_lookup.get(&existing_file.cas_id).unwrap(), - )) - .update(vec![file_path::file_id::set(Some(existing_file.id))]) + .update( + file_path::id::equals(*cas_lookup.get(&existing_file.cas_id).unwrap()), + vec![file_path::file_id::set(Some(existing_file.id))], + ) .exec() .await { @@ -205,6 +205,7 @@ impl StatefulJob for FileIdentifierJob { ), values, )) + .exec() .await .unwrap_or_else(|e| { error!("Error inserting files: {:#?}", e); @@ -219,10 +220,10 @@ impl StatefulJob for FileIdentifierJob { .library_ctx() .db .file_path() - .find_unique(file_path::id::equals( - *cas_lookup.get(&created_file.cas_id).unwrap(), - )) - .update(vec![file_path::file_id::set(Some(created_file.id))]) + .update( + file_path::id::equals(*cas_lookup.get(&created_file.cas_id).unwrap()), + vec![file_path::file_id::set(Some(created_file.id))], + ) .exec() .await { @@ -277,12 +278,13 @@ struct CountRes { pub async fn count_orphan_file_paths( ctx: &LibraryContext, location_id: i64, -) -> Result { +) -> Result { let files_count = ctx.db ._query_raw::(raw!( "SELECT COUNT(*) AS count FROM file_paths WHERE file_id IS NULL AND is_dir IS FALSE AND location_id = {}", PrismaValue::Int(location_id) )) + .exec() .await?; Ok(files_count[0].count.unwrap_or(0)) } @@ -290,7 +292,7 @@ pub async fn count_orphan_file_paths( pub async fn get_orphan_file_paths( ctx: &LibraryContext, cursor: i32, -) -> Result, prisma::QueryError> { +) -> Result, prisma_client_rust::QueryError> { info!( "discovering {} orphan file paths at cursor: {:?}", CHUNK_SIZE, cursor @@ -302,7 +304,7 @@ pub async fn get_orphan_file_paths( file_path::is_dir::equals(false), ]) .order_by(file_path::id::order(Direction::Asc)) - .cursor(file_path::id::cursor(cursor)) + .cursor(file_path::id::equals(cursor)) .take(CHUNK_SIZE as i64) .exec() .await diff --git a/core/src/file/indexer.rs b/core/src/file/indexer.rs index b9189b17d..36c75b470 100644 --- a/core/src/file/indexer.rs +++ b/core/src/file/indexer.rs @@ -86,6 +86,7 @@ impl StatefulJob for IndexerJob { .library_ctx() .db ._query_raw::(raw!("SELECT MAX(id) id FROM file_paths")) + .exec() .await { Ok(rows) => rows[0].id.unwrap_or(0), @@ -241,7 +242,7 @@ impl StatefulJob for IndexerJob { files ); - let count = ctx.library_ctx().db._execute_raw(raw).await; + let count = ctx.library_ctx().db._execute_raw(raw).exec().await; info!("Inserted {:?} records", count); diff --git a/core/src/job/job_manager.rs b/core/src/job/job_manager.rs index 140b1ddf2..f79996579 100644 --- a/core/src/job/job_manager.rs +++ b/core/src/job/job_manager.rs @@ -6,7 +6,7 @@ use crate::{ }, job::{worker::Worker, DynJob, Job, JobError}, library::LibraryContext, - prisma::{self, job, node}, + prisma::{job, node}, }; use int_enum::IntEnum; use rspc::Type; @@ -117,7 +117,9 @@ impl JobManager { ret } - pub async fn get_history(ctx: &LibraryContext) -> Result, prisma::QueryError> { + pub async fn get_history( + ctx: &LibraryContext, + ) -> Result, prisma_client_rust::QueryError> { let jobs = ctx .db .job() @@ -291,15 +293,17 @@ impl JobReport { pub async fn update(&self, ctx: &LibraryContext) -> Result<(), JobError> { ctx.db .job() - .find_unique(job::id::equals(self.id.as_bytes().to_vec())) - .update(vec![ - job::status::set(self.status.int_value()), - job::data::set(self.data.clone()), - job::task_count::set(self.task_count), - job::completed_task_count::set(self.completed_task_count), - job::date_modified::set(chrono::Utc::now().into()), - job::seconds_elapsed::set(self.seconds_elapsed), - ]) + .update( + job::id::equals(self.id.as_bytes().to_vec()), + vec![ + job::status::set(self.status.int_value()), + job::data::set(self.data.clone()), + job::task_count::set(self.task_count), + job::completed_task_count::set(self.completed_task_count), + job::date_modified::set(chrono::Utc::now().into()), + job::seconds_elapsed::set(self.seconds_elapsed), + ], + ) .exec() .await?; Ok(()) diff --git a/core/src/job/mod.rs b/core/src/job/mod.rs index 31b7ce16a..3ecd9015e 100644 --- a/core/src/job/mod.rs +++ b/core/src/job/mod.rs @@ -1,4 +1,4 @@ -use crate::{prisma, sys::LocationError}; +use crate::sys::LocationError; use rmp_serde::{decode::Error as DecodeError, encode::Error as EncodeError}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use std::{collections::VecDeque, fmt::Debug}; @@ -14,7 +14,7 @@ pub use worker::*; #[derive(Error, Debug)] pub enum JobError { #[error("Database error: {0}")] - DatabaseError(#[from] prisma::QueryError), + DatabaseError(#[from] prisma_client_rust::QueryError), #[error("Location error: {0}")] LocationError(#[from] LocationError), #[error("I/O error: {0}")] diff --git a/core/src/library/library_manager.rs b/core/src/library/library_manager.rs index 9f40cc5d6..2b873ea7a 100644 --- a/core/src/library/library_manager.rs +++ b/core/src/library/library_manager.rs @@ -10,11 +10,7 @@ use tokio::sync::RwLock; use uuid::Uuid; use crate::{ - invalidate_query, - node::Platform, - prisma::{self, node}, - util::db::load_and_migrate, - NodeContext, + invalidate_query, node::Platform, prisma::node, util::db::load_and_migrate, NodeContext, }; use super::{LibraryConfig, LibraryConfigWrapped, LibraryContext}; @@ -36,7 +32,7 @@ pub enum LibraryManagerError { #[error("error serializing or deserializing the JSON in the config file")] Json(#[from] serde_json::Error), #[error("Database error: {0}")] - Database(#[from] prisma::QueryError), + Database(#[from] prisma_client_rust::QueryError), #[error("Library not found error")] LibraryNotFound, #[error("error migrating the config file")] diff --git a/core/src/sys/locations.rs b/core/src/sys/locations.rs index 6c1b54a99..1a34e1066 100644 --- a/core/src/sys/locations.rs +++ b/core/src/sys/locations.rs @@ -8,7 +8,7 @@ use crate::{ invalidate_query, job::Job, library::LibraryContext, - prisma::{self, location}, + prisma::location, }; use rspc::ErrorCode; @@ -195,7 +195,7 @@ pub enum LocationError { #[error("Failed to connect to database (error: {0:?})")] IOError(io::Error), #[error("Database error")] - DatabaseError(#[from] prisma::QueryError), + DatabaseError(#[from] prisma_client_rust::QueryError), } impl From for rspc::Error { diff --git a/core/src/sys/volumes.rs b/core/src/sys/volumes.rs index 81a3c3e06..dbf581570 100644 --- a/core/src/sys/volumes.rs +++ b/core/src/sys/volumes.rs @@ -1,7 +1,4 @@ -use crate::{ - library::LibraryContext, - prisma::{self, volume::*}, -}; +use crate::{library::LibraryContext, prisma::volume::*}; use rspc::Type; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -24,7 +21,7 @@ pub struct Volume { #[derive(Error, Debug)] pub enum VolumeError { #[error("Database error: {0}")] - DatabaseErr(#[from] prisma::QueryError), + DatabaseErr(#[from] prisma_client_rust::QueryError), #[error("FromUtf8Error: {0}")] FromUtf8Error(#[from] std::string::FromUtf8Error), } diff --git a/core/src/util/db.rs b/core/src/util/db.rs index 4ced4361a..9df21142e 100644 --- a/core/src/util/db.rs +++ b/core/src/util/db.rs @@ -14,7 +14,7 @@ pub enum MigrationError { #[error("An error occurred while initialising a new database connection")] DatabaseInitialization(#[from] NewClientError), #[error("An error occurred with the database while applying migrations")] - DatabaseError(#[from] prisma_client_rust::queries::Error), + DatabaseError(#[from] prisma_client_rust::QueryError), #[error("An error occurred reading the embedded migration files. {0}. Please report to Spacedrive developers!")] InvalidEmbeddedMigration(&'static str), } @@ -27,11 +27,12 @@ pub async fn load_and_migrate(db_url: &str) -> Result(raw!( "SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'" )) + .exec() .await? .is_empty(); if migrations_table_missing { - client._execute_raw(raw!(INIT_MIGRATION)).await?; + client._execute_raw(raw!(INIT_MIGRATION)).exec().await?; } let mut migration_directories = MIGRATIONS_DIR @@ -102,11 +103,13 @@ pub async fn load_and_migrate(db_url: &str) -> Result>(); let steps = &steps[0..steps.len() - 1]; for (i, step) in steps.iter().enumerate() { - client._execute_raw(raw!(*step)).await?; + client._execute_raw(raw!(*step)).exec().await?; client .migration() - .find_unique(migration::checksum::equals(checksum.clone())) - .update(vec![migration::steps_applied::set(i as i32 + 1)]) + .update( + migration::checksum::equals(checksum.clone()), + vec![migration::steps_applied::set(i as i32 + 1)], + ) .exec() .await?; } From a64ac38005792a26a7bd5024c25fd6e9eed07683 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 19 Aug 2022 09:03:47 +0800 Subject: [PATCH 04/11] keep dist folder in desktop --- .gitignore | 4 ++-- apps/desktop/dist/.gitignore | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 apps/desktop/dist/.gitignore diff --git a/.gitignore b/.gitignore index 53da2a22b..500449750 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules .next dist +!apps/desktop/dist *.tsbuildinfo package-lock.json .eslintcache @@ -15,7 +16,6 @@ storybook-static/ cache .env vendor/ -dist data node_modules packages/turbo-server/data/ @@ -61,4 +61,4 @@ todos.md examples/*/*.lock /target -/sdserver_data \ No newline at end of file +/sdserver_data diff --git a/apps/desktop/dist/.gitignore b/apps/desktop/dist/.gitignore new file mode 100644 index 000000000..c53272268 --- /dev/null +++ b/apps/desktop/dist/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore +# This is done so that Tauri never complains that '../dist does not exist' From 5208628060ced19ef6cdff3066c6529ef7fe8db4 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 19 Aug 2022 09:57:52 +0800 Subject: [PATCH 05/11] fix clippy ci --- .github/workflows/clippy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index f2c039e33..3de8c04df 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -48,10 +48,6 @@ jobs: working-directory: core if: steps.cache-prisma.outputs.cache-hit != 'true' run: cargo run -p prisma-cli --release -- generate - - # This is do the proc-macro `tauri::generate_context!()` doesn't panic - - name: Create fake `dist` folder - run: mkdir ./apps/desktop/dist - name: Run Clippy uses: actions-rs/clippy-check@v1 From b37aea37d03304adaa49fa878019ca3aa5a35c55 Mon Sep 17 00:00:00 2001 From: Jamie Pine Date: Sat, 20 Aug 2022 23:55:29 -0700 Subject: [PATCH 06/11] hotfix: (macOS) app platform prop not being set correctly --- packages/interface/src/App.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/interface/src/App.tsx b/packages/interface/src/App.tsx index 81765f019..9b522df65 100644 --- a/packages/interface/src/App.tsx +++ b/packages/interface/src/App.tsx @@ -39,6 +39,12 @@ function RouterContainer(props: { props: AppProps }) { export default function SpacedriveInterface(props: AppProps) { useInvalidateQuery(); + // hotfix for bug where props are not updated, not sure of the cause + if (props.platform === 'unknown') { + // this should be a loading screen if we can't fix the issue above + return <>; + } + return ( From f425ff5781f58aeffe5ccccb91855edd3a935664 Mon Sep 17 00:00:00 2001 From: ned-park <87483870+ned-park@users.noreply.github.com> Date: Tue, 23 Aug 2022 12:03:56 -0400 Subject: [PATCH 07/11] Adds trap for error handling from set -e, updates error handling conditionals for set -e compatibility, updates debian tauri dependencies --- .github/scripts/setup-system.sh | 52 ++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/.github/scripts/setup-system.sh b/.github/scripts/setup-system.sh index e12cfa8d1..433f73112 100755 --- a/.github/scripts/setup-system.sh +++ b/.github/scripts/setup-system.sh @@ -1,16 +1,24 @@ #!/bin/bash +set -e + +script_failure() { + echo "An error occurred while performing the task on line $1" >&2 + echo "Setup for Spacedrive development failed" >&2 +} + +trap 'script_failure $LINENO' ERR + echo "Setting up your system for Spacedrive development!" -which cargo &> /dev/null -if [ $? -eq 1 ]; then +if ! which cargo &> /dev/null; then echo "Rust was not detected on your system. Ensure the 'rustc' and 'cargo' binaries are in your \$PATH." exit 1 fi if [ "${SPACEDRIVE_SKIP_PNPM_CHECK:-}" != "true" ]; then - which pnpm &> /dev/null - if [ $? -eq 1 ]; then + + if ! which pnpm &> /dev/null; then echo "PNPM was not detected on your system. Ensure the 'pnpm' command is in your \$PATH. You are not able to use Yarn or NPM." exit 1 fi @@ -18,6 +26,42 @@ else echo "Skipped PNPM check!" fi +if [ "$1" == "mobile" ]; then + echo "Setting up for mobile development!" + + # IOS targets + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "Installing IOS Rust targets..." + + if ! /usr/bin/xcodebuild -version; then + echo "Xcode is not installed! Ensure you have it installed!" + exit 1 + fi + + rustup target add aarch64-apple-ios + fi + + # Android requires python + if ! command -v python3 &> /dev/null + then + echo "Python3 could not be found. This is required for Android mobile development!" + exit 1 + fi + + # Android targets + echo "Installing Android Rust targets..." + rustup target add armv7-linux-androideabi # for arm + rustup target add i686-linux-android # for x86 + rustup target add aarch64-linux-android # for arm64 + rustup target add x86_64-linux-android # for x86_64 + rustup target add x86_64-unknown-linux-gnu # for linux-x86-64 + rustup target add x86_64-apple-darwin # for darwin x86_64 (if you have an Intel MacOS) + rustup target add aarch64-apple-darwin # for darwin arm64 (if you have a M1 MacOS) + rustup target add x86_64-pc-windows-gnu # for win32-x86-64-gnu + rustup target add x86_64-pc-windows-msvc # for win32-x86-64-msvc +fi + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then if which apt-get &> /dev/null; then echo "Detected 'apt' based distro!" From 1734e497ec9088e1b8b8328de430e4b9e063e835 Mon Sep 17 00:00:00 2001 From: Jamie Pine <32987599+jamiepine@users.noreply.github.com> Date: Sun, 28 Aug 2022 21:17:03 -0700 Subject: [PATCH 08/11] (fix) Re-enable blog Ghost.org decided to stop serving the blog without warning since we needed to upgrade our plan. --- apps/landing/src/pages/index.page.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/landing/src/pages/index.page.tsx b/apps/landing/src/pages/index.page.tsx index 650e3cc3f..045c83fe2 100644 --- a/apps/landing/src/pages/index.page.tsx +++ b/apps/landing/src/pages/index.page.tsx @@ -100,13 +100,11 @@ function Page() {