From 6ca30fa4ce6cc09a89c7e9f15ac5090e64f22989 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Mon, 15 Sep 2025 11:55:49 +0200 Subject: [PATCH 1/3] Testing a release fix. Added targets file. Packing android. Test. Test 5. Test 6. test 7 test 8 Using bundle path to resolve extension in iOS. Using a NativeReference to include the xcframework. Forcing iOS simulator architecture. Added build step for Maui package. Fix. Using mac runner. Removed clear commands. Workload restore Fixed paths for macos runner. Added props file to Common that ensures we exclude native assets for Android. Props => targets Harsher removal of assets for common. Added comment for ios runtime workaround. --- .github/workflows/dev-packages.yml | 18 +++++++++---- .github/workflows/release.yml | 3 +++ PowerSync/PowerSync.Common/CHANGELOG.md | 3 +++ .../PowerSync.Common/PowerSync.Common.csproj | 9 +++++-- .../PowerSync.Common/PowerSync.Common.targets | 7 +++++ PowerSync/PowerSync.Maui/CHANGELOG.md | 3 +++ .../PowerSync.Maui/PowerSync.Maui.csproj | 27 +++++++------------ .../SQLite/MAUISQLiteAdapter.cs | 17 +++++++----- .../PowerSync.Maui/build/ApiDefinition.cs | 4 +++ demos/MAUITodo/MAUITodo.csproj | 11 ++++++-- 10 files changed, 69 insertions(+), 33 deletions(-) create mode 100644 PowerSync/PowerSync.Common/PowerSync.Common.targets create mode 100644 PowerSync/PowerSync.Maui/build/ApiDefinition.cs 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..7c36f80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,6 +46,9 @@ 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 diff --git a/PowerSync/PowerSync.Common/CHANGELOG.md b/PowerSync/PowerSync.Common/CHANGELOG.md index 3c726e0..89d484b 100644 --- a/PowerSync/PowerSync.Common/CHANGELOG.md +++ b/PowerSync/PowerSync.Common/CHANGELOG.md @@ -1,5 +1,8 @@ # PowerSync.Common Changelog +## 0.0.4-dev.4 +- Fixing build issues related to MAUI targets not resolving on install. + ## 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..514c973 100644 --- a/PowerSync/PowerSync.Maui/CHANGELOG.md +++ b/PowerSync/PowerSync.Maui/CHANGELOG.md @@ -1,5 +1,8 @@ # PowerSync.Maui Changelog +## 0.0.3-dev.1 +- Further resolution of iOS builds. + ## 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..8b379e0 --- /dev/null +++ b/PowerSync/PowerSync.Maui/build/ApiDefinition.cs @@ -0,0 +1,4 @@ +namespace YourNamespace +{ + // 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 + + From 3f0344c489b796df23d24e2eefd352a2ebdc1e93 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Mon, 29 Sep 2025 13:55:59 +0200 Subject: [PATCH 2/3] Updated release workflow/cleanup. --- .github/workflows/release.yml | 13 +++++++++---- PowerSync/PowerSync.Common/CHANGELOG.md | 4 ++-- PowerSync/PowerSync.Maui/CHANGELOG.md | 4 ++-- demos/MAUITodo/README.md | 7 +++++++ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c36f80..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 @@ -55,4 +60,4 @@ jobs: - 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 89d484b..21f94ac 100644 --- a/PowerSync/PowerSync.Common/CHANGELOG.md +++ b/PowerSync/PowerSync.Common/CHANGELOG.md @@ -1,7 +1,7 @@ # PowerSync.Common Changelog -## 0.0.4-dev.4 -- Fixing build issues related to MAUI targets not resolving on install. +## 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.Maui/CHANGELOG.md b/PowerSync/PowerSync.Maui/CHANGELOG.md index 514c973..a0f0049 100644 --- a/PowerSync/PowerSync.Maui/CHANGELOG.md +++ b/PowerSync/PowerSync.Maui/CHANGELOG.md @@ -1,7 +1,7 @@ # PowerSync.Maui Changelog -## 0.0.3-dev.1 -- Further resolution of iOS builds. +## 0.0.2-alpha.1 +- Fixed issues related to extension loading when installing package outside of the monorepo. ## 0.0.1-alpha.1 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 From 0745974f6a064058819523b2587ff8834b9c0a39 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Tue, 30 Sep 2025 09:18:56 +0200 Subject: [PATCH 3/3] Updated ApiDefinition namespace. --- PowerSync/PowerSync.Maui/build/ApiDefinition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerSync/PowerSync.Maui/build/ApiDefinition.cs b/PowerSync/PowerSync.Maui/build/ApiDefinition.cs index 8b379e0..79a0522 100644 --- a/PowerSync/PowerSync.Maui/build/ApiDefinition.cs +++ b/PowerSync/PowerSync.Maui/build/ApiDefinition.cs @@ -1,4 +1,4 @@ -namespace YourNamespace +namespace PowerSync.Maui.build { // Empty API definition - allows xcframework to be included without managed bindings } \ No newline at end of file