Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic/miurahr/java17/re organize source tree #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test/data/filters/pdf/file-PdfFilter-gold.txt text eol=lf
test/data/tmx/TMXComplianceKit/*.rtf binary
85 changes: 17 additions & 68 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ plugins {
id 'checkstyle'
id 'jacoco'
id 'com.github.spotbugs' version '4.7.10'
id 'de.gliderpilot.jnlp' version '1.2.6'
id 'org.hidetake.ssh' version '2.10.1'
id 'com.diffplug.spotless' version '6.0.0'
id 'com.github.ben-manes.versions' version '0.39.0'
Expand All @@ -23,7 +22,7 @@ mainClassName = 'org.omegat.Main'

ext {
javaVersion = '1.8'
omtVersion = loadProperties(file('src/org/omegat/Version.properties'))
omtVersion = loadProperties(file('src/core/org/omegat/Version.properties'))
omtFlavor = omtVersion.beta.empty ? 'standard' : 'latest'
omtWebsite = 'https://omegat.org'
envIsCi = project.hasProperty('envIsCi')
Expand All @@ -45,10 +44,13 @@ version = omtVersion.version + getUpdateSuffix(omtVersion.update)
sourceSets {
main {
java {
srcDir 'src'
srcDir 'src/api'
srcDir 'src/core'
srcDir 'src/plugins'
}
resources {
srcDir 'src'
srcDir 'src/core'
srcDir 'src/plugins'
}
}
test {
Expand Down Expand Up @@ -115,9 +117,6 @@ dependencies {
// macOS integration
implementation 'org.madlonkay:desktopsupport:0.6.0'

api 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.sun.xml.bind:jaxb-impl:2.3.4'

// Data: inline data URL handler
implementation 'tokyo.northside:url-protocol-handler:0.1.4'

Expand Down Expand Up @@ -191,6 +190,9 @@ dependencies {
runtimeOnly 'org.codehaus.groovy:groovy-dateutil:3.0.9'
runtimeOnly 'org.apache.ivy:ivy:2.5.0'

// Javascript used for scripts
implementation 'org.openjdk.nashorn:nashorn-core:15.4'

// Script editor
implementation 'com.fifesoft:rsyntaxtextarea:3.2.0'
implementation 'com.fifesoft:rstaui:3.2.0'
Expand All @@ -202,9 +204,10 @@ dependencies {
// Moses MT connector
implementation 'org.apache.xmlrpc:xmlrpc-client:3.1.3'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical Vulnerability:

pkg:maven/org.apache.xmlrpc/[email protected]

1 Critical, 1 High, 1 Medium, 0 Low, 0 None vulnerabilities have been found across 2 dependencies

To see more details about this component, go to the Sonatype Lift console


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


// JSON parser
// XML/JSON parser
implementation "com.fasterxml.jackson.core:jackson-core:2.12.3"
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.3"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.3"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High Vulnerability:

pkg:maven/com.fasterxml.jackson.dataformat/[email protected]

0 Critical, 4 High, 0 Medium, 0 Low, 0 None vulnerabilities have been found across 1 dependencies

To see more details about this component, go to the Sonatype Lift console


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

}

// Test dependencies
Expand All @@ -219,9 +222,6 @@ dependencies {
}
testRuntimeOnly "org.languagetool:language-pl:${languageToolVersion}"

// WebStart-only
jnlp webstartDocsJar.outputs.files

// JAXB codegen only
jaxb 'com.sun.xml.bind:jaxb-xjc:2.3.4'

Expand Down Expand Up @@ -357,7 +357,7 @@ distributions {
contents {
from(rootDir) {
include 'config/**', 'docs/**', 'images/**', 'lib/**', 'release/**',
'src/**', 'test/**', 'doc_src/**', 'docs_devel/**', 'scripts/**',
'src/**','test/**', 'doc_src/**', 'docs_devel/**', 'scripts/**',
'gradle/**', 'gradlew*', '*.gradle', 'README.md', '*.properties'
exclude '**/build/**', 'doc_src/**/pdf/**', 'local.properties'
}
Expand Down Expand Up @@ -424,7 +424,7 @@ distributions {
into 'source/doc_src'
}
from('src') {
include 'org/omegat/Bundle.properties'
include 'core/org/omegat/Bundle.properties'
into 'source/src'
}
from('release') {
Expand Down Expand Up @@ -744,51 +744,6 @@ tasks.findAll { it.name =~ /[dD]istTar$/ && !it.name.contains('linux') }.each {
// Disable .zip distributions for Linux
tasks.findAll { it.name =~ /[dD]istZip$/ && it.name.contains('linux') }.each { it.enabled = false }

jnlp {
href "${applicationName}.jnlp"
codebase findProperty('jwsCodebase')
withXml {
information {
title applicationName
vendor "${applicationName} Development Team"
homepage href: omtWebsite
shortcut(online: false) {
desktop()
menu submenu: "${applicationName} from WebStart"
}
}
'offline-allowed'()
association 'mime-type': 'application/x-omegat-project', extensions: 'project'
security {
'all-permissions'()
}
resources {
property name: 'javaws.cfg.jauthenticator', value: true
}
}
signJarAddedManifestEntries = [
'Codebase': findProperty('jwsCodebase'),
'Permissions': 'all-permissions',
'Application-Name': applicationName
]
signJarParams = ['keystore', 'storetype', 'alias', 'storepass', 'keypass', 'tsaurl'].collectEntries {
[it, findProperty("jws${it.capitalize()}")]
}
}

[webstartDistZip, signJars, generateJnlp].each { task ->
task.configure {
def requiredProps = ['jwsCodebase', 'jwsKeystore', 'jwsAlias']
onlyIf {
condition(requiredProps.every { project.hasProperty(it) },
'Java Web Start properties not set')
}
requiredProps.each {
inputs.property it, findProperty(it)
}
}
}

processResources {
def revision = detectRevision()
inputs.property 'revision', revision
Expand Down Expand Up @@ -834,16 +789,10 @@ ext.makeJaxbTask = { args ->
genJAXB.dependsOn taskName
}

makeJaxbTask(name: 'segmentation', outdir: 'src/gen/core/segmentation',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.segmentation', 'src/schemas/srx20.xsd'])
makeJaxbTask(name: 'filters', outdir: 'src/gen/core/filters',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.filters', 'src/schemas/filters.xsd'])
makeJaxbTask(name: 'tbx', outdir: 'src/gen/core/tbx',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.tbx', 'src/schemas/tbx.xsd'])
makeJaxbTask(name: 'project', outdir: 'src/gen/core/project',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.project', 'src/schemas/project_properties.xsd'])
makeJaxbTask(name: 'tmx14', outdir: 'src/gen/core/tmx14',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.tmx14', '-b', 'src/schemas/tmx14.xjb', 'src/schemas/tmx14.xsd'])
makeJaxbTask(name: 'filters', outdir: 'src/core/gen/core/filters',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.filters', 'src/core/schemas/filters.xsd'])
makeJaxbTask(name: 'project', outdir: 'src/core/gen/core/project',
args: ['-no-header', '-d', 'src', '-p', 'gen.core.project', 'src/core/schemas/project_properties.xsd'])

task genMac {
description = 'Generate the Mac .app skeleton. Requires AppBundler (https://bitbucket.org/infinitekind/appbundler) ' +
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
distributionSha256Sum=765442b8069c6bee2ea70713861c027587591c6b1df2c857a23361512560894e
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions lib/licenses/Licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ mALIGNa is distributed under the MIT License (required for Aligner
tool).

DeNormalize.java is licensed under the DeNormalize license.

Nashorn javascript engine is distributed under the GNU General Public
License version 2.0 only with classpath link exception.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

package gen.core.project;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;


Expand Down Expand Up @@ -33,6 +37,8 @@
})
public class Masks {

// workaround https://github.com/FasterXML/jackson-modules-base/issues/127
@JacksonXmlElementWrapper(useWrapping=false)
protected List<String> mask;

/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import java.io.Serializable;
import java.nio.charset.StandardCharsets;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;

import gen.core.filters.Files;
import gen.core.filters.Filter;
Expand All @@ -60,19 +60,15 @@ private Convert20to21() {
* old config file
* @param toFile
* new config file
* @throws Exception
*/
public static void convertFiltersConfig(final File fromFile, final File toFile) throws Exception {
if (!fromFile.exists()) {
return;
}
String c = read(fromFile);
org.omegat.convert.v20to21.data.Filters filters;
XMLDecoder xmldec = new XMLDecoder(new ByteArrayInputStream(c.getBytes("UTF-8")));
try {
try (XMLDecoder xmldec = new XMLDecoder(new ByteArrayInputStream(c.getBytes(StandardCharsets.UTF_8)))) {
filters = (org.omegat.convert.v20to21.data.Filters) xmldec.readObject();
} finally {
xmldec.close();
}

Filters res = new Filters();
Expand Down Expand Up @@ -108,10 +104,9 @@ public static void convertFiltersConfig(final File fromFile, final File toFile)
convertTextFilter(res);
convertHTMLFilter2(res);

JAXBContext ctx = JAXBContext.newInstance(Filters.class);
Marshaller m = ctx.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(res, toFile);
XmlMapper mapper = new XmlMapper();
mapper.registerModule(new JaxbAnnotationModule());
mapper.writeValue(toFile, res);
}

/**
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.builder.EqualsBuilder;

import org.omegat.core.segmentation.SRX;
import org.omegat.filters2.master.FilterMaster;
import org.omegat.filters2.master.PluginUtils;
Expand All @@ -52,10 +50,8 @@
import org.omegat.util.Platform;
import org.omegat.util.StringUtil;

import gen.core.filters.Filter;
import gen.core.filters.Filters;
import gen.core.project.RepositoryDefinition;
import gen.core.project.RepositoryMapping;

/**
* Storage for project properties. May read and write project from/to disk.
Expand Down
File renamed without changes.
Loading