1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-omegat

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
build.gradle 19 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Hiroshi Miura Отправлено 06.04.2025 06:18 2d1a453
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'org.omegat.version-conventions'
id 'org.omegat.document-conventions'
id 'org.omegat.main-utilities'
id 'org.omegat.java-conventions'
id 'org.omegat.jaxb-conventions'
id 'org.omegat.windows-conventions'
id 'org.omegat.mac-conventions'
id 'org.omegat.linux-conventions'
id 'org.omegat.jpkg-conventions'
id 'org.omegat.publish-conventions'
id 'org.omegat.verification-conventions'
id 'jvm-test-suite'
id 'java-test-fixtures'
id 'com.google.osdetector' version '1.7.3'
}
application {
applicationName = appName
mainClass = mainClassName
}
def os = osdetector.os
def osArch = osdetector.classifier
// Explicitly specify Gradle wrapper version
tasks.withType(Wrapper.class).configureEach {
distributionType = Wrapper.DistributionType.BIN
gradleVersion = "8.13" // set the same version as in gradle/wrapper/gradle-wrapper.properties
}
version = omtVersion.version + getUpdateSuffix(omtVersion.update)
// Definition of bundled JRE file names
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')
def linux64JRE = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_x64_linux_*.tar.gz')
def linuxArm64JRE = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_aarch64_linux_*.tar.gz')
def windowsJRE32 = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_x86-32_windows_*.zip')
def windowsJRE = fileTree(dir: assetDir, include: 'OpenJDK17U-jre_x64_windows_*.zip')
def windowsArm64JRE = fileTree(dir: assetDir, include: 'OpenJDK21U-jre_aarch64_windows_*.zip')
sourcesJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir 'test/src'
}
resources {
srcDir 'test/src'
srcDir 'test/data'
}
}
testFixtures {
java {
srcDir 'test/fixtures'
}
}
}
configurations {
all
[testRuntime, testCompile]*.exclude group: 'org.languagetool', module: 'language-all'
}
dependencies {
// Libs are provided in the "source" distribution only
if (providedCoreLibsDir.directory) {
api fileTree(dir: providedCoreLibsDir, includes: ['**/slf4j-api-*.jar', '**/jaxb-api-*.jar'])
implementation fileTree(dir: providedCoreLibsDir, include: '**/*.jar', excludes: ['**/slf4j-api-*.jar',
'**/slf4j-jdk14-*.jar', 'language-detector-*.jar', '**/hunspell-*.jar',
'**/groovy*.jar', '**/jaxb-runtime-*.jar'])
runtimeOnly fileTree(dir: providedCoreLibsDir, includes: ['**/slf4j-jdk14-*.jar',
'**/language-detector-*.jar', '**/hunspell-*.jar', '**/groovy*.jar', '**/jaxb-runtime-*.jar'])
} else {
implementation(libs.commons.io)
implementation(libs.commons.lang3)
implementation(libs.commons.validator)
api(libs.slf4j.api)
implementation(libs.slf4j.format.jdk14)
runtimeOnly(libs.slf4j.jdk14)
// jaxb gen compilation
implementation(libs.jaxb.api)
runtimeOnly(libs.jaxb.core)
runtimeOnly(libs.jaxb.runtime)
// macOS integration
implementation(libs.madlonkay.desktopsupport)
// extra locales
implementation(libs.swing.extra.locales)
// stax
implementation(libs.stax2.api)
implementation(libs.woodstox.core)
// Data: inline data URL handler
implementation(libs.url.protocol.handler)
// PDF Filter
implementation(libs.apache.pdfbox)
// Dictionary
implementation(libs.bundles.dictionary)
// Encoding detections
implementation(libs.juniversal.chardet)
// Legacy projects re-hosted on Maven Central
api(libs.omegat.vldocking)
implementation(libs.omegat.htmlparser)
implementation(libs.omegat.gnudiff4j)
implementation(libs.omegat.mnemonics)
// LanguageTool
implementation(libs.languagetool.core) {
exclude module: 'guava'
exclude module: 'language-detector'
exclude group: 'com.google.android'
exclude module: 'hunspell'
}
runtimeOnly(libs.language.detector)
runtimeOnly(libs.dumont.hunspell)
implementation(libs.icu4j)
// Lucene for tokenizers
implementation(libs.bundles.lucene)
// Team project server support
implementation(libs.bundles.jgit)
// For ed25519 and ecdsa support of ssh, java16+ or BC
implementation(libs.bundles.ecdsa)
// For gpg signing
implementation(libs.jgit.bc)
// For subversion
implementation(libs.svnkit) {
exclude module: 'sshd-core'
exclude module: 'sshd-common'
}
// Team project conflict resolution
implementation(libs.madlonkay.supertmxmerge)
// Credentials encryption
implementation(libs.jasypt)
// Groovy used for scripts - needed at implementation for GroovyClassLoader modifications
// Ivy is needed to handle Grape/@Grab dependencies
runtimeOnly(libs.bundles.groovy)
// Javascript used for scripts
implementation(libs.nashorn.core)
// Script editor
implementation(libs.bundles.fifesoft) {
exclude module: 'rhino'
}
implementation(libs.guava)
implementation(libs.jetbrains.annotations)
// JSON parser
implementation(libs.bundles.jackson)
implementation(libs.jetbrains.annotations)
implementation(libs.bundles.caffeine) {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.class, Bundling.EXTERNAL))
}
}
// Platform integration with Windows and macOS
implementation(libs.jna)
implementation(libs.jfa) {
exclude module: 'jna'
}
}
// Test dependencies
testFixturesApi(libs.junit4)
// for http connection test
testFixturesApi(libs.wiremock) {
exclude module: 'guava'
}
testFixturesApi(libs.slf4j.api)
testFixturesImplementation sourceSets.main.output
testFixturesImplementation(libs.commons.io)
testFixturesImplementation(libs.omegat.vldocking)
testFixturesImplementation(libs.assertj.swing.junit)
testImplementation(libs.junit4)
testImplementation(libs.commons.io)
testImplementation(libs.assertj)
testImplementation(libs.bundles.xmlunit)
testImplementation(libs.slf4j.api)
testImplementation(libs.languagetool.server) {
exclude module: "logback-classic"
exclude module: "hunspell"
}
testRuntimeOnly(libs.bundles.groovy)
testRuntimeOnly(libs.nashorn.core)
testRuntimeOnly(libs.slf4j.jdk14)
testAcceptanceImplementation sourceSets.main.output
testAcceptanceImplementation(libs.commons.io)
testAcceptanceImplementation(libs.slf4j.jdk14)
testAcceptanceImplementation(libs.slf4j.format.jdk14)
testAcceptanceImplementation(testFixtures(project.rootProject))
testAcceptanceImplementation(libs.assertj.swing.junit)
testAcceptanceImplementation(libs.bundles.jackson)
testAcceptanceImplementation(project(':aligner'))
testIntegrationImplementation sourceSets.main.output, sourceSets.test.output
testIntegrationImplementation(testFixtures(project.rootProject))
testIntegrationRuntimeOnly(libs.slf4j.jdk14)
// workdir classifiers are hard-coded in gralde-launch4j plugin
if ("windows".equals(os)) {
launch4jBin 'org.omegat:launch4j:3.55:workdir-win32'
} else if ("osx".equals(os)) {
launch4jBin 'org.omegat:launch4j:3.55:workdir-mac'
} else if ("linux-x86_64".equals(osArch)) {
launch4jBin 'org.omegat:launch4j:3.55:workdir-linux64'
} else if ("linux-aarch_64".equals(osArch)) {
// gradle-launch4j plugin use the classifier
// for architectures other than x86_64 on linux
launch4jBin 'org.omegat:launch4j:3.55:workdir-linux'
}
subprojects.findAll { it.getSubprojects().isEmpty()}.collect {jacocoAggregation it}
}
jar {
def pluginProperties = layout.settingsDirectory.file('Plugins.properties')
def omtPlugins = loadProperties(pluginProperties.asFile)
manifest {
attributes('License': 'GNU Public License version 3 or later',
'Implementation-Version': project.version,
'Permissions': 'all-permissions',
'OmegaT-Plugin': 'true',
'OmegaT-Plugins': omtPlugins.plugin,
'Plugin-Author': 'OmegaT team',
'Plugin-Link': 'https://omegat.org',
'Plugin-Version': project.version,
'Main-Class': application.mainClass,
'Class-Path': configurations.runtimeClasspath.collect { "lib/${it.name}" }.join(' '))
ext.pluginAttr = { name, path, category, description ->
attributes('Plugin-Name': name, 'Plugin-Category': category, 'Plugin-Description': description, path)
}
def desc = [:]
omtPlugins.each { pluginKey, pluginValue ->
if (pluginKey.startsWith('plugin.desc')) {
def descriptionKey = pluginKey.split('\\.').last()
desc[descriptionKey] = pluginValue
} else if (pluginKey != 'plugin') {
pluginValue.tokenize().each { className ->
attributes('OmegaT-Plugin': pluginKey, className)
}
}
}
pluginAttr('Dictionary driver[bundle]', 'org/omegat/core/dictionaries/', 'dictionary', desc.dictionary)
pluginAttr('File filters[bundle]', 'org/omegat/filters2/', 'filter', desc.filters2)
pluginAttr('XML filters[bundle]', 'org/omegat/filters3/', 'filter', desc.filters3)
pluginAttr('New XML filters[bundle]', 'org/omegat/filters4/', 'filter', desc.filters4)
pluginAttr('Tokenizers[bundle]', 'org/omegat/tokenizer/', 'tokenizer', desc.tokenizer)
pluginAttr('Themes [bundle]', 'org/omegat/gui/theme/', 'theme', desc.theme)
pluginAttr('Scripting engine', 'org/omegat/gui/script/', 'miscellaneous', desc.script)
pluginAttr('GUI extensions', 'org/omegat/util/gui/', 'miscellaneous', desc.guiutil)
pluginAttr('Local external search', 'org/omegat/externalfinder/', 'miscellaneous', desc.externalfinder)
pluginAttr('Repository connector', 'org/omegat/core/team2/impl/', 'repository', desc.repository)
}
archiveFileName.set(omegatJarFilename)
}
test {
// some test case depends on modules from subproject
dependsOn subprojects.collect {it.tasks.withType(Jar)}
}
distributions {
main {
contents {
// docs targets
// /docs
// ...../greetings/<lang>/first_steps.html
// ...../manuals/<lang>.zip
from(layout.settingsDirectory.dir('release')) {
into 'docs'
include 'doc-license.txt'
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
}
from(layout.settingsDirectory.dir('release')) {
// ** Caution!! **
// 'readme*.txt' and 'changes.txt' are expected
// in releases/win32-specific/OmegaT.iss
// 'contributors.txt' and 'libraries.txt' are expected
// in org.omegat.gui.dialogs.AboutDialog#getContributors
// and org.omegat.gui.dialogs.AboutDialog#getLibraries
exclude 'doc-license.txt'
include '*.txt', '*.html'
filter(ReplaceTokens, tokens: [
TRANSLATION_NOTICE: ''
])
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
}
project.tasks.matching {it.name.startsWith('firstSteps') || it.name.startsWith('instantStart')}.forEach {
from(it.outputs) { into 'docs/greetings' }
}
project.tasks.matching {it.name.startsWith('manualZip')}.forEach {
from(it.outputs) { into 'docs/manuals' }
}
from(layout.settingsDirectory.dir('scripts')) {
into 'scripts'
}
from(layout.settingsDirectory.dir('images')) {
into 'images'
}
from(layout.settingsDirectory.dir('release/plugins-specific')) {
into 'plugins'
}
from(layout.settingsDirectory.dir('release/linux-specific')) {
filter ReplaceTokens, tokens: [
VERSION_NUMBER_SUBST: project.version,
JAR_SUBST : omegatJarFilename
]
filePermissions {
unix(0755)
}
}
from(layout.settingsDirectory.dir('release/win32-specific')) {
include 'OmegaT.bat'
filter(ReplaceTokens, tokens: [
JAR_SUBST : omegatJarFilename
])
}
from(layout.settingsDirectory.dir('lib/licenses')) {
into 'lib'
}
// system core plugins into modules
into('modules') {
from(subprojects.findAll{!it.name.equals('dummy')}.collect {it.tasks.withType(Jar)})
from(layout.settingsDirectory.dir('releases/modules-specific'))
}
eachFile {
// Move main JAR up one level from lib.
if (it.name == omegatJarFilename) {
it.relativePath = it.relativePath.parent.parent.append(true, omegatJarFilename)
}
}
}
distZip.archiveFileName.set("${application.applicationName}_${version}${omtVersion.beta}_Without_JRE.zip")
}
source {
contents {
from(rootDir) {
include 'config/**', 'ci/iscc', 'ci/osslsigncode', 'images/**', 'lib/**', 'release/**',
'src/**/*.java', 'test/**','test-acceptance/**', 'test-integration/**', 'doc_src/**',
'docs_devel/**', 'scripts/**',
'gradle/**', 'gradle*', 'build.gradle', 'settings.gradle', 'README.md', '*.properties',
'tipoftheday/**', 'machinetranslators/**', 'scriptengine/**', 'LICENSE', 'compose.yml',
'aligner/**', 'language-modules/**', 'spellchecker/**', 'theme/**', '.checkstyle'
exclude '**/build/**', 'doc_src/**/pdf/**', 'doc_src/**/xhtml5/**', 'local.properties', '**/out/**'
}
from(processResources) {
into('src')
}
into('lib/provided/core') {
from configurations.runtimeClasspath
}
into('lib/provided/module') {
// collect project runtime dependencies in all subprojects and sourceSets
from {subprojects.findAll { it.getSubprojects().isEmpty()}
.collect { it.configurations.matching { it.name.endsWith('untimeClasspath')
&& !it.name.startsWith('test') && !it.name.startsWith('jaxb')
} }
}
}
}
sourceDistZip.archiveFileName.set(
"${application.applicationName}_${project.version}${omtVersion.beta}_Source.zip")
}
}
tasks.register('mac') {
description = 'Build the Mac distributions.'
group = 'omegat distribution'
}
makeHunspellSignTask()
makeMacTask(name: 'macX64', suffix: 'Mac_x64', jrePath: macJRE, parentTaskName: 'mac')
makeMacTask(name: 'macArm', suffix: 'Mac_arm', jrePath: armMacJRE, parentTaskName: 'mac')
tasks.register('linux') {
description = 'Build the Linux distributions.'
group = 'omegat distribution'
dependsOn linuxDebDist
dependsOn linuxRpmDist
}
makeLinuxTask(name: "linux64", suffix: "Linux_64", jrePath: linux64JRE, parentTaskName: 'linux')
makeLinuxTask(name: "linuxArm64", suffix: "Linux_ARM64", jrePath: linuxArm64JRE, parentTaskName: 'linux')
// We bundle our startup scripts separately, so disable startScripts.
startScripts.enabled = false
// installDist insists on destination executable directory even when disable start script.
application.executableDir = ""
tasks.register('win') {
description = 'Build the Windows distributions.'
group = 'omegat distribution'
}
makeWinTask(name: 'winNoJRE', suffix: 'Windows_without_JRE', parentTask: 'win')
makeWinTask(name: 'winJRE64', suffix: 'Windows_64', jrePath: windowsJRE, arch: 'x64', parentTask: 'win')
makeWinTask(name: 'winJRE', suffix: 'Windows', jrePath: windowsJRE32, parentTask: 'win')
makeWinTask(name: 'winArm64JRE', suffix: 'Windows_aarch64', jrePath: windowsArm64JRE, parentTask: 'win')
// Disable .tar distributions for everyone but Linux
tasks.withType(Tar).configureEach {
if (!name.contains('linux')) {
enabled = false
}
}
// Disable .zip distributions for Linux
tasks.withType(Zip).configureEach {
if (name.contains('linux')) {
enabled = false
}
}
def provided = findProperty('repoRevision') ?: ''
def gitArchival = loadProperties(file('.git-archival.properties')).getProperty('node')
def git = file('.git').directory ? providers.exec {commandLine("git", "rev-parse", "--short", "HEAD")}.standardOutput.asText.get().trim() : ''
def revision = [provided, gitArchival, omtVersion.revision, git, 'unknown'].find {
!it.empty && it != '@dev@' && it != '$Format:%H$'
}
processResources {
/*
Set the revision number included in version strings. The value is
chosen from the first valid value in:
0. Provided as the Gradle property 'repo.revision'
1. src/org/omegat/Version.properties (only if not "dev", i.e. this is a
source package not under VCS)
2. This git clone's SHA-1
3. If none of the above, the value "unknown"
*/
inputs.property 'revision', revision
logger.lifecycle("Detected revision " + revision)
filesMatching('**/Version.properties') {
filter ReplaceTokens, tokens:["dev": revision]
}
}
def manualLangs = project.property("manualLangs").split(',')
manualLangs.each { lang ->
makeDocumentationTasks(lang)
}
def firstStepLangs = project.property("firstStepLangs").split(',')
firstStepLangs.each { lang ->
makeFirstStepTask(lang)
}
// E.g. when doing `build`, run checks before making distfiles
assemble.mustRunAfter check
remotes {
sourceforgeWeb {
host = 'web.sourceforge.net'
user = hasProperty('sourceforgeWebUser') ? getProperty('sourceforgeWebUser') : ''
password = hasProperty('sourceforgeWebPassword') ? getProperty('sourceforgeWebPassword') : ''
agent = true
}
}
publishAtomically(name: 'webManual', sourceTask: manualHtmls)
publishAtomically(name: 'javadoc', sourceTask: javadoc)

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-omegat.git
git@api.gitlife.ru:oschina-mirror/mirrors-omegat.git
oschina-mirror
mirrors-omegat
mirrors-omegat
master