Skip to content

Commit

Permalink
Merge branch 'master' into topic/miurahr/gui/main/menu-construct-with…
Browse files Browse the repository at this point in the history
…-properties-abstract-action
  • Loading branch information
miurahr authored May 3, 2024
2 parents 2e2cc04 + 02c43b7 commit d0ed739
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 163 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/gradle-build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:
with:
java-version: 17
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v2
- 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
with:
build-scan-publish: true
build-scan-terms-of-service-url: https://gradle.com/terms-of-service
build-scan-terms-of-service-agree: yes
name: Setup Gradle
id: setup-gradle
- name: Run gradle build
Expand Down
1 change: 1 addition & 0 deletions Plugins.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ plugin=org.omegat.filters3.xml.xliff.XLIFFFilter \
org.omegat.externalfinder.ExternalFinder \
org.omegat.gui.theme.DefaultFlatTheme \
org.omegat.gui.theme.DefaultClassicTheme \
org.omegat.gui.editor.mark.WhitespaceMarker \
org.omegat.util.gui.HtmlMediaSupport \
org.omegat.core.team2.impl.FileRepository \
org.omegat.core.team2.impl.HTTPRemoteRepository \
Expand Down
208 changes: 120 additions & 88 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.nio.file.Paths
import com.github.spotbugs.snom.Confidence

