-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from LiamMorrow/renovate/major-dotnet-monorepo
chore(deps): update dotnet monorepo to v9 (major)
- Loading branch information
Showing
27 changed files
with
187 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
dotnet-version: 9.0.x | ||
- name: Setup MAUI android | ||
run: dotnet workload install android | ||
# When running on a self hosted mac runner, the ios workload needs to be installed due to csproj configuration | ||
|
@@ -26,7 +26,7 @@ jobs: | |
- name: Setup MAUI | ||
run: dotnet workload restore | ||
- name: Restore dependencies | ||
run: dotnet restore -p:TargetFramework=net8.0-android | ||
run: dotnet restore -p:TargetFramework=net9.0-android | ||
- name: Put keystore | ||
env: | ||
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | ||
|
@@ -52,7 +52,7 @@ jobs: | |
run: dotnet build -c Release | ||
working-directory: ./LiftLog.Ui | ||
- name: Build | ||
run: dotnet publish -p:TargetFramework=net8.0-android -f net8.0-android -c Release -p:BuildFor=android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=liftlog.keystore -p:AndroidSigningKeyAlias=liftlog -p:AndroidSigningKeyPass=env:KEYSTORE_PASS -p:AndroidSigningStorePass=env:KEYSTORE_PASS -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }} | ||
run: dotnet publish -p:TargetFramework=net9.0-android -f net9.0-android -c Release -p:BuildFor=android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=liftlog.keystore -p:AndroidSigningKeyAlias=liftlog -p:AndroidSigningKeyPass=env:KEYSTORE_PASS -p:AndroidSigningStorePass=env:KEYSTORE_PASS -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }} | ||
working-directory: ./LiftLog.Maui | ||
env: | ||
KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | ||
|
@@ -61,7 +61,7 @@ jobs: | |
uses: r0adkll/[email protected] | ||
with: | ||
packageName: com.limajuice.liftlog | ||
releaseFiles: LiftLog.Maui/bin/Release/net8.0-android/publish/com.limajuice.liftlog-Signed.aab | ||
releaseFiles: LiftLog.Maui/bin/Release/net9.0-android/publish/com.limajuice.liftlog-Signed.aab | ||
track: internal | ||
status: completed | ||
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
namespace LiftLog.Api.Db; | ||
|
||
using System.Globalization; | ||
using System.Text; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
public static class ConversionExtensions | ||
{ | ||
private static CultureInfo _culture = CultureInfo.InvariantCulture; | ||
|
||
public static void ToSnakeCaseNames(this ModelBuilder modelBuilder) | ||
{ | ||
_culture = CultureInfo.InvariantCulture; | ||
|
||
SetNames(modelBuilder, NamingConvention.SnakeCase); | ||
} | ||
|
||
public static void ToLowerCaseNames(this ModelBuilder modelBuilder) | ||
{ | ||
_culture = CultureInfo.InvariantCulture; | ||
|
||
SetNames(modelBuilder, NamingConvention.LowerCase); | ||
} | ||
|
||
private static string? NameRewriter(this string name, NamingConvention naming) | ||
{ | ||
if (string.IsNullOrEmpty(name)) | ||
return name; | ||
|
||
return naming == NamingConvention.SnakeCase | ||
? SnakeCaseNameRewriter(name) | ||
: LowerCaseNameRewriter(name); | ||
} | ||
|
||
private enum NamingConvention | ||
{ | ||
SnakeCase, | ||
LowerCase, | ||
} | ||
|
||
private static void SetNames(ModelBuilder modelBuilder, NamingConvention naming) | ||
{ | ||
_culture = CultureInfo.InvariantCulture; | ||
|
||
foreach (var entity in modelBuilder.Model.GetEntityTypes()) | ||
{ | ||
entity.SetViewName(entity.GetViewName()?.NameRewriter(naming)); | ||
entity.SetSchema(entity.GetSchema()?.NameRewriter(naming)); | ||
entity.SetTableName(entity.GetTableName()?.NameRewriter(naming)); | ||
|
||
foreach (var property in entity!.GetProperties()) | ||
{ | ||
property.SetColumnName(property.GetColumnName()?.NameRewriter(naming)); | ||
} | ||
|
||
foreach (var key in entity.GetKeys()) | ||
{ | ||
key.SetName(key.GetName()?.NameRewriter(naming)); | ||
} | ||
|
||
foreach (var key in entity.GetForeignKeys()) | ||
{ | ||
key.SetConstraintName(key.GetConstraintName()?.NameRewriter(naming)); | ||
} | ||
|
||
foreach (var index in entity.GetIndexes()) | ||
{ | ||
index.SetDatabaseName(index.GetDatabaseName()?.NameRewriter(naming)); | ||
} | ||
} | ||
} | ||
|
||
private static string? LowerCaseNameRewriter(string name) => name.ToLower(_culture); | ||
|
||
// https://github.com/efcore/EFCore.NamingConventions/blob/main/EFCore.NamingConventions/Internal/SnakeCaseNameRewriter.cs | ||
private static string SnakeCaseNameRewriter(string name) | ||
{ | ||
var builder = new StringBuilder(name.Length + Math.Min(2, name.Length / 5)); | ||
var previousCategory = default(UnicodeCategory?); | ||
|
||
for (var currentIndex = 0; currentIndex < name.Length; currentIndex++) | ||
{ | ||
var currentChar = name[currentIndex]; | ||
if (currentChar == '_') | ||
{ | ||
builder.Append('_'); | ||
previousCategory = null; | ||
continue; | ||
} | ||
|
||
var currentCategory = char.GetUnicodeCategory(currentChar); | ||
switch (currentCategory) | ||
{ | ||
case UnicodeCategory.UppercaseLetter: | ||
case UnicodeCategory.TitlecaseLetter: | ||
if ( | ||
previousCategory == UnicodeCategory.SpaceSeparator | ||
|| previousCategory == UnicodeCategory.LowercaseLetter | ||
|| previousCategory != UnicodeCategory.DecimalDigitNumber | ||
&& previousCategory != null | ||
&& currentIndex > 0 | ||
&& currentIndex + 1 < name.Length | ||
&& char.IsLower(name[currentIndex + 1]) | ||
) | ||
{ | ||
builder.Append('_'); | ||
} | ||
|
||
currentChar = char.ToLower(currentChar, _culture); | ||
break; | ||
|
||
case UnicodeCategory.LowercaseLetter: | ||
case UnicodeCategory.DecimalDigitNumber: | ||
if (previousCategory == UnicodeCategory.SpaceSeparator) | ||
{ | ||
builder.Append('_'); | ||
} | ||
break; | ||
|
||
default: | ||
if (previousCategory != null) | ||
{ | ||
previousCategory = UnicodeCategory.SpaceSeparator; | ||
} | ||
continue; | ||
} | ||
|
||
builder.Append(currentChar); | ||
previousCategory = currentCategory; | ||
} | ||
|
||
return builder.ToString().ToLower(_culture); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.