From 234d228d0af19da10ae14a5c8d090c33f8d5fe22 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Sun, 2 Jun 2024 21:46:16 +0900 Subject: [PATCH] chore: Update release related tasks (#1048) * chore: iscc: put file in build/tmp/iscc Currently iscc script use mktemp -d to make context of container command. There is a limitation of some container environment such as Rancher Desktop that only allow run under users home directory, because of binding user home directory under their environment. This changes the TMPDIR as $PROJECT_DIR/build/tmp/iscc It allows nerdctl command with Rancher desktop working. Signed-off-by: Hiroshi Miura * chore: enable gradle scan - integration test - azure-pipelines build tasks - remove gradle-scan.init.gradle that is not necessary for now. Signed-off-by: Hiroshi Miura * chore: bump Gradle@8.8 - Guarantee JVM daemon run on Java 17 Signed-off-by: Hiroshi Miura * chore: improve win generation tasks - explicitly define input and output files in genDist tasks - add debug log after call iscc - iscc to skip container build when exists - change distsTask to be Sync instead of Copy Signed-off-by: Hiroshi Miura * chore: update ci/iscc - Fix container CLI detection Signed-off-by: Hiroshi Miura --------- Signed-off-by: Hiroshi Miura --- .github/workflows/gradle-build-master.yml | 2 -- build.gradle | 24 ++++++++++++++------ ci/azure-pipelines/build_steps.yml | 2 +- ci/azure-pipelines/check_steps.yml | 2 +- ci/gradle/gradle-scan.init.gradle | 6 ----- ci/iscc | 22 ++++++++++++------ ci/osslsigncode | 5 ++-- gradle/gradle-daemon-jvm.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- test-integration/docker/client/entrypoint.sh | 2 +- 10 files changed, 40 insertions(+), 29 deletions(-) delete mode 100644 ci/gradle/gradle-scan.init.gradle create mode 100644 gradle/gradle-daemon-jvm.properties diff --git a/.github/workflows/gradle-build-master.yml b/.github/workflows/gradle-build-master.yml index 30ea7521a3..506609d180 100644 --- a/.github/workflows/gradle-build-master.yml +++ b/.github/workflows/gradle-build-master.yml @@ -20,8 +20,6 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v3 name: validate gradle wrapper - - name: Agree gradle-scan terms - run: cat ci/gradle/gradle-scan.init.gradle >> settings.gradle - uses: gradle/actions/setup-gradle@v3 name: Setup Gradle id: setup-gradle diff --git a/build.gradle b/build.gradle index fa03c10157..a400435010 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,10 @@ application { mainClass = 'org.omegat.Main' } +tasks.named('updateDaemonJvm') { + jvmVersion = JavaVersion.VERSION_17 +} + def shortDescription = 'The free translation memory tool' def distDescription = 'OmegaT is a free and open source multiplatform Computer Assisted Translation tool with' + ' fuzzy matching, translation memory, keyword search, glossaries, and translation leveraging into updated' + @@ -1324,20 +1328,26 @@ ext.makeWinTask = { args -> 'InnoSetup or Docker not installed']) } dependsOn prepDistsTaskName - outputs.upToDateWhen { - // detect up-to-date when OmegaT.jar exists and newer than libs/OmegaT.jar - def f1 = layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe").get().asFile - def f2 = layout.buildDirectory.file("innosetup/${args.name}/OmegaT.jar").get().asFile - f1.exists() && f2.exists() && f1.lastModified() > f2.lastModified() - } + inputs.files( + layout.buildDirectory.file("innosetup/${args.name}/OmegaT.jar"), + layout.buildDirectory.file("innosetup/${args.name}/OmegaT.iss"), + layout.buildDirectory.file("innosetup/${args.name}/OmegaT.l4j.ini"), + ) // You'd think we could just set the PATH, but there be dragons here // https://github.com/palantir/gradle-docker/issues/162 def exe = exePresent('iscc') ? 'iscc' : file('ci/iscc') def iss = layout.buildDirectory.file("innosetup/${args.name}/OmegaT.iss").get().asFile + logging.captureStandardOutput LogLevel.INFO commandLine exe, '/Qp', iss + outputs.file layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe") + doLast { + println "" + def f3 = layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe").get().asFile + logger.info('Built ' + f3.toString() + "(" + f3.length() + ")") + } } - tasks.register(distsTaskName, Copy) { + tasks.register(distsTaskName, Sync) { description = "Create a Windows installer for ${args.name} distro. " + 'Requires Inno Setup (http://www.jrsoftware.org/isinfo.php).' onlyIf { diff --git a/ci/azure-pipelines/build_steps.yml b/ci/azure-pipelines/build_steps.yml index 63494fc753..24d465e877 100644 --- a/ci/azure-pipelines/build_steps.yml +++ b/ci/azure-pipelines/build_steps.yml @@ -32,7 +32,7 @@ steps: - task: Gradle@3 inputs: tasks: 'clean sourceDistZip distZip mac linux win' - options: '--build-cache -PenvIsCi -PassetDir=$(System.ArtifactsDirectory)/asset' + options: '--build-cache -PenvIsCi --scan -PassetDir=$(System.ArtifactsDirectory)/asset' jdkVersionOption: '1.17' displayName: 'Build distribution packages and docs' - script: echo "##vso[task.setvariable variable=result;]false" diff --git a/ci/azure-pipelines/check_steps.yml b/ci/azure-pipelines/check_steps.yml index 6a77a1ee9e..34aacaf359 100644 --- a/ci/azure-pipelines/check_steps.yml +++ b/ci/azure-pipelines/check_steps.yml @@ -11,5 +11,5 @@ steps: displayName: Check inputs: tasks: check - options: '-PenvIsCi --no-daemon' + options: '-PenvIsCi --no-daemon --scan' jdkVersionOption: '1.17' diff --git a/ci/gradle/gradle-scan.init.gradle b/ci/gradle/gradle-scan.init.gradle deleted file mode 100644 index 32bafca3f6..0000000000 --- a/ci/gradle/gradle-scan.init.gradle +++ /dev/null @@ -1,6 +0,0 @@ -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} diff --git a/ci/iscc b/ci/iscc index 609d5a491f..5037668f26 100755 --- a/ci/iscc +++ b/ci/iscc @@ -12,12 +12,17 @@ bindpaths() { done } +# set TMPDIR for context creation +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +TMPDIR=$( dirname ${SCRIPT_DIR} )/build/tmp + # workaround for build failure on CI env. # see https://sourceforge.net/p/omegat/bugs/1228/ PUID=`id -u` PGID=`id -g` IMAGE=omegatorg/innosetup:innosetup6 -CONTEXT=`mktemp -d` +CONTEXT=${TMPDIR}/iscc +mkdir -p $CONTEXT cat << __EOF__ > $CONTEXT/Dockerfile FROM docker.io/amake/innosetup:innosetup6-buster @@ -32,13 +37,16 @@ WORKDIR /work ENTRYPOINT ["iscc"] __EOF__ -CMD="$(type -p docker)" || [[ -e $CMD ]] && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)" -echo select container CLI: $CMD -$CMD info || false +CMD="$(type -p docker)" && $CMD info >/dev/null 2>&1 || CMD="$(type -p nerdctl)" && $CMD info > /dev/null || false +echo Select container CLI: $CMD -if ! $CMD build -t $IMAGE $CONTEXT ; then - echo Container build error for ISCC, abort... - exit 1 +IMAGEID=$($CMD images -q $IMAGE) +if [[ -z "$IMAGEID" ]]; then + echo Now build custom image + if ! $CMD build -t $IMAGE $CONTEXT ; then + echo Container build error for ISCC, abort... + exit 1 + fi fi exec $CMD run -i --rm \ -u `id -u`:`id -g` \ diff --git a/ci/osslsigncode b/ci/osslsigncode index 704e641b6c..4efd895895 100755 --- a/ci/osslsigncode +++ b/ci/osslsigncode @@ -15,9 +15,8 @@ bindpaths() { done } -CMD="$(type -p docker)" || [[ -e $CMD ]] && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)" -echo select container CLI: $CMD -$CMD info || false +CMD="$(type -p docker)" && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)" && $CMD info >/dev/null || false +echo Select container CLI: $CMD # build container image CTX=$(mktemp -d) diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000000..858feb7e38 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,2 @@ +#This file is generated by updateDaemonJvm +toolchainVersion=17 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3fa8f862f7..a4413138c9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/test-integration/docker/client/entrypoint.sh b/test-integration/docker/client/entrypoint.sh index 809e9f8c00..eed81740e7 100644 --- a/test-integration/docker/client/entrypoint.sh +++ b/test-integration/docker/client/entrypoint.sh @@ -44,7 +44,7 @@ chmod 600 /home/omegat/.ssh/id_rsa ssh-keyscan -H server > /home/omegat/.ssh/known_hosts cd /workdir -exec /opt/gradle/bin/gradle testIntegration \ +exec /opt/gradle/bin/gradle testIntegration --scan \ -Djava.util.logging.config.file=/workdir/test-integration/logger.properties \ -Domegat.test.duration=${DURATION} -Domegat.test.repo=${REPO} \ -Domegat.test.repo.alt=${REPO2} -Domegat.test.map.repo=http://server/ -Domegat.test.map.file=README