plugins {
id 'base'
id 'application'
id 'java-library'
id 'java-test-fixtures'
Expand Down Expand Up @@ -401,7 +402,6 @@ def omegatJarFilename = jar.archiveFileName.get()
project(":machinetranslators") {jar.enabled = false}
project(":spellchecker") {jar.enabled = false}

def distsDir = file(layout.buildDirectory.file("${distsDirName}"))
def assetDir = findProperty('assetDir') ?: '../'
def macJRE = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_x64_mac_*.tar.gz')
def armMacJRE = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_aarch64_mac_*.tar.gz')
Expand Down Expand Up @@ -762,12 +762,12 @@ tasks.register('mac') {
}

ext.makeMacTask = { args ->
def installTaskName = args.name + "InstallDist"
def signedInstallTaskName = args.name + "InstallSignedDist"
def installTaskName = 'install' + args.name.capitalize() + "Dist"
def signedInstallTaskName = 'install' + args.name.capitalize() + "SignedDist"
def distZipTaskName = args.name + "DistZip"
def signedZipTaskName = args.name + "SignedDistZip"
def signedZipTaskName = args.name + "Signed"
def notarizeTaskName = args.name + "Notarize"
def stapledNotarizedDistZipTaskName = args.name + "StapledNotarizedDistZip"
def stapledNotarizedDistZipTaskName = args.name + "StapledNotarized"

tasks.register(distZipTaskName, Zip) {
description = "Create Mac distribution for ${args.name}"
Expand Down Expand Up @@ -803,6 +803,12 @@ ext.makeMacTask = { args ->
}
}
}
outputs.upToDateWhen {
// detect up-to-date when OmegaT.jar exists and newer than libs/OmegaT.jar
def f1 = base.distsDirectory.file(archiveFileName).get().asFile
def f2 = base.libsDirectory.file('OmegaT.jar').get().asFile
f1.exists() && f2.exists() && f1.lastModified() > f2.lastModified()
}
onlyIf {
condition(!args.jrePath || !args.jrePath.empty, 'JRE not found')
}
Expand Down Expand Up @@ -845,7 +851,13 @@ ext.makeMacTask = { args ->
}
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
destinationDir file(layout.buildDirectory.file("install/${application.applicationName}-${args.suffix}"))
destinationDir file(layout.buildDirectory.file("install/${application.applicationName}-${args.suffix}"))
outputs.upToDateWhen {
// detect up-to-date when OmegaT.jar exists and newer than libs/OmegaT.jar
def f1 = file("$destinationDir/OmegaT.app/Contents/Java/OmegaT.jar")
def f2 = base.libsDirectory.file('OmegaT.jar').get().asFile
f1.exists() && f2.exists() && f1.lastModified() > f2.lastModified()
}
doFirst {
delete "$destinationDir/OmegaT.app/Contents/PlugIns/jre.bundle"
}
Expand Down Expand Up @@ -1167,8 +1179,8 @@ tasks.register("linuxRpmDist", Exec) {

// We bundle our startup scripts separately, so disable startScripts.
startScripts.enabled = false
installDist {
}
// installDist insists on destination executable directory even when disable start script.
application.executableDir = ""

// Read in all our custom messages and massage them for inclusion in the .iss
ext.getInnoSetupCustomMessages = {
Expand Down Expand Up @@ -1198,18 +1210,69 @@ tasks.register('win') {
ext.makeWinTask = { args ->
def fullVersion = project.version + omtVersion.beta
def installerBasename = "OmegaT_${fullVersion}_${args.suffix}"
def installerExe = layout.buildDirectory.file("${distsDirName}/${installerBasename}.exe")
def signedExe = layout.buildDirectory.file("${distsDirName}/${installerBasename}_Signed.exe")

def installerWinExe = base.distsDirectory.file("${installerBasename}.exe")
def signedWinExe = base.distsDirectory.file("${installerBasename}_Signed.exe")
def prepDistsTaskName = "${args.name}Prep"
def genDistsTaskName = "${args.name}Gen"
def distsTaskName = "${args.name}"
def signedTaskName = "${args.name}Signed"
def signedTaskCommandArgs = { arg2 ->
def exe = exePresent('osslsigncode') ? 'osslsigncode' : file('ci/osslsigncode').toString()
def commandArgs = [exe, 'sign']
if (project.hasProperty('pkcs11module')) {
commandArgs.addAll('-pkcs11module', project.property('pkcs11module'))
}
if (project.hasProperty('winCodesignCert')) {
commandArgs.addAll('-certs', project.property('winCodesignCert'))
}
if (project.hasProperty('pkcs11cert')) {
commandArgs.addAll('-pkcs11cert', project.property('pkcs11cert'))
}
if (project.hasProperty('winCodesignPassword')) {
commandArgs.addAll('-pass', project.property('winCodesignPassword'))
}
if (project.hasProperty('winCodesignDevice')) {
envVars['USBDEV'] = project.property('winCodesignDevice')
}
commandArgs.addAll(
'-t', project.hasProperty('winCodesignTimestampUrl') ? project.property('winCodesignTimestampUrl') :
'http://time.certum.pl/',
'-n', application.applicationName, '-i', omtWebsite, '-h', 'sha256',
'-in', installerWinExe.get().asFile,
'-out', signedWinExe.get().asFile
)
return commandArgs
}

tasks.register(args.name, Sync) {
description = "Create a Windows installer for ${args.name} distro. " +
'Requires Inno Setup (http://www.jrsoftware.org/isinfo.php).'
tasks.register(prepDistsTaskName, Sync) {
onlyIf {
conditions([!args.jrePath || !args.jrePath.empty, 'JRE not found'],
[exePresent('iscc') || exePresent('docker') || exePresent('nerdctl'),
'InnoSetup or Docker not installed'])
}
doFirst {
delete "$destinationDir/jre"
delete installerWinExe
}
with distributions.main.contents
dependsOn createAllExecutables
destinationDir file(layout.buildDirectory.file("innosetup/${args.name}"))
outputs.upToDateWhen {
// detect up-to-date when OmegaT.jar exists and newer than libs/OmegaT.jar
def f1 = layout.buildDirectory.file("innosetup/${args.name}/OmegaT.jar").get().asFile
def f2 = base.libsDirectory.file('OmegaT.jar').get().asFile
f1.exists() && f2.exists() && f1.lastModified() > f2.lastModified()
}
from('release/win32-specific') {
include 'OmegaT.l4J.ini'
include 'OmegaT.iss'
filter(ReplaceTokens, tokens: [
VERSION_NUMBER_SUBST : fullVersion,
OUTPUT_BASENAME_SUBST: installerBasename.toString(),
CUSTOM_MESSAGES_SUBST: getInnoSetupCustomMessages(),
ARCHITECTURE_SUBST : args.arch ?: ''
])
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
filteringCharset = 'UTF-8'
}
from('build/launch4j') {
include '*.exe'
Expand All @@ -1222,56 +1285,47 @@ ext.makeWinTask = { args ->
}
}
}
destinationDir file(layout.buildDirectory.file("innosetup/${args.name}"))
outputs.file installerExe
dependsOn createAllExecutables
}

tasks.register(genDistsTaskName, Exec) {
onlyIf {
conditions([!args.jrePath || !args.jrePath.empty, 'JRE not found'],
[exePresent('iscc') || exePresent('docker') || exePresent('nerdctl'),
'InnoSetup or Docker not installed'])
}
doFirst {
delete "$destinationDir/jre"
delete installerExe
project.copy {
from 'build'
into 'build'
include "innosetup/${args.name}/**/*"
dirMode 0777
fileMode 0666
}
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()
}
doLast {
project.copy {
from('release/win32-specific') {
include 'OmegaT.iss'
}
into(destinationDir)
filter(ReplaceTokens, tokens: [
VERSION_NUMBER_SUBST : fullVersion,
OUTPUT_BASENAME_SUBST: installerBasename.toString(),
CUSTOM_MESSAGES_SUBST: getInnoSetupCustomMessages(),
ARCHITECTURE_SUBST : args.arch ?: ''
])
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
filteringCharset = 'UTF-8'
}
exec {
// 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')
commandLine exe, "${destinationDir}/OmegaT.iss"
}
project.copy {
from("${destinationDir}/${installerBasename}.exe")
into distsDir
}
delete file("${destinationDir}/${installerBasename}.exe")
// 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
commandLine exe, '/Qp', iss
}

tasks.register(distsTaskName, Copy) {
description = "Create a Windows installer for ${args.name} distro. " +
'Requires Inno Setup (http://www.jrsoftware.org/isinfo.php).'
onlyIf {
conditions([!args.jrePath || !args.jrePath.empty, 'JRE not found'],
[exePresent('iscc') || exePresent('docker') || exePresent('nerdctl'),
'InnoSetup or Docker not installed'])
}
from layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe")
into base.distsDirectory
outputs.file installerWinExe
dependsOn genDistsTaskName
}

tasks.register(signedTaskName, Exec) {
group = 'omegat distribution'
inputs.file installerExe
outputs.file signedExe
inputs.file installerWinExe skipWhenEmpty()
outputs.file signedWinExe
// Starting from Nov 2022, certification provider force to use HSM to
// store private keys. Starting on June 1, 2023, at 00:00 UTC, industry
// standards will require private keys for standard code signing
Expand All @@ -1289,34 +1343,13 @@ ext.makeWinTask = { args ->
// [exePresent('osslsigncode') || exePresent('docker') || exePresent('nerdctl'),
// 'neither osslsigncode or docker/nerdctl is not installed'])
}
def exe = exePresent('osslsigncode') ? 'osslsigncode' : file('ci/osslsigncode')
def envVars = [:]
def commandArgs = [exe, 'sign']
if (project.hasProperty('pkcs11module')) {
commandArgs.addAll('-pkcs11module', project.property('pkcs11module'))
}
if (project.hasProperty('winCodesignCert')) {
commandArgs.addAll('-certs', project.property('winCodesignCert'))
}
if (project.hasProperty('pkcs11cert')) {
commandArgs.addAll('-pkcs11cert', project.property('pkcs11cert'))
}
if (project.hasProperty('winCodesignPassword')) {
commandArgs.addAll('-pass', project.property('winCodesignPassword'))
}
if (project.hasProperty('winCodesignDevice')) {
envVars['USBDEV'] = project.property('winCodesignDevice')
doFirst {
delete signedWinExe
}
commandArgs.addAll(
'-t', project.hasProperty('winCodesignTimestampUrl') ? project.property('winCodesignTimestampUrl') :
'http://time.certum.pl/',
'-n', application.applicationName, '-i', omtWebsite, '-h', 'sha256',
'-in', installerExe.get().asFile.toString(),
'-out', signedExe.get().asFile.toString()
)
commandLine(commandArgs)
def envVars = [:]
commandLine(signedTaskCommandArgs())
environment(envVars)
dependsOn args.name
dependsOn distsTaskName
}
assemble.dependsOn args.name, signedTaskName
win.dependsOn args.name, signedTaskName
Expand Down Expand Up @@ -1354,18 +1387,17 @@ processResources {
}

tasks.register('checksums') {
def algos = ['SHA-512', 'MD5']
def algos = ['SHA-512']
description = "Generate ${algos.join(', ')} checksums for distribution files"
inputs.files fileTree(dir: distsDir, exclude: 'checksums')
def checksumsDir = file("${distsDir}/checksums")
outputs.dir checksumsDir
inputs.files fileTree(dir: base.distsDirectory, exclude: 'checksums')
outputs.dir base.distsDirectory.dir('checksums')
onlyIf {
condition(distsDir.directory, 'Distfiles not found')
condition(base.distsDirectory.get().asFile.directory, 'Distfiles not found')
}
doLast {
distsDir.listFiles().findAll { it.file }.each { f ->
base.distsDirectory.get().asFile.listFiles().findAll { it.file }.each { f ->
algos.each { algo ->
ant.checksum file: f, algorithm: algo, todir: checksumsDir
ant.checksum file: f, algorithm: algo, todir: distsDirectory.dir('checksums').get().asFile
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines/build_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
displayName: 'Preparation for build'
- task: Gradle@3
inputs:
tasks: 'clean sourceDistZip distZip mac linux win'
tasks: 'clean sourceDistZip distZip mac linux win checksums'
options: '--build-cache -PenvIsCi -PassetDir=$(System.ArtifactsDirectory)/asset'
jdkVersionOption: '1.17'
displayName: 'Build distribution packages and docs'
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ steps:
dest=$(SOURCEFORGE_FILE_USER)@frs.sourceforge.net
destdir="/home/frs/project/omegat/OmegaT\\ -\\ Latest/OmegaT\\ ${{ parameters.omegatVersion }}/"
echo "mkdir $destdir" | SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e sftp -v $dest || true
SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e scp -v -oStrictHostKeyChecking=no $srcdir/* "$dest:$destdir"
SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e scp -r -v -oStrictHostKeyChecking=no $srcdir/* "$dest:$destdir"
2 changes: 1 addition & 1 deletion ci/azure-pipelines/publish_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ steps:
dest=$(SOURCEFORGE_FILE_USER)@frs.sourceforge.net
destdir=/home/frs/project/omegat/Weekly
echo "mkdir $destdir" | SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e sftp -v $dest || true
SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e scp -v -oStrictHostKeyChecking=no $srcdir/* $dest:$destdir
SSHPASS=$(SOURCEFORGE_FILE_PASS) sshpass -e scp -r -v -oStrictHostKeyChecking=no $srcdir/* $dest:$destdir
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
slf4j = { strictly = "[2.0.7, 2.1[", prefer = "2.0.7" }
slf4j-format = "0.5.1"
groovy = "4.0.20"
groovy = "4.0.21"
junit = "4.13.2"
commons_lang3 = "3.14.0"
commons_io = "2.15.1"
Expand Down Expand Up @@ -39,16 +39,16 @@ pdfbox = "3.0.2"
maligna = "3.0.1"
trie4j = "0.9.10_1"
dsl4j = "0.7.1"
stardict4j = "0.6.1"
stardict4j = "0.6.3"
juniversalchardet = "2.4.0"
mnemonics = "1.2-SNAPSHOT"
mnemonics = "1.2"
jmyspell = "1.0.0-beta-2"
hunspell = "2.1.2"
xjc = "2.3.4"
jna = "5.13.0"
jfa = "1.2.0"
tipoftheday = "0.4.4"
flatlaf="3.4"
flatlaf="3.4.1"

[libraries]
slf4j-api = {group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j"}
Expand Down Expand Up @@ -146,7 +146,7 @@ jgit = ["jgit", "jgit-agent", "jgit-http", "jgit-ssh"]
dictionary = ["trie4j", "dsl4j", "stardict4j", "jsoup"]

[plugins]
spotbugs = {id = "com.github.spotbugs", version = "6.0.8"}
spotbugs = {id = "com.github.spotbugs", version = "6.0.13"}
spotless = {id = "com.diffplug.spotless", version = "6.25.0"}
launch4j = {id = "edu.sc.seis.launch4j", version = "3.0.5"}
versions = {id = "com.github.ben-manes.versions", version = "0.51.0"}
Expand Down
Loading

0 comments on commit d0ed739

Please sign in to comment.