Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/new-update-ap…
Browse files Browse the repository at this point in the history
…i-senses

Resolved LfClassicMiniLcmApi.cs merge conflict
  • Loading branch information
rmunn committed Dec 3, 2024
2 parents 95441bb + 62e2c19 commit ed47f90
Show file tree
Hide file tree
Showing 203 changed files with 3,543 additions and 1,290 deletions.
7 changes: 4 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.10",
"version": "9.0.0",
"commands": [
"dotnet-ef"
]
],
"rollForward": false
}
}
}
}
2 changes: 2 additions & 0 deletions .github/workflows/develop-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- 'backend/**'
- '!backend/FwLite/**'
- 'frontend/**'
- '.github/workflows/lexbox-api.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/lexbox-deployment.yaml'
Expand All @@ -14,6 +15,7 @@ on:
paths:
- 'backend/**'
- '!backend/FwLite/**'
- 'frontend/**'
- '.github/workflows/lexbox-api.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/lexbox-deployment.yaml'
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/fw-lite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ jobs:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'
- uses: actions/setup-node@v4
with:
node-version-file: './frontend/package.json'

- name: Setup Maui
run: dotnet workload install maui-windows

- name: Set Version
id: setVersion
shell: bash
Expand Down Expand Up @@ -86,7 +90,7 @@ jobs:
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'

- name: Dotnet build
working-directory: backend/FwLite/LocalWebApp
Expand Down Expand Up @@ -123,7 +127,7 @@ jobs:
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'

- name: Dotnet build
working-directory: backend/FwLite/LocalWebApp
Expand Down Expand Up @@ -156,7 +160,7 @@ jobs:
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'

- name: Setup Maui
run: dotnet workload install maui-windows
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/integration-test-gha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Install Task
uses: arduino/setup-task@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
env:
DOTNET_INSTALL_DIR: ${{ inputs.runs-on == 'self-hosted' && '/opt/hostedtoolcache/dotnet' || '' }} #poor man's conditional
with:
dotnet-version: '8.x'
dotnet-version: '9.x'
- uses: MatteoH2O1999/setup-python@429b7dee8a48c31eb72ce0b420ea938ff51c2f11 # v3.2.1
id: python
if: ${{ inputs.runs-on != 'windows-latest' && !env.act && inputs.hg-version == '3' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lexbox-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'
- name: Install Task
uses: arduino/setup-task@v2
with:
Expand Down
9 changes: 8 additions & 1 deletion LexBox.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "backend\Testing\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixFwData", "backend\FixFwData\FixFwData.csproj", "{D7FC8B93-15A1-4D0B-9EAB-45596DB147F4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LfNext", "LfNext", "{7B6E21C4-5AF4-4505-B7D9-59A3886C5090}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FwLite", "FwLite", "{7B6E21C4-5AF4-4505-B7D9-59A3886C5090}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LfClassicData", "backend\LfClassicData\LfClassicData.csproj", "{E8BB768B-C3DC-4BE6-9B9F-82319E05AF86}"
EndProject
Expand Down Expand Up @@ -53,6 +53,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniLcm.Tests", "backend\Fw
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FwHeadless", "backend\FwHeadless\FwHeadless.csproj", "{ECBA46AB-AF87-4D4D-9716-FD77264B817F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FwLiteShared", "backend\FwLite\FwLiteShared\FwLiteShared.csproj", "{73DC604C-C501-410D-B56B-0544AD6EF1C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -145,6 +147,10 @@ Global
{ECBA46AB-AF87-4D4D-9716-FD77264B817F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECBA46AB-AF87-4D4D-9716-FD77264B817F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECBA46AB-AF87-4D4D-9716-FD77264B817F}.Release|Any CPU.Build.0 = Release|Any CPU
{73DC604C-C501-410D-B56B-0544AD6EF1C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73DC604C-C501-410D-B56B-0544AD6EF1C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73DC604C-C501-410D-B56B-0544AD6EF1C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73DC604C-C501-410D-B56B-0544AD6EF1C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -165,6 +171,7 @@ Global
{5A9011D8-6EC1-4550-BDD7-AFF00DB2B921} = {7B6E21C4-5AF4-4505-B7D9-59A3886C5090}
{00AE5440-0E36-4488-935B-5B11301BA57D} = {7B6E21C4-5AF4-4505-B7D9-59A3886C5090}
{ECBA46AB-AF87-4D4D-9716-FD77264B817F} = {7B6E21C4-5AF4-4505-B7D9-59A3886C5090}
{73DC604C-C501-410D-B56B-0544AD6EF1C2} = {7B6E21C4-5AF4-4505-B7D9-59A3886C5090}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {440AE83C-6DB0-4F18-B2C1-BCD33F0645B6}
Expand Down
7 changes: 6 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ tasks:
cmds:
- tilt up

# dev
prod-ui-up:
interactive: true
desc: 'Starts the cluster using the production build of UI, good for automated testing'
cmds:
- tilt up -- --prod-ui-build
# dev
infra-up:
desc: 'Starts infrastructure for our ui and api, does not forward ports for api, if you want port forwarding use k8s:infra-forward'
cmds:
Expand Down
31 changes: 20 additions & 11 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
version_settings(constraint='>=0.33.20')
secret_settings(disable_scrub=True)
config.define_bool("lexbox-api-local")
config.define_bool("prod-ui-build")
cfg = config.parse()
forward_lexbox = not cfg.get("lexbox-api-local", False)
prod_ui_build = cfg.get("prod-ui-build", False)

docker_build(
'local-dev-init',
Expand All @@ -28,21 +30,28 @@ docker_build(
context='backend',
dockerfile='./backend/FwHeadless/dev.Dockerfile',
only=['.'],
ignore=['LexBoxApi'],
ignore=['LexBoxApi', '**/Mercurial', '**/MercurialExtensions'],
live_update=[
sync('backend', '/src/backend')
]
)

docker_build(
'ghcr.io/sillsdev/lexbox-ui',
context='frontend',
dockerfile='./frontend/dev.Dockerfile',
only=['.'],
live_update=[
sync('frontend', '/app'),
]
)
if prod_ui_build:
docker_build(
'ghcr.io/sillsdev/lexbox-ui',
context='frontend',
dockerfile='./frontend/Dockerfile',
only=['.']
)
else:
docker_build(
'ghcr.io/sillsdev/lexbox-ui',
context='frontend',
dockerfile='./frontend/dev.Dockerfile',
only=['.'],
live_update=[
sync('frontend', '/app'),
]
)

docker_build(
'ghcr.io/sillsdev/lexbox-hgweb',
Expand Down
3 changes: 3 additions & 0 deletions backend/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<BaseOutputPath>$(MSBuildProjectDirectory)/bin/container/</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<InformationalVersion>dev</InformationalVersion>
<TargetFramework>net9.0</TargetFramework>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build

COPY . .
# WORKDIR /src
Expand Down
13 changes: 8 additions & 5 deletions backend/FixFwData/FixFwData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FixFwData</RootNamespace>
<Description>FixFwData</Description>
<Company>SIL Global</Company>
<Authors>SIL Global</Authors>
<Product>LexBoxApi Testing</Product>
<Copyright>Copyright © 2024 SIL Global</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="SIL.LCModel.FixData" Version="11.0.0-beta0109" />
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions backend/FwHeadless/FwHeadless.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Mercurial4ChorusDestDir>$(MSBuildProjectDirectory)</Mercurial4ChorusDestDir>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0-rc.1.24452.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Scalar.AspNetCore" Version="1.2.22" />
<PackageReference Include="SIL.ChorusPlugin.LfMergeBridge" Version="4.2.0-beta0027" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.*" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion backend/FwHeadless/HttpClientAuthHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
private async Task SetAuthHeader(HttpRequestMessage request, CancellationToken cancellationToken, Uri lexboxUrl)
{
var cookieContainer = new CookieContainer();
cookieContainer.Add(new Cookie(LexAuthConstants.AuthCookieName, await GetToken(cancellationToken), null, lexboxUrl.Authority));
cookieContainer.Add(new Cookie(LexAuthConstants.AuthCookieName, await GetToken(cancellationToken), null, lexboxUrl.Host)
{
Port = $"\"{lexboxUrl.Port}\""
});
request.Headers.Add("Cookie", cookieContainer.GetCookieHeader(lexboxUrl));
}

Expand Down
9 changes: 5 additions & 4 deletions backend/FwHeadless/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using FwLiteProjectSync;
using LcmCrdt;
using LcmCrdt.RemoteSync;
using LexCore.Sync;
using LexData;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.Extensions.Options;
Expand Down Expand Up @@ -51,13 +52,13 @@

app.Run();

static async Task<Results<Ok<CrdtFwdataProjectSyncService.SyncResult>, NotFound, ProblemHttpResult>> ExecuteMergeRequest(
static async Task<Results<Ok<SyncResult>, NotFound, ProblemHttpResult>> ExecuteMergeRequest(
ILogger<Program> logger,
IServiceProvider services,
SendReceiveService srService,
IOptions<FwHeadlessConfig> config,
FwDataFactory fwDataFactory,
ProjectsService projectsService,
CrdtProjectsService projectsService,
ProjectLookupService projectLookupService,
CrdtFwdataProjectSyncService syncService,
CrdtHttpSyncService crdtHttpSyncService,
Expand All @@ -69,7 +70,7 @@
if (dryRun)
{
logger.LogInformation("Dry run, not actually syncing");
return TypedResults.Ok(new CrdtFwdataProjectSyncService.SyncResult(0, 0));
return TypedResults.Ok(new SyncResult(0, 0));
}

var projectCode = await projectLookupService.GetProjectCode(projectId);
Expand Down Expand Up @@ -136,7 +137,7 @@ static async Task<FwDataMiniLcmApi> SetupFwData(FwDataProject fwDataProject,
static async Task<CrdtProject> SetupCrdtProject(string crdtFile,
ProjectLookupService projectLookupService,
Guid projectId,
ProjectsService projectsService,
CrdtProjectsService projectsService,
string projectFolder,
Guid fwProjectId,
string lexboxUrl)
Expand Down
4 changes: 2 additions & 2 deletions backend/FwHeadless/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ WORKDIR /src/backend
# Uncomment line below if second COPY fails
# RUN mkdir -p FwLite && chown www-data:www-data FwLite
# Copy the main source project files
COPY --chown=www-data:www-data *.sln FwHeadless/FwHeadless.csproj FixFwData/FixFwData.csproj LexCore/LexCore.csproj LexData/LexData.csproj ./
COPY --chown=www-data:www-data *.sln FwHeadless/FwHeadless.csproj FixFwData/FixFwData.csproj LexCore/LexCore.csproj LexData/LexData.csproj Directory.Build.props ./
# move them into the proper sub folders, based on the name of the project
RUN for file in $(ls *.csproj); do dir=${file%.*}; mkdir -p ${dir}/ && mv -v $file ${dir}/; done
# Do the same for csproj files in slightly different hierarchies
COPY --chown=www-data:www-data harmony/src/*/*.csproj ./
RUN for file in $(ls *.csproj); do dir=${file%.*}; mkdir -p harmony/src/${dir}/ && mv -v $file harmony/src/${dir}/; done
COPY --chown=www-data:www-data harmony/src/Directory.Build.props ./harmony/src/
COPY --chown=www-data:www-data harmony/src/Directory.Build.props harmony/Directory.Packages.props ./harmony/src/
COPY --chown=www-data:www-data FwLite/FwDataMiniLcmBridge/FwDataMiniLcmBridge.csproj FwLite/LcmCrdt/LcmCrdt.csproj FwLite/MiniLcm/MiniLcm.csproj FwLite/FwLiteProjectSync/FwLiteProjectSync.csproj ./
RUN for file in $(ls *.csproj); do dir=${file%.*}; mkdir -p FwLite/${dir}/ && mv -v $file FwLite/${dir}/; done

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ namespace FwDataMiniLcmBridge.Tests.Fixtures;

public static class FwDataTestsKernel
{
public static IServiceCollection AddTestFwDataBridge(this IServiceCollection services)
public static IServiceCollection AddTestFwDataBridge(this IServiceCollection services, bool mockProjectLoader = true)
{
services.AddFwDataBridge();
services.AddSingleton<IConfiguration>(_ => new ConfigurationRoot([]));
services.AddSingleton<MockFwProjectLoader>();
services.AddSingleton<IProjectLoader>(sp => sp.GetRequiredService<MockFwProjectLoader>());
services.AddSingleton<FieldWorksProjectList, MockFwProjectList>();
if (mockProjectLoader)
{
services.AddSingleton<MockFwProjectLoader>();
services.AddSingleton<IProjectLoader>(sp => sp.GetRequiredService<MockFwProjectLoader>());
services.AddSingleton<FieldWorksProjectList, MockFwProjectList>();
}
return services;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class MockFwProjectList(IOptions<FwDataBridgeConfig> config, MockFwProjec
{
public override IEnumerable<IProjectIdentifier> EnumerateProjects()
{
return loader.Projects.Keys.Select(k => new FwDataProject(k, config.Value.ProjectsFolder));
return loader.Projects.Keys.Select(k => new FwDataProject(k, _config.Value.ProjectsFolder));
}

public override FwDataProject? GetProject(string name)
Expand Down
Loading

0 comments on commit ed47f90

Please sign in to comment.