diff --git a/.github/workflows/docker-build-fw9only.yml b/.github/workflows/docker-build-fw9only.yml deleted file mode 100644 index bc22bd37..00000000 --- a/.github/workflows/docker-build-fw9only.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: docker-build-fw9only - -on: - # Don't run automatically, YET - # push: - # branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] - pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - calculate_branches: - runs-on: ubuntu-latest - steps: - - name: Check out current branch - uses: actions/checkout@v3.0.2 - with: - fetch-depth: 0 # All history for all tags and branches, since branch calculation step needs that - - - name: Calculate branches to build - run: | - echo "${GITHUB_REF}" - ./calculate-branches.sh --no-fw8 | grep FW9Branch >> "${GITHUB_ENV}" - - - name: Save branch names in output - id: branches_to_build - run: | - echo "FW9Branch=${FW9Branch}" - echo "::set-output name=FW9Branch::${FW9Branch}" - - outputs: - FW9Branch: ${{ steps.branches_to_build.outputs.FW9Branch }} - - build: - runs-on: ubuntu-latest - needs: calculate_branches - - # As of 2022-xx-xx, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) - strategy: - matrix: - dbversion: [7000072] - distro: [ 'bionic' ] - - steps: - - name: Check out current branch - uses: actions/checkout@v3.0.2 - with: - fetch-depth: 0 # All history for all tags and branches, since version number script needs that - - - name: Verify current branch - run: | - git branch --contains HEAD --format '%(refname)' - echo FW9 was "${FW9Branch}" - env: - FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - - - name: Calculate version number - id: version - env: - BUILD_NUMBER: ${{ github.run_number }} - DbVersion: ${{ matrix.dbversion }} - run: docker/scripts/get-version-number.sh - - - name: Save current version number to an output - id: output_version_number - run: | - echo Will tag ${{matrix.dbversion}} with ${TAG} - echo "::set-output name=TagFor${{matrix.dbversion}}::${TAG}" - echo "::set-output name=VersionFor${{matrix.dbversion}}::${VERSION}" - env: - TAG: v${{ steps.version.outputs.MsBuildVersion }} - VERSION: ${{ steps.version.outputs.MsBuildVersion }} - - - name: Set up buildx for Docker - # docker/setup-buildx-action@v2.0.0 is commit dc7b9719a96d48369863986a06765841d7ea23f6 - uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 - - - name: Find current UID - id: uid - run: echo "::set-output name=uid::$(id -u)" - - - name: Build DBVersion-specific Docker image - # docker/build-push-action@v3.0.0 is commit e551b19e49efd4e98792db7592c17c09b89db8d8 - uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 - with: - push: false - load: true - tags: lfmerge-build-${{matrix.dbversion}} - context: . - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - DbVersion=${{matrix.dbversion}} - BUILDER_UID=${{steps.uid.outputs.uid}} - - - name: Run docker image ls to verify build - run: docker image ls - - - name: Run the build container - env: - BUILD_NUMBER: ${{ github.run_number }} - DebPackageVersion: ${{ steps.version.outputs.DebPackageVersion }} - MsBuildVersion: ${{ steps.version.outputs.MsBuildVersion }} - MajorMinorPatch: ${{ steps.version.outputs.MajorMinorPatch }} - AssemblySemVer: ${{ steps.version.outputs.AssemblySemVer }} - AssemblySemFileVer: ${{ steps.version.outputs.AssemblySemFileVer }} - InformationalVersion: ${{ steps.version.outputs.InformationalVersion }} - run: docker run --mount type=bind,source="$(pwd)",target=/home/builder/repo --env "BUILD_NUMBER=${BUILD_NUMBER}" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --name tmp-lfmerge-build-${{matrix.dbversion}} lfmerge-build-${{matrix.dbversion}} - - - name: Collect tarball images - run: docker container cp tmp-lfmerge-build-${{matrix.dbversion}}:/home/builder/packages/lfmerge/tarball ./ - - - name: Compress tarball images for faster uploads - run: time (tar cf - tarball | gzip -c9 > tarball.tar.gz) - - - uses: actions/upload-artifact@v3.0.0 - with: - name: lfmerge-tarball - path: tarball.tar.gz - outputs: - MsBuildVersion: ${{ steps.output_version_number.outputs.VersionFor7000072 }} - TagFor7000072: ${{ steps.output_version_number.outputs.TagFor7000072 }} - FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - - release: - needs: build - uses: ./.github/workflows/release-fw9only.yml - with: - MsBuildVersion: ${{ needs.build.outputs.MsBuildVersion }} - TagFor7000072: ${{ needs.build.outputs.TagFor7000072 }} - FW9Branch: ${{ needs.build.outputs.FW9Branch }} diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index dd05c790..d8141ac2 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,9 +2,9 @@ name: docker-build on: push: - branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] + branches: [ master, qa, live ] pull_request: - branches: [ master, fieldworks8-master ] + branches: [ master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -14,59 +14,45 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out current branch - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.2 with: fetch-depth: 0 # All history for all tags and branches, since branch calculation step needs that - name: Calculate branches to build run: | echo "${GITHUB_REF}" - ./calculate-branches.sh | grep FW.Branch >> "${GITHUB_ENV}" + ./calculate-branches.sh --no-fw8 | grep FW9Branch >> "${GITHUB_ENV}" - name: Save branch names in output id: branches_to_build run: | - echo "FW8Branch=${FW8Branch}" echo "FW9Branch=${FW9Branch}" - echo "::set-output name=FW8Branch::${FW8Branch}" echo "::set-output name=FW9Branch::${FW9Branch}" outputs: - FW8Branch: ${{ steps.branches_to_build.outputs.FW8Branch }} FW9Branch: ${{ steps.branches_to_build.outputs.FW9Branch }} build: runs-on: ubuntu-latest needs: calculate_branches - # As of 2021-11-24, we build LfMerge for LCM DB versions 68-72 (and there is no 71) + # As of 2022-08-16, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) strategy: matrix: - dbversion: [7000068, 7000069, 7000070, 7000072] + dbversion: [7000072] distro: [ 'bionic' ] steps: - - name: Check out FW8 branch - uses: actions/checkout@v2.4.0 - if: matrix.dbversion < 7000072 - with: - ref: ${{ needs.calculate_branches.outputs.FW8Branch }} - fetch-depth: 0 # All history for all tags and branches, since GitVersion needs that - - - name: Check out FW9 branch - uses: actions/checkout@v2.4.0 - if: matrix.dbversion >= 7000072 + - name: Check out current branch + uses: actions/checkout@v3.0.2 with: - ref: ${{ needs.calculate_branches.outputs.FW9Branch }} - fetch-depth: 0 # All history for all tags and branches, since GitVersion needs that + fetch-depth: 0 # All history for all tags and branches, since version number script needs that - name: Verify current branch run: | git branch --contains HEAD --format '%(refname)' - echo FW8 was "${FW8Branch}" echo FW9 was "${FW9Branch}" env: - FW8Branch: ${{ needs.calculate_branches.outputs.FW8Branch }} FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - name: Calculate version number @@ -87,16 +73,16 @@ jobs: VERSION: ${{ steps.version.outputs.MsBuildVersion }} - name: Set up buildx for Docker - # docker/setup-buildx-action@v1.6.0 is commit 94ab11c41e45d028884a99163086648e898eed25 - uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 + # docker/setup-buildx-action@v2.0.0 is commit dc7b9719a96d48369863986a06765841d7ea23f6 + uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 - name: Find current UID id: uid run: echo "::set-output name=uid::$(id -u)" - name: Build DBVersion-specific Docker image - # docker/build-push-action@v2.7.0 is commit a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 + # docker/build-push-action@v3.0.0 is commit e551b19e49efd4e98792db7592c17c09b89db8d8 + uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 with: push: false load: true @@ -128,17 +114,13 @@ jobs: - name: Compress tarball images for faster uploads run: time (tar cf - tarball | gzip -c9 > tarball.tar.gz) - - uses: actions/upload-artifact@v2.2.4 + - uses: actions/upload-artifact@v3.0.0 with: - name: lfmerge-tarball-${{matrix.dbversion}} + name: lfmerge-tarball path: tarball.tar.gz outputs: MsBuildVersion: ${{ steps.output_version_number.outputs.VersionFor7000072 }} - TagFor7000068: ${{ steps.output_version_number.outputs.TagFor7000068 }} - TagFor7000069: ${{ steps.output_version_number.outputs.TagFor7000069 }} - TagFor7000070: ${{ steps.output_version_number.outputs.TagFor7000070 }} TagFor7000072: ${{ steps.output_version_number.outputs.TagFor7000072 }} - FW8Branch: ${{ needs.calculate_branches.outputs.FW8Branch }} FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} release: @@ -146,7 +128,5 @@ jobs: uses: ./.github/workflows/release.yml with: MsBuildVersion: ${{ needs.build.outputs.MsBuildVersion }} - TagFor7000070: ${{ needs.build.outputs.TagFor7000070 }} TagFor7000072: ${{ needs.build.outputs.TagFor7000072 }} - FW8Branch: ${{ needs.build.outputs.FW8Branch }} FW9Branch: ${{ needs.build.outputs.FW9Branch }} diff --git a/.github/workflows/release-fw9only.yml b/.github/workflows/release-fw9only.yml deleted file mode 100644 index abd1a7bf..00000000 --- a/.github/workflows/release-fw9only.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: release-fw9only - -on: - workflow_call: - inputs: - MsBuildVersion: - required: true - type: string - FW9Branch: - required: true - type: string - TagFor7000072: - required: true - type: string - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2.4.0 - with: - fetch-depth: 0 - - - name: Ensure all TagForDbVersion outputs were present - env: - TAG72: ${{ inputs.TagFor7000072 }} - run: | - echo "Tag for FW9 (DbVersion 72): (${TAG72})" - - - name: Tag release branches - if: github.event_name == 'push' && github.ref == 'refs/heads/live' - env: - FW9Branch: ${{ inputs.FW9Branch }} - TAG72: ${{ inputs.TagFor7000072 }} - run: | - git config --global user.name "github-actions" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -f -a -m "Release ${TAG72}" "${TAG72}" "refs/remotes/origin/${FW9Branch}" - git push -v origin "${TAG72}" - - - name: Download build artifacts - uses: actions/download-artifact@v2.0.10 - with: - # No name specified, so will download all artifacts - path: all-tarballs - - - name: Verify that download step worked - run: ls -lR all-tarballs - - - name: Uncompress build artifacts - run: for f in all-tarballs/*/*.tar.gz; do gzip -cd "${f}" | tar xf -; done - - - name: Verify that uncompress step worked - run: ls -lR tarball - - - name: Restore executable bits - # GitHub artifacts system strips executable bits, so restore them here - # TODO: Now that we upload .tar.gz format, no longer needed since tar format preserves Unix permissions. Verify, then remove this section - run: | - chmod +x tarball/lfmerge*/usr/bin/lfmerge - chmod +x tarball/lfmerge*/usr/bin/lfmergeqm - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/chorusmerge - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/startlfmerge - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/Mercurial/hg - - - name: Login to GHCR - if: github.event_name == 'push' && github.ref == 'refs/heads/live' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build final Docker image - id: lfmerge_image - # docker/build-push-action@v2.7.0 is commit a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - # TODO: Follow https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md for tagging - with: - push: ${{(github.event_name == 'push' && github.ref == 'refs/heads/live')}} - tags: ghcr.io/sillsdev/lfmerge:${{ inputs.MsBuildVersion }},ghcr.io/sillsdev/lfmerge:latest - context: . - file: Dockerfile.finalresult - - - name: Show metadata from LfMerge image build step - run: echo "$METADATA" - env: - METADATA: ${{ steps.lfmerge_image.output.metadata }} - - - name: List Docker images to verify build - run: docker image ls - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1253a8f6..a0a4d450 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,15 +6,9 @@ on: MsBuildVersion: required: true type: string - FW8Branch: - required: true - type: string FW9Branch: required: true type: string - TagFor7000070: - required: true - type: string TagFor7000072: required: true type: string @@ -30,25 +24,20 @@ jobs: - name: Ensure all TagForDbVersion outputs were present env: - TAG70: ${{ inputs.TagFor7000070 }} TAG72: ${{ inputs.TagFor7000072 }} run: | - echo "Tag for FW8 (DbVersion 70): (${TAG70})" echo "Tag for FW9 (DbVersion 72): (${TAG72})" - name: Tag release branches if: github.event_name == 'push' && github.ref == 'refs/heads/live' env: - FW8Branch: ${{ inputs.FW8Branch }} FW9Branch: ${{ inputs.FW9Branch }} - TAG70: ${{ inputs.TagFor7000070 }} TAG72: ${{ inputs.TagFor7000072 }} run: | git config --global user.name "github-actions" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -f -a -m "Release ${TAG70}" "${TAG70}" "refs/remotes/origin/${FW8Branch}" git tag -f -a -m "Release ${TAG72}" "${TAG72}" "refs/remotes/origin/${FW9Branch}" - git push -v origin "${TAG70}" "${TAG72}" + git push -v origin "${TAG72}" - name: Download build artifacts uses: actions/download-artifact@v2.0.10 diff --git a/Dockerfile.finalresult b/Dockerfile.finalresult index 8938c7de..8d595c8a 100644 --- a/Dockerfile.finalresult +++ b/Dockerfile.finalresult @@ -23,6 +23,8 @@ ADD tarball/lfmerge* / RUN mkdir -m 02775 -p /var/lib/languageforge/lexicon/sendreceive/syncqueue /var/lib/languageforge/lexicon/sendreceive/webwork /var/lib/languageforge/lexicon/sendreceive/Templates /var/lib/languageforge/lexicon/sendreceive/state && chown -R www-data:www-data /var/lib/languageforge +RUN install -d -o www-data -g www-data -m 02775 /var/run/lfmerge + # TODO: Turn this into environment variables, because we want to be able to just set env vars in k8s config and restart the container COPY lfmerge.conf /etc/languageforge/conf/sendreceive.conf COPY sudoers.d.lfmerge.conf /etc/sudoers.d/lfmerge diff --git a/LfMerge.TestApp/LfMerge.TestApp.csproj b/LfMerge.TestApp/LfMerge.TestApp.csproj index 56a76aa0..839b4e92 100644 --- a/LfMerge.TestApp/LfMerge.TestApp.csproj +++ b/LfMerge.TestApp/LfMerge.TestApp.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 Exe LfMerge.TestApp Debug;Release diff --git a/build/LfMerge.proj b/build/LfMerge.proj index 9b682b99..2a10c516 100644 --- a/build/LfMerge.proj +++ b/build/LfMerge.proj @@ -25,7 +25,6 @@ - - - - - - - - - - - + diff --git a/build/NuGet.targets b/build/NuGet.targets index ab3e8dff..ddec48dd 100644 --- a/build/NuGet.targets +++ b/build/NuGet.targets @@ -1,94 +1,11 @@ - $(MSBuildProjectDirectory)/../ - - - true - packages - - - false - - - true + $(MSBuildProjectDirectory)/.. + $(RootDir)/packages - - - $(MSBuildThisFileDirectory) - - - $(NuGetToolsPath)/nuget.exe - - /opt/mono5-sil/bin/mono $(NuGetExePath) - - - https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - - - - - - - - - - + - - - - - + Command='dotnet restore "$(SolutionPath)" --packages "$(NUGET_PACKAGES)"'/> - - - - - - - - - - - - - - - - - diff --git a/build/nuget b/build/nuget deleted file mode 100755 index 431794f1..00000000 --- a/build/nuget +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# This file is a workaround for using the current nuget.exe (which works with nuget packages that -# specify dependencies for multiple frameworks, but requires a newer mono version) and having to -# still use mono 3.x for building and running the project. - -if [ -f /opt/mono5-sil/bin/mono ]; then - export MONO_PREFIX=/opt/mono5-sil -elif [ -f /opt/mono4-sil/bin/mono ]; then - export MONO_PREFIX=/opt/mono4-sil -else - echo "Need mono4-sil or mono5-sil installed to be able to restore the packages" - exit 1 -fi - -# We don't want/need the FDO assemblies in the path. But if we try to add them the build might -# fail if `lfmerge-fdo` package isn't installed. Therefore we set RUNMODE to skip that step. -cd $(dirname $0)/.. -RUNMODE="NUGET" . environ -cd - - -mono --debug nuget.exe $@ diff --git a/docker/compile-lfmerge.sh b/docker/compile-lfmerge.sh index 7e648d83..792e3ab7 100755 --- a/docker/compile-lfmerge.sh +++ b/docker/compile-lfmerge.sh @@ -2,12 +2,9 @@ echo "Compiling LfMerge and running unit tests" BUILD=Release . environ -echo "Using $(which mono)" -export FrameworkPathOverride=/opt/mono5-sil/lib/mono/4.5 +echo "Using $(which dotnet)" dotnet build /t:CompileOnly /v:detailed /property:Configuration=Release build/LfMerge.proj # TODO: Determine if this symlink is necessary ln -sf ../Mercurial output/ -cd /build/LfMerge/output/Release/net462 -export PATH="${PATH}:/opt/mono5-sil/bin" # TODO: Test all DLLs # dotnet test -f net462 LfMerge.Core.Tests.dll diff --git a/docker/scripts/compile-lfmerge-combined.sh b/docker/scripts/compile-lfmerge-combined.sh index 16dce0e4..23cbce95 100755 --- a/docker/scripts/compile-lfmerge-combined.sh +++ b/docker/scripts/compile-lfmerge-combined.sh @@ -5,17 +5,12 @@ set -e echo "Compiling LfMerge and running unit tests" BUILD=Release . environ -echo "Using $(which mono)" -export FrameworkPathOverride=/opt/mono5-sil/lib/mono/4.5 +echo "Using $(which dotnet)" export DbVersion="${1-7000072}" echo "Building for ${DbVersion}" -if [ "x$1" = "x7000072" ]; then -/opt/mono5-sil/bin/msbuild /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -# dotnet build /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -else -/opt/mono5-sil/bin/msbuild /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -fi + +dotnet build /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj # ln -sf ../Mercurial output/ # xbuild /t:TestOnly /v:detailed /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index 381b6f19..e8cd04b4 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -8,7 +8,8 @@ set -e export HOME=/tmp export XDG_CONFIG_HOME=/tmp/.config export BUILD=Release -export FRAMEWORK=net462 +export FRAMEWORK=net6.0 +export NETSTANDARD=netstandard2.0 export DatabaseVersion=${1:-7000072} @@ -18,7 +19,8 @@ export DBDESTDIR=tarball/lfmerge-${DatabaseVersion} export COMMONDESTDIR=tarball/lfmerge export LIB=usr/lib/lfmerge/${DatabaseVersion} export SHARE=usr/share/lfmerge/${DatabaseVersion} - +export NATIVERUNTIME=runtimes/linux-x64/native +export LIBRUNTIME=runtimes/linux-x64/lib export DBVERSIONPATH=/usr/lib/lfmerge/${DatabaseVersion} # Apparently the downloaded mercurial.ini doesn't have the right fixutf8 config, and it also @@ -34,6 +36,10 @@ EOF # Install binaries install -d ${DBDESTDIR}/${LIB} install -m 644 output/${BUILD}/${FRAMEWORK}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/*.* ${DBDESTDIR}/${LIB} +install -m 644 output/${BUILD}/${FRAMEWORK}/${NATIVERUNTIME}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/${NATIVERUNTIME}/*.* ${DBDESTDIR}/${LIB} +install -m 644 output/${BUILD}/${FRAMEWORK}/${LIBRUNTIME}/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/${LIBRUNTIME}/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB} +install -m 755 output/${BUILD}/${FRAMEWORK}/LfMerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMerge ${DBDESTDIR}/${LIB} +install -m 755 output/${BUILD}/${FRAMEWORK}/LfMergeQueueManager ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMergeQueueManager ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/chorusmerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/chorusmerge ${DBDESTDIR}/${LIB} install -d ${DBDESTDIR}/${LIB}/Mercurial install -d ${DBDESTDIR}/${LIB}/Mercurial/hgext @@ -57,6 +63,13 @@ install -m 644 Mercurial/mercurial/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial install -m 644 Mercurial/mercurial/hgweb/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial/hgweb install -m 644 Mercurial/mercurial/httpclient/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial/httpclient install -m 644 MercurialExtensions/fixutf8/*.* ${DBDESTDIR}/${LIB}/MercurialExtensions/fixutf8 +install -d ${DBDESTDIR}/${LIB}/runtimes +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64 +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native +install -m 644 output/${BUILD}/${FRAMEWORK}/runtimes/linux-x64/lib/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} 2>/dev/null || install -m 644 output/${BUILD}/runtimes/linux-x64/lib/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} +install -m 644 output/${BUILD}/${FRAMEWORK}/runtimes/linux-x64/native/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native 2>/dev/null || install -m 644 output/${BUILD}/runtimes/linux-x64/native/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native # Remove unit test related files (cd ${DBDESTDIR}/${LIB} && \ rm -f *.Tests.dll* *.Tests.pdb* *.TestApp.exe* SIL.TestUtilities.dll* \ diff --git a/docker/scripts/download-dependencies-combined.sh b/docker/scripts/download-dependencies-combined.sh index bba8a8a9..3c9fd147 100755 --- a/docker/scripts/download-dependencies-combined.sh +++ b/docker/scripts/download-dependencies-combined.sh @@ -5,6 +5,9 @@ set -e echo "Downloading dependencies" export MONO_PREFIX=/opt/mono5-sil . environ + +pwd + if [ "x$1" = "x7000072" ]; then msbuild /t:RestorePackages /p:KeepJobsFile=false build/LfMerge.proj else diff --git a/docker/scripts/gitversion-combined.sh b/docker/scripts/gitversion-combined.sh index 5693f196..7a60259a 100755 --- a/docker/scripts/gitversion-combined.sh +++ b/docker/scripts/gitversion-combined.sh @@ -19,7 +19,7 @@ fi export MONO_PREFIX=/opt/mono5-sil RUNMODE="PACKAGEBUILD" BUILD=Release . environ -msbuild /t:RestoreBuildTasks build/LfMerge.proj +# msbuild build/LfMerge.proj mkdir -p output/Release if [ -n "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -a "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -ne 0 ]; then diff --git a/docker/scripts/setup-workspace.sh b/docker/scripts/setup-workspace.sh index a851c09c..9edc84af 100755 --- a/docker/scripts/setup-workspace.sh +++ b/docker/scripts/setup-workspace.sh @@ -22,7 +22,8 @@ cd "${DEST}" if [ "${BRANCH_TO_BUILD}" ]; then git checkout "${BRANCH_TO_BUILD}" fi -git clean -dxf --exclude=packages/ + +git clean -dxf --exclude=packages/ --exclude=build/packages/ git reset --hard # FLExBridge dependencies from FW 8 builds have vanished from TeamCity, so we stored them in the Docker image under ${REPO_ROOT}/docker diff --git a/lfmergeqm b/lfmergeqm index 4b363161..de66874a 100755 --- a/lfmergeqm +++ b/lfmergeqm @@ -42,4 +42,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec mono --debug "$LIB"/LfMergeQueueManager.exe "$@" +exec "$LIB"/LfMergeQueueManager "$@" diff --git a/pbuild.sh b/pbuild.sh index 0a4da42b..027b2d06 100755 --- a/pbuild.sh +++ b/pbuild.sh @@ -96,7 +96,7 @@ fi # Run the build if [ "${BUILD_FW8}" -eq 0 ]; then - docker run --mount type=bind,source="$(pwd)",target=/home/builder/repo --mount type=tmpfs,dst=/tmp --env "BRANCH_TO_BUILD=${FW9_BUILD_BRANCH}" --env "BUILD_NUMBER=999" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --mount type=bind,src=/storage/nuget,dst=/storage/nuget --name tmp-lfmerge-build-7000072 lfmerge-build-7000072 + docker run -it --mount type=bind,source="$(pwd)",target=/home/builder/repo --mount type=tmpfs,dst=/tmp --env "BRANCH_TO_BUILD=${FW9_BUILD_BRANCH}" --env "BUILD_NUMBER=999" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --mount type=bind,src=/storage/nuget,dst=/storage/nuget --name tmp-lfmerge-build-7000072 lfmerge-build-7000072 else time parallel --no-notice < - net462 + net6.0 WinExe FixFwData Debug;Release @@ -35,7 +35,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + diff --git a/src/FixFwData/Program.cs b/src/FixFwData/Program.cs index 88477808..c387489c 100644 --- a/src/FixFwData/Program.cs +++ b/src/FixFwData/Program.cs @@ -12,8 +12,6 @@ using LfMerge.Core.Logging; using SIL.LCModel.FixData; using SIL.LCModel.Utils; -using SyslogLogger = SIL.Linux.Logging.SyslogLogger; -using SIL.PlatformUtilities; namespace FixFwData { @@ -33,16 +31,12 @@ private static int Main(string[] args) return errorsOccurred ? 1 : 0; } - private static SyslogLogger logger = null; private static bool errorsOccurred = false; private static int errorCount = 0; private static void logError(string description, bool errorFixed) { - if (logger == null) - Console.WriteLine(description); - else - logger.Error(description); + Console.WriteLine(description); errorsOccurred = true; if (errorFixed) @@ -57,8 +51,6 @@ private static int getErrorCount() private static void SetUpErrorHandling() { ExceptionLogging.Initialize("17a42e4a67dd2e42d4aa40d8bf2d23ee", Assembly.GetExecutingAssembly().GetName().Name); - if (Platform.IsUnix) - logger = new SyslogLogger("FixFwData"); } private sealed class LoggingProgress : IProgress, IDisposable @@ -81,10 +73,7 @@ public string Message get { return null; } set { - if (logger == null) - Console.Out.WriteLine(value); - else - logger.Info(value); + Console.Out.WriteLine(value); } } diff --git a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj index 92175f69..4bbca072 100644 --- a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj +++ b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj @@ -1,7 +1,7 @@ - net462 + net6.0 LfMerge.Core.Tests Debug;Release LfMerge.Core.Tests @@ -31,12 +31,13 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + + - + + diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index f96be951..ef61cfb9 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -1,7 +1,7 @@ - net462 + netstandard2.0 LfMerge.Core Debug;Release LfMerge.Core @@ -32,18 +32,20 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + - - + + + + - - - - - + + + + + + diff --git a/src/LfMerge.Core/Logging/SyslogLogger.cs b/src/LfMerge.Core/Logging/SyslogLogger.cs deleted file mode 100644 index e0820dfc..00000000 --- a/src/LfMerge.Core/Logging/SyslogLogger.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2016-2018 SIL International -// This software is licensed under the MIT license (http://opensource.org/licenses/MIT) -using System; -using System.Collections.Generic; -using SIL.Linux.Logging; -using SIL.PlatformUtilities; - -namespace LfMerge.Core.Logging -{ - public class SyslogLogger : LoggerBase - { - private SIL.Linux.Logging.SyslogLogger _logger; - - public SyslogLogger(string programName = null) - { - if (Platform.IsLinux) - { - _logger = new SIL.Linux.Logging.SyslogLogger(programName ?? "LfMerge"); - } - } - - private SyslogPriority SeverityToPriority(LogSeverity severity) - { - // If integer values of LogSeverity enum ever change, this function will need to be more complicated - int severityNum = (int)severity; - return (SyslogPriority)severityNum; - } - - public override void LogMany(LogSeverity severity, IEnumerable messages) - { - if (_logger == null) - { - Console.WriteLine(string.Join(Environment.NewLine, messages)); - } - else - { - _logger.LogMany(SeverityToPriority(severity), messages); - } - } - - public override void Log(LogSeverity severity, string message) - { - if (_logger == null) - { - Console.WriteLine(message); - } - else - { - _logger.Log(SeverityToPriority(severity), message); - } - } - } -} - diff --git a/src/LfMerge.Core/MainClass.cs b/src/LfMerge.Core/MainClass.cs index 7a295a4d..ff24f5e5 100644 --- a/src/LfMerge.Core/MainClass.cs +++ b/src/LfMerge.Core/MainClass.cs @@ -53,18 +53,16 @@ internal static ContainerBuilder RegisterTypes() System.Environment.GetEnvironmentVariable(MagicStrings.EnvVar_LoggingDest) ?? System.Environment.GetEnvironmentVariable(MagicStrings.EnvVar_LoggingDestination) ?? "-"; if (logDest == "syslog") { - containerBuilder.RegisterType().SingleInstance().As() - .WithParameter(new TypedParameter(typeof(string), programName)); + Console.WriteLine("WARNING: syslog logging no longer available, logging to console instead"); + } + // TODO: Implement a FileLogger to handle cases where the logDest is a filename, then only use ConsoleLogger if env var is "-" or missing + string stderrThreshholdStr = System.Environment.GetEnvironmentVariable(MagicStrings.EnvVar_LoggingStderrTreshhold) ?? "-"; + LogSeverity stderrThreshhold; + if (System.Enum.TryParse(stderrThreshholdStr, true, out stderrThreshhold)) { + containerBuilder.RegisterType().SingleInstance().As() + .WithParameter(new TypedParameter(typeof(LogSeverity), stderrThreshhold)); } else { - // TODO: Implement a FileLogger to handle cases where the logDest is a filename, then only use ConsoleLogger if env var is "-" or missing - string stderrThreshholdStr = System.Environment.GetEnvironmentVariable(MagicStrings.EnvVar_LoggingStderrTreshhold) ?? "-"; - LogSeverity stderrThreshhold; - if (System.Enum.TryParse(stderrThreshholdStr, true, out stderrThreshhold)) { - containerBuilder.RegisterType().SingleInstance().As() - .WithParameter(new TypedParameter(typeof(LogSeverity), stderrThreshhold)); - } else { - containerBuilder.RegisterType().SingleInstance().As(); - } + containerBuilder.RegisterType().SingleInstance().As(); } containerBuilder.RegisterType().As(); containerBuilder.RegisterType().As(); diff --git a/src/LfMerge.Core/OptionsBase.cs b/src/LfMerge.Core/OptionsBase.cs new file mode 100644 index 00000000..d0d3e0dc --- /dev/null +++ b/src/LfMerge.Core/OptionsBase.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2016 SIL International +// This software is licensed under the MIT license (http://opensource.org/licenses/MIT) +using System.Collections.Generic; +using System.Linq; +using CommandLine; + +namespace LfMerge.Core +{ + public abstract class OptionsBase + { + protected static IList _parseErrors = new List(); + + public static T Current; + + public IEnumerable ParseErrors { get { return _parseErrors; } } + + public static T ParseCommandLineArgs(string[] args) + { + T options = default(T); + Parser.Default.ParseArguments(args) + .WithParsed(o => { + Current = o; + options = o; + _parseErrors.Clear(); + }) + .WithNotParsed(e => _parseErrors = e.ToList()); + + return options; + } + } +} \ No newline at end of file diff --git a/src/LfMerge.Core/Settings/LfMergeSettings.cs b/src/LfMerge.Core/Settings/LfMergeSettings.cs index 206bb1cd..6baf6f8d 100644 --- a/src/LfMerge.Core/Settings/LfMergeSettings.cs +++ b/src/LfMerge.Core/Settings/LfMergeSettings.cs @@ -198,7 +198,7 @@ public string LockFile { get { - var path = "/var/run"; + var path = "/var/run/lfmerge"; const string filename = "lfmerge.pid"; var attributes = File.GetAttributes(path); diff --git a/src/LfMerge.Core/chorusmerge b/src/LfMerge.Core/chorusmerge index 9634b4d6..e4211a1c 100644 --- a/src/LfMerge.Core/chorusmerge +++ b/src/LfMerge.Core/chorusmerge @@ -1,6 +1,4 @@ #!/bin/bash -unset MONO_PREFIX -unset MONO_ENVIRON SCRIPT_DIR=$(dirname $(readlink -f $0)) @@ -32,4 +30,4 @@ cd "$SHARE" . ./environ cd "$LIB" -exec mono --debug "$LIB"/ChorusMerge.exe "$@" +exec dotnet run "$LIB"/ChorusMerge.exe "$@" diff --git a/src/LfMerge.Tests/LfMerge.Tests.csproj b/src/LfMerge.Tests/LfMerge.Tests.csproj index 14d51bd6..81c6a4a0 100644 --- a/src/LfMerge.Tests/LfMerge.Tests.csproj +++ b/src/LfMerge.Tests/LfMerge.Tests.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMerge.Tests Debug;Release LfMerge.Tests @@ -32,7 +32,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + diff --git a/src/LfMerge/LfMerge.csproj b/src/LfMerge/LfMerge.csproj index e267534e..0abfc958 100644 --- a/src/LfMerge/LfMerge.csproj +++ b/src/LfMerge/LfMerge.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 Exe LfMerge Debug;Release @@ -37,7 +37,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMerge/Options.cs b/src/LfMerge/Options.cs index 37b38ec4..7da38837 100644 --- a/src/LfMerge/Options.cs +++ b/src/LfMerge/Options.cs @@ -1,15 +1,13 @@ // Copyright (c) 2011-2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; using LfMerge.Core.Actions; namespace LfMerge { - public class Options + public class Options : OptionsBase { - public static Options Current; - public Options() { Current = this; @@ -27,34 +25,12 @@ public Options() [Option("migrate", HelpText = "Allow data migration")] public bool AllowDataMigration { get; set; } - [Option("user", HelpText = "LanguageDepot username (for debugging purposes only)", DefaultValue = "x")] + [Option("user", HelpText = "LanguageDepot username (for debugging purposes only)", Default = "x")] public string User { get; set; } - [Option("password", HelpText = "LanguageDepot password (for debugging purposes only)", DefaultValue = "x")] + [Option("password", HelpText = "LanguageDepot password (for debugging purposes only)", Default = "x")] public string Password { get; set; } - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - public static Options ParseCommandLineArgs(string[] args) - { - var options = new Options(); - var parser = ParserInstance ?? Parser.Default; - if (parser.ParseArguments(args, options)) - { - Current = options; - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } - /// /// Gets or sets the parser. /// diff --git a/src/LfMergeAuxTool/AuxToolOptions.cs b/src/LfMergeAuxTool/AuxToolOptions.cs index 69764d76..0c756e55 100644 --- a/src/LfMergeAuxTool/AuxToolOptions.cs +++ b/src/LfMergeAuxTool/AuxToolOptions.cs @@ -1,12 +1,17 @@ // Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; namespace LfMergeAuxTool { - public class AuxToolOptions + public class AuxToolOptions : OptionsBase { + public AuxToolOptions() + { + Current = this; + } + [Option('p', "project", Required = true, HelpText = "Path to fwdata file to process.")] public string Project { get; set; } @@ -18,27 +23,6 @@ public class AuxToolOptions [Option('m', "migrate", HelpText = "Migrate project to current model version")] public bool Migrate { get; set; } - - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, - current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - public static AuxToolOptions ParseCommandLineArgs(string[] args) - { - var options = new AuxToolOptions(); - if (Parser.Default.ParseArguments(args, options)) - { - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } } } diff --git a/src/LfMergeAuxTool/LfMergeAuxTool.csproj b/src/LfMergeAuxTool/LfMergeAuxTool.csproj index a82d893c..c4d59144 100644 --- a/src/LfMergeAuxTool/LfMergeAuxTool.csproj +++ b/src/LfMergeAuxTool/LfMergeAuxTool.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMergeAuxTool Debug;Release LfMergeAuxTool @@ -32,7 +32,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMergeQueueManager/LfMergeQueueManager.csproj b/src/LfMergeQueueManager/LfMergeQueueManager.csproj index feedcc91..85d55155 100644 --- a/src/LfMergeQueueManager/LfMergeQueueManager.csproj +++ b/src/LfMergeQueueManager/LfMergeQueueManager.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMerge.QueueManager Debug;Release LfMergeQueueManager @@ -32,7 +32,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMergeQueueManager/QueueManagerOptions.cs b/src/LfMergeQueueManager/QueueManagerOptions.cs index 3c0f2f03..027726a3 100644 --- a/src/LfMergeQueueManager/QueueManagerOptions.cs +++ b/src/LfMergeQueueManager/QueueManagerOptions.cs @@ -1,14 +1,12 @@ // Copyright (c) 2011-2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; namespace LfMerge.QueueManager { - public class QueueManagerOptions + public class QueueManagerOptions : OptionsBase { - public static QueueManagerOptions Current; - public QueueManagerOptions() { Current = this; @@ -16,27 +14,5 @@ public QueueManagerOptions() [Option('p', "project", HelpText = "Process the specified project first")] public string PriorityProject { get; set; } - - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - - public static QueueManagerOptions ParseCommandLineArgs(string[] args) - { - var options = new QueueManagerOptions(); - if (Parser.Default.ParseArguments(args, options)) - { - Current = options; - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } } } diff --git a/startlfmerge b/startlfmerge index 139466a8..4a56da46 100755 --- a/startlfmerge +++ b/startlfmerge @@ -2,9 +2,6 @@ # Start LfMerge # This script will reside in /usr/lib/lfmerge// -unset MONO_PREFIX -unset MONO_ENVIRON - DBVERSION=$(basename $(dirname $(readlink -f $0))) if [[ $DBVERSION != 70* ]]; then @@ -20,4 +17,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec mono --debug "$LIB"/LfMerge.exe "$@" +exec "$LIB"/LfMerge "$@"