diff --git a/.github/workflows/dev-packages.yml b/.github/workflows/dev-packages.yml index 1fc5af6..92ee98c 100644 --- a/.github/workflows/dev-packages.yml +++ b/.github/workflows/dev-packages.yml @@ -7,16 +7,21 @@ on: workflow_dispatch jobs: dev-release: name: Publish Dev Packages - runs-on: windows-latest + runs-on: macos-latest steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0' + dotnet-version: '8.0' + + - name: Install MAUI Workloads + run: dotnet workload restore - name: Download PowerSync extension run: dotnet run --project Tools/Setup @@ -37,7 +42,7 @@ jobs: - name: Run Push For Common continue-on-error: true - run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push ${{ github.workspace }}/output/PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} - name: Extract MAUI Package Version from CHANGELOG.md id: extract_maui_version @@ -46,10 +51,13 @@ jobs: MAUI_VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+-dev(\.[0-9]+)?$/ {print $2; exit}' PowerSync/PowerSync.Maui/CHANGELOG.md) echo "Detected Version: $MAUI_VERSION" echo "VERSION=$MAUI_VERSION" >> $GITHUB_ENV - + + - name: Build MAUI Project + run: dotnet build PowerSync/PowerSync.Maui -c Release + - name: Run Pack For MAUI run: dotnet pack PowerSync/PowerSync.Maui -c Release -o ${{ github.workspace }}/output - name: Run Push For MAUI continue-on-error: true - run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} \ No newline at end of file + run: dotnet nuget push ${{ github.workspace }}/output/PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a33476..497c2fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,17 +6,22 @@ on: workflow_dispatch jobs: release: name: Release - runs-on: windows-latest + runs-on: macos-latest if: github.ref == 'refs/heads/main' steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0' + dotnet-version: '8.0' + + - name: Install MAUI Workloads + run: dotnet workload restore - name: Download PowerSync extension run: dotnet run --project Tools/Setup @@ -37,7 +42,7 @@ jobs: - name: Run Push for Common continue-on-error: true - run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push ${{ github.workspace }}/output/PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} - name: Extract MAUI Package Version from CHANGELOG.md id: extract_maui_version @@ -46,10 +51,13 @@ jobs: MAUI_VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+/ {print $2; exit}' PowerSync/PowerSync.Maui/CHANGELOG.md) echo "Detected Version: $MAUI_VERSION" echo "VERSION=$MAUI_VERSION" >> $GITHUB_ENV + + - name: Build MAUI Project + run: dotnet build PowerSync/PowerSync.Maui -c Release - name: Run Pack For MAUI run: dotnet pack PowerSync/PowerSync.Maui -c Release -o ${{ github.workspace }}/output - name: Run Push For MAUI continue-on-error: true - run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} \ No newline at end of file + run: dotnet nuget push ${{ github.workspace }}/output/PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/PowerSync/PowerSync.Common/CHANGELOG.md b/PowerSync/PowerSync.Common/CHANGELOG.md index 3c726e0..21f94ac 100644 --- a/PowerSync/PowerSync.Common/CHANGELOG.md +++ b/PowerSync/PowerSync.Common/CHANGELOG.md @@ -1,5 +1,8 @@ # PowerSync.Common Changelog +## 0.0.4-alpha.1 +- Fixed MAUI issues related to extension loading when installing package outside of the monorepo. + ## 0.0.3-alpha.1 - Minor changes to accommodate PowerSync.MAUI package extension. diff --git a/PowerSync/PowerSync.Common/PowerSync.Common.csproj b/PowerSync/PowerSync.Common/PowerSync.Common.csproj index f429dd4..abb53de 100644 --- a/PowerSync/PowerSync.Common/PowerSync.Common.csproj +++ b/PowerSync/PowerSync.Common/PowerSync.Common.csproj @@ -30,17 +30,22 @@ + + + + + - + PreserveNewest - + diff --git a/PowerSync/PowerSync.Common/PowerSync.Common.targets b/PowerSync/PowerSync.Common/PowerSync.Common.targets new file mode 100644 index 0000000..0c5bcba --- /dev/null +++ b/PowerSync/PowerSync.Common/PowerSync.Common.targets @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PowerSync/PowerSync.Maui/CHANGELOG.md b/PowerSync/PowerSync.Maui/CHANGELOG.md index 09f2e66..a0f0049 100644 --- a/PowerSync/PowerSync.Maui/CHANGELOG.md +++ b/PowerSync/PowerSync.Maui/CHANGELOG.md @@ -1,5 +1,8 @@ # PowerSync.Maui Changelog +## 0.0.2-alpha.1 +- Fixed issues related to extension loading when installing package outside of the monorepo. + ## 0.0.1-alpha.1 - Introduce package. Support for iOS/Android use cases. diff --git a/PowerSync/PowerSync.Maui/PowerSync.Maui.csproj b/PowerSync/PowerSync.Maui/PowerSync.Maui.csproj index ce14928..5ed5bd3 100644 --- a/PowerSync/PowerSync.Maui/PowerSync.Maui.csproj +++ b/PowerSync/PowerSync.Maui/PowerSync.Maui.csproj @@ -19,6 +19,9 @@ icon.png NU5100 README.md + true + true + true @@ -32,26 +35,14 @@ Designer - - - - - PreserveNewest - - - - - PreserveNewest - - - - - - - - + + + + Framework + False + diff --git a/PowerSync/PowerSync.Maui/SQLite/MAUISQLiteAdapter.cs b/PowerSync/PowerSync.Maui/SQLite/MAUISQLiteAdapter.cs index ee8b8fd..4583fe8 100644 --- a/PowerSync/PowerSync.Maui/SQLite/MAUISQLiteAdapter.cs +++ b/PowerSync/PowerSync.Maui/SQLite/MAUISQLiteAdapter.cs @@ -19,7 +19,7 @@ protected override void LoadExtension(SqliteConnection db) db.EnableExtensions(true); #if IOS - LoadExtensionIOS(db); + LoadExtensionIOS(db); #elif ANDROID db.LoadExtension("libpowersync"); #else @@ -29,16 +29,21 @@ protected override void LoadExtension(SqliteConnection db) private void LoadExtensionIOS(SqliteConnection db) { - #if IOS - var bundlePath = Foundation.NSBundle.MainBundle.BundlePath; +#if IOS + var bundlePath = Foundation.NSBundle.FromIdentifier("co.powersync.sqlitecore")?.BundlePath; + if (bundlePath == null) + { + throw new Exception("Could not find PowerSync SQLite extension bundle path"); + } + var filePath = - Path.Combine(bundlePath, "Frameworks", "powersync-sqlite-core.framework", "powersync-sqlite-core"); - + Path.Combine(bundlePath, "powersync-sqlite-core"); + using var loadExtension = db.CreateCommand(); loadExtension.CommandText = "SELECT load_extension(@path, @entryPoint)"; loadExtension.Parameters.AddWithValue("@path", filePath); loadExtension.Parameters.AddWithValue("@entryPoint", "sqlite3_powersync_init"); loadExtension.ExecuteNonQuery(); - #endif +#endif } } \ No newline at end of file diff --git a/PowerSync/PowerSync.Maui/build/ApiDefinition.cs b/PowerSync/PowerSync.Maui/build/ApiDefinition.cs new file mode 100644 index 0000000..79a0522 --- /dev/null +++ b/PowerSync/PowerSync.Maui/build/ApiDefinition.cs @@ -0,0 +1,4 @@ +namespace PowerSync.Maui.build +{ + // Empty API definition - allows xcframework to be included without managed bindings +} \ No newline at end of file diff --git a/demos/MAUITodo/MAUITodo.csproj b/demos/MAUITodo/MAUITodo.csproj index afd5eb1..cee3763 100644 --- a/demos/MAUITodo/MAUITodo.csproj +++ b/demos/MAUITodo/MAUITodo.csproj @@ -3,9 +3,9 @@ com.companyname.todo - net8.0-android;net8.0-ios + net8.0-android $(TargetFrameworks);net8.0-windows10.0.19041.0 - + $(TargetFrameworks);net8.0-ios Exe MAUITodo @@ -34,6 +34,13 @@ 10.0.19041.0 10.0.19041.0 + + + + iossimulator-x64 + true + + diff --git a/demos/MAUITodo/README.md b/demos/MAUITodo/README.md index 82bcd1c..9a24f6f 100644 --- a/demos/MAUITodo/README.md +++ b/demos/MAUITodo/README.md @@ -50,4 +50,11 @@ dotnet build -t:Run -f:net8.0-android -p:_DeviceName=emulator-5554 ```sh dotnet run -f net8.0-windows10.0.19041.0 +``` + +## Android on Windows +You may need to overwrite the [backend and PowerSync URLs](./Data/NodeConnector.cs) when running an Android emulator on Windows. +``` +BackendUrl = "http://10.0.2.2:6060"; +PowerSyncUrl = "http://10.0.2.2:8080"; ``` \ No newline at end of file