Skip to content

Commit 2d25306

Browse files
authored
Merge pull request #9 from powersync-ja/maui
feat: MAUI support
2 parents ca31895 + e28c526 commit 2d25306

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2168
-82
lines changed

.github/workflows/dev-packages.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The version is pulled from the CHANGELOG.md file of the package.
2-
# Add a `-dev.xxx` suffix to the version.
2+
# Add a `-dev.xxx` suffix to the version. Example: `0.0.1-dev.1`
33
name: Create Dev Release
44

55
on: workflow_dispatch
@@ -24,17 +24,32 @@ jobs:
2424
- name: Restore dependencies
2525
run: dotnet restore
2626

27-
- name: Extract Version from CHANGELOG.md
27+
- name: Extract Common Package Version from CHANGELOG.md
2828
id: extract_version
2929
shell: bash
3030
run: |
31-
VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+-dev(\.[0-9]+)?$/ {print $2; exit}' PowerSync/PowerSync.Common/CHANGELOG.md)
32-
echo "Detected Version: $VERSION"
33-
echo "VERSION=$VERSION" >> $GITHUB_ENV
31+
COMMON_VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+-dev(\.[0-9]+)?$/ {print $2; exit}' PowerSync/PowerSync.Common/CHANGELOG.md)
32+
echo "Detected Version: $COMMON_VERSION"
33+
echo "VERSION=$COMMON_VERSION" >> $GITHUB_ENV
3434
35-
- name: Run Pack
36-
run: dotnet pack -c Release -o ${{ github.workspace }}/output
35+
- name: Run Pack For Common
36+
run: dotnet pack PowerSync/PowerSync.Common -c Release -o ${{ github.workspace }}/output
3737

38-
- name: Run Push
39-
run: dotnet nuget push ${{ github.workspace }}\output\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
40-
38+
- name: Run Push For Common
39+
continue-on-error: true
40+
run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
41+
42+
- name: Extract MAUI Package Version from CHANGELOG.md
43+
id: extract_maui_version
44+
shell: bash
45+
run: |
46+
MAUI_VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+-dev(\.[0-9]+)?$/ {print $2; exit}' PowerSync/PowerSync.Maui/CHANGELOG.md)
47+
echo "Detected Version: $MAUI_VERSION"
48+
echo "VERSION=$MAUI_VERSION" >> $GITHUB_ENV
49+
50+
- name: Run Pack For MAUI
51+
run: dotnet pack PowerSync/PowerSync.Maui -c Release -o ${{ github.workspace }}/output
52+
53+
- name: Run Push For MAUI
54+
continue-on-error: true
55+
run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.github/workflows/release.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,32 @@ jobs:
2424
- name: Restore dependencies
2525
run: dotnet restore
2626

27-
- name: Extract Version from CHANGELOG.md
27+
- name: Extract Common Package Version from CHANGELOG.md
2828
id: extract_version
2929
shell: bash
3030
run: |
3131
VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+/ {print $2; exit}' PowerSync/PowerSync.Common/CHANGELOG.md)
3232
echo "Detected Version: $VERSION"
3333
echo "VERSION=$VERSION" >> $GITHUB_ENV
3434
35-
- name: Run Pack
36-
run: dotnet pack -c Release -o ${{ github.workspace }}/output
35+
- name: Run Pack for Common
36+
run: dotnet pack PowerSync/PowerSync.Common -c Release -o ${{ github.workspace }}/output
3737

38-
- name: Run Push
39-
run: dotnet nuget push ${{ github.workspace }}\output\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
40-
38+
- name: Run Push for Common
39+
continue-on-error: true
40+
run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Common*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
41+
42+
- name: Extract MAUI Package Version from CHANGELOG.md
43+
id: extract_maui_version
44+
shell: bash
45+
run: |
46+
MAUI_VERSION=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+/ {print $2; exit}' PowerSync/PowerSync.Maui/CHANGELOG.md)
47+
echo "Detected Version: $MAUI_VERSION"
48+
echo "VERSION=$MAUI_VERSION" >> $GITHUB_ENV
49+
50+
- name: Run Pack For MAUI
51+
run: dotnet pack PowerSync/PowerSync.Maui -c Release -o ${{ github.workspace }}/output
52+
53+
- name: Run Push For MAUI
54+
continue-on-error: true
55+
run: dotnet nuget push ${{ github.workspace }}\output\PowerSync.Maui*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ obj/
1414
*.log
1515
*.tlog
1616
*.dmp
17+
*.tmp
1718

1819
# Visual Studio specific
1920
.vscode/
@@ -61,8 +62,9 @@ TestResults/
6162
*.dylib
6263
*.dll
6364
*.so
64-
65+
*.xcframework
6566
.env
67+
*NativeLibs
6668

6769
# Ignore user id file
6870
user_id.txt

PowerSync/PowerSync.Common/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# PowerSync.Common Changelog
2+
3+
## 0.0.3-alpha.1
4+
- Minor changes to accommodate PowerSync.MAUI package extension.
5+
16
## 0.0.2-alpha.2
27

38
- Updated core extension to v0.3.14

PowerSync/PowerSync.Common/Client/PowerSyncDatabase.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public class DBAdapterSource(IDBAdapter Adapter) : IDatabaseSource
3535
public IDBAdapter Adapter { get; init; } = Adapter;
3636
}
3737

38-
public class OpenFactorySource(ISQLOpenFactory Factory) : IDatabaseSource
39-
{
40-
public ISQLOpenFactory Factory { get; init; } = Factory;
41-
}
42-
4338
public class PowerSyncDatabaseOptions() : BasePowerSyncDatabaseOptions()
4439
{
4540
/// <summary>
@@ -115,9 +110,9 @@ public PowerSyncDatabase(PowerSyncDatabaseOptions options)
115110
{
116111
Database = adapterSource.Adapter;
117112
}
118-
else if (options.Database is OpenFactorySource factorySource)
113+
else if (options.Database is ISQLOpenFactory factorySource)
119114
{
120-
Database = factorySource.Factory.OpenDatabase();
115+
Database = factorySource.OpenDatabase();
121116
}
122117
else if (options.Database is SQLOpenOptions openOptions)
123118
{

PowerSync/PowerSync.Common/Client/SQLOpenFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class SQLOpenOptions : IDatabaseSource
1515
public string? DbLocation { get; set; }
1616
}
1717

18-
public interface ISQLOpenFactory
18+
public interface ISQLOpenFactory: IDatabaseSource
1919
{
2020
/// <summary>
2121
/// Opens a connection adapter to a SQLite Database.

PowerSync/PowerSync.Common/DB/Crud/SyncStatus.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@ public class SyncDataFlowStatus
1010
[JsonProperty("uploading")]
1111
public bool Uploading { get; set; } = false;
1212

13+
[JsonProperty("downloadError")]
14+
public string? DownloadErrorMessage => DownloadError?.Message;
15+
16+
[JsonProperty("uploadError")]
17+
public string? UploadErrorMessage => UploadError?.Message;
18+
1319
/// <summary>
1420
/// Error during downloading (including connecting).
1521
/// Cleared on the next successful data download.
1622
/// </summary>
17-
[JsonProperty("downloadError")]
23+
[JsonIgnore]
1824
public Exception? DownloadError { get; set; } = null;
1925

2026
/// <summary>
2127
/// Error during uploading.
2228
/// Cleared on the next successful upload.
2329
/// </summary>
24-
[JsonProperty("uploadError")]
30+
[JsonIgnore]
2531
public Exception? UploadError { get; set; } = null;
2632
}
2733

PowerSync/PowerSync.Common/MDSQLite/MDSQLiteAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static SqliteConnection OpenDatabase(string dbFilename)
129129
return connection;
130130
}
131131

132-
private void LoadExtension(SqliteConnection db)
132+
protected virtual void LoadExtension(SqliteConnection db)
133133
{
134134
string extensionPath = PowerSyncPathResolver.GetNativeLibraryPath(AppContext.BaseDirectory);
135135
db.EnableExtensions(true);

PowerSync/PowerSync.Common/MDSQLite/MDSQLiteDBOpenFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class MDSQLiteOpenFactoryOptions : SQLOpenOptions
88
public MDSQLiteOptions? SqliteOptions { get; set; }
99
}
1010

11-
public class MDSqliteDBOpenFactory : ISQLOpenFactory
11+
public class MDSQLiteDBOpenFactory : ISQLOpenFactory
1212
{
1313
private readonly MDSQLiteOpenFactoryOptions options;
1414

15-
public MDSqliteDBOpenFactory(MDSQLiteOpenFactoryOptions options)
15+
public MDSQLiteDBOpenFactory(MDSQLiteOpenFactoryOptions options)
1616
{
1717
this.options = options;
1818
}

PowerSync/PowerSync.Common/PowerSync.Common.csproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net9.0;net8.0-ios;net8.0-android</TargetFrameworks>
55
<LangVersion>12</LangVersion>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
@@ -19,6 +19,7 @@
1919
<PackageIcon>icon.png</PackageIcon>
2020
<NoWarn>NU5100</NoWarn>
2121
<PackageReadmeFile>README.md</PackageReadmeFile>
22+
<DefaultItemExcludes>$(DefaultItemExcludes);runtimes/**/*.*;</DefaultItemExcludes>
2223
</PropertyGroup>
2324

2425
<ItemGroup>
@@ -29,20 +30,20 @@
2930
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
3031
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
3132
</ItemGroup>
32-
33-
<!-- For monorepo, test if we can remove this in monorepo -->
34-
<ItemGroup>
33+
34+
<!-- Check allows us to skip for all MAUI targets-->
35+
<!-- For monorepo-->
36+
<ItemGroup Condition="!$(TargetFramework.Contains('-'))">
3537
<Content Include="runtimes\**\*.*">
3638
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3739
</Content>
3840
</ItemGroup>
3941

4042
<!-- For releasing runtimes -->
41-
<ItemGroup>
43+
<ItemGroup Condition="!$(TargetFramework.Contains('-'))">
4244
<None Include="runtimes\**\*.*" Pack="true" PackagePath="runtimes\" />
4345
</ItemGroup>
44-
45-
46+
4647
<ItemGroup>
4748
<None Include="..\..\icon.png" Pack="true" PackagePath=""/>
4849
<None Include="README.md" Pack="true" PackagePath=""/>

0 commit comments

Comments
 (0)