engine/build.gradle
Rama develop · réplica de lectura del repositorio original.
import org.gradle.api.tasks.PathSensitivity
group = 'com.convertigo'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'maven-publish'
publishing {
publications {
engineJar(MavenPublication) {
version = version.replace('beta', 'SNAPSHOT')
from components.java
}
dependenciesJar(MavenPublication) {
version = version.replace('beta', 'SNAPSHOT')
artifactId = 'dependencies'
afterEvaluate {
artifact tasks['dependenciesJar'].archiveFile
}
}
}
repositories {
maven {
url = project.properties['c8o.m2.url']
credentials(AwsCredentials) {
accessKey = project.properties['c8o.m2.ak']
secretKey = project.properties['c8o.m2.sk']
}
}
}
}
eclipse {
project {
natures 'org.eclipse.buildship.core.gradleprojectnature'
buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
linkedResource name: 'convertigo', type: '2', locationUri: 'PARENT-1-PROJECT_LOC/eclipse-plugin-studio/tomcat/webapps/convertigo'
// providers linked as sources only on demand (c8o.localProviders in gradle.properties)
rootProject.localProviders.each {
linkedResource name: it.path, type: '2', location: it.sources.path
}
}
wtp {
component {
contextPath = 'convertigo'
deployName = 'convertigo'
//resource sourcePath: 'convertigo', deployPath: '/'
file {
withXml {
def node = it.asNode()
if (node.'wb-module'.'wb-resource'.find { it['@deploy-path'] == '/' } == null) {
node = node['wb-module'][0].appendNode('wb-resource')
node['@source-path'] = 'convertigo'
node['@deploy-path'] = '/'
}
}
}
}
}
classpath.file.withXml {
rootProject.applyLocalProvidersToClasspath(it)
}
classpath.file.withXml {
def elt = it.asElement()
def nl = elt.getElementsByTagName('classpathentry')
for (def i = 0; i < nl.length; i++) {
def entry = nl.item(i)
if (entry.getAttribute('path').contains('libs/dependencies')) {
entry.setAttribute('sourcepath', entry.getAttribute('path').replace('libs/dependencies', 'libs/dependencies-sources'))
return
}
}
}
}
tasks['eclipse'].dependsOn ':engine:dependenciesSourceJar'
configurations {
compileFlat
sapjco3
}
configurations.compileFlat {
// Axiom also brings this parser transitively; use the default StAX providers instead.
exclude group: 'com.fasterxml.woodstox', module: 'woodstox-core'
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.codehaus.groovy') {
// SoapUI's Groovy parser must understand Java 25 class files.
details.useVersion groovyVersion
}
if (details.requested.group == 'org.apache.neethi' && details.requested.name == 'neethi') {
// Force Axis2 transitive dependency to the security-fixed Neethi version.
details.useVersion '3.2.4'
}
if (details.requested.group == 'io.netty' && details.requested.name.startsWith('netty-')) {
// Force Redisson transitive dependencies to the security-fixed Netty version.
details.useVersion '4.2.20.Final'
}
}
}
jar {
archiveBaseName = 'convertigo-engine'
include 'com/twinsoft/**'
exclude 'com/twinsoft/beans/**/*.svg'
}
def dependenciesIndex = layout.buildDirectory.file("tmp/allJars.txt")
tasks.register("generateDependenciesIndex") {
group = 'convertigo'
outputs.cacheIf("Cache dependencies index") { true }
outputs.file(dependenciesIndex)
inputs.files({ configurations.compileFlat })
.withPropertyName("compileFlatArtifacts")
.withPathSensitivity(PathSensitivity.RELATIVE)
doLast {
def buf = []
def substr = System.getProperty("user.home").length() + 1
configurations.compileFlat.each {
if (it.isFile() && it.getName().endsWith('.pom')) {
return
}
buf += it.toString().substring(substr)
}
buf.sort()
def file = dependenciesIndex.get().asFile
file.parentFile.mkdirs()
file.text = buf.join('\n')
}
}
def patchesJarFileProvider = providers.provider {
project(':patches').tasks.named('jar').get().archiveFile.get().asFile
}
task dependenciesJar(type: Jar, dependsOn: ':patches:jar') {
group = 'convertigo'
zip64 = true
archiveBaseName = 'dependencies'
duplicatesStrategy = 'exclude'
dependsOn tasks.named("generateDependenciesIndex")
outputs.cacheIf("Always cache dependencies archive") { true }
inputs.files({ configurations.compileFlat })
.withPropertyName("compileFlatArtifacts")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.file(dependenciesIndex)
.withPropertyName("dependenciesIndex")
.withPathSensitivity(PathSensitivity.RELATIVE)
.optional()
// Always include patches first so their classes override dependency duplicates.
from {
zipTree(patchesJarFileProvider.get())
}
from {
def patchesJarFile = patchesJarFileProvider.get()
configurations.compileFlat.collect { dep ->
if (dep.isFile() && dep.getName().endsWith('.pom')) {
return null
}
if (dep == patchesJarFile) {
return null
}
dep.isDirectory() ? dep : zipTree(dep)
}.findAll { it != null }
} {
exclude 'META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat'
exclude 'com/eviware/soapui/explorer/**'
}
// Ensure log4j2 plugin cache comes from log4j-core, not a dependency that overrides it (e.g. SoapUI).
from {
def log4jCoreJar = configurations.compileFlat.find { it.name.startsWith('log4j-core-') }
log4jCoreJar != null ? zipTree(log4jCoreJar) : []
} {
include 'META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat'
}
from(dependenciesIndex)
// The JDK provides org.w3c.dom, but not the SVG and SMIL DOM of xml-apis-ext: Batik
// (SVG rasterization, FOP) needs them at runtime.
exclude { it.path.startsWith('org/w3c/dom/') && !it.path.startsWith('org/w3c/dom/svg/') && !it.path.startsWith('org/w3c/dom/smil/') }
exclude 'org/xml/sax/**', 'javax/xml/catalog/**', 'javax/xml/datatype/**', 'javax/xml/namespace/**'
exclude 'javax/xml/parsers/**', 'javax/xml/stream/**', 'javax/xml/transform/**', 'javax/xml/validation/**'
exclude 'javax/xml/xpath/**', 'javax/xml/XMLConstants.class'
exclude 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/DEPENDENCIES'
exclude 'META-INF/MANIFEST.MF', 'META-INF/INDEX.LIST', 'META-INF/EVIWARE.*', 'META-INF/license.txt'
exclude 'META-INF/notice.txt', 'META-INF/README*', 'META-INF/spring*', 'overview.html', 'externs.zip'
exclude 'META-INF/maven/commons-lang/**'
exclude 'META-INF/mailcap*', 'META-INF/MANIFEST.MF', 'META-INF/*.RSA', 'META-INF/*.DSA', 'META-INF/*.SF'
}
tasks['generatePomFileForDependenciesJarPublication'].dependsOn dependenciesJar
tasks['publishToMavenLocal'].dependsOn dependenciesJar
tasks['publish'].dependsOn dependenciesJar
compileJava.dependsOn dependenciesJar
def warRuntimeClasspathDir = layout.buildDirectory.dir('tmp/warRuntimeClasspath')
tasks.register('prepareWarRuntimeClasspath', Sync) {
from configurations.runtimeClasspath
// the SAP JCo placeholder is only shipped once, renamed to sapjco3.jar (see the 'sapjco3' configuration below)
exclude 'sapjco3-*.jar'
into warRuntimeClasspathDir
filePermissions {
unix('0644')
}
dirPermissions {
unix('0755')
}
}
war {
webAppDirectory = file('convertigo')
archiveBaseName = 'convertigo'
filePermissions {
unix('0644')
}
dirPermissions {
unix('0755')
}
eachFile { f ->
if (f.directory) {
f.permissions {
unix('0755')
}
} else {
f.permissions {
unix('0644')
}
}
}
outputs.cacheIf { false }
classpath = files(jar)
from tasks.named('prepareWarRuntimeClasspath'), {
into 'WEB-INF/lib'
}
doFirst {
project.war.webAppDirectory = file('../eclipse-plugin-studio/tomcat/webapps/convertigo')
file('build/tmp/build.txt').text = """\
build.version=${convertigoRevision}
build.date=${new Date().toString()}
build.filename=${war.archiveFileName.get()}"""
}
from 'build/tmp/build.txt', {
into 'WEB-INF'
}
// Never pick up a payload that a prior Eclipse packaging run left in the webapp source.
exclude 'WEB-INF/flow-migration/**'
exclude '**/keys.txt'
exclude '**/*.car'
rename 'keys_server.txt', 'keys.txt'
afterEvaluate {
from configurations.sapjco3[0], {
into 'WEB-INF/lib'
rename '(.*)', 'sapjco3.jar'
filePermissions {
unix('0644')
}
}
}
dependsOn 'unzipSwaggerUI', 'prepareWarRuntimeClasspath'
}
sourceSets {
main {
java {
exclude 'com/twinsoft/convertigo/engine/plugins/**'
exclude 'test/'
exclude '.placeholder'
srcDirs = ['src']
}
resources {
exclude 'com/twinsoft/convertigo/engine/plugins/**'
exclude 'test/'
exclude '.placeholder'
srcDirs = ['src']
}
}
}
apply from: 'tests.gradle'
dependencies {
implementation 'org.apache.logging.log4j:log4j-1.2-api:' + log4jVersion
compileFlat project(path: ':patches')
compileFlat ('org.apache.logging.log4j:log4j-core:' + log4jVersion) {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
compileFlat 'org.apache.logging.log4j:log4j-api:' + log4jVersion
compileFlat 'org.apache.logging.log4j:log4j-jcl:' + log4jVersion
compileFlat 'ca.juliusdavies:not-yet-commons-ssl:0.3.17'
compileFlat 'com.convertigo.lib:ctgclient:2010.06.14'
compileFlat 'com.convertigo.lib:httpclientAuthHelper:2014.12.23'
compileFlat 'com.smartbear.soapui:soapui-light:' + soapuiVersion
implementation "com.convertigo.provider:convertigo-provider-couchdb:8.5.0-SNAPSHOT"
implementation 'com.convertigo.provider:convertigo-provider-sap:8.4.5'
compileFlat 'com.convertigo.twinsoft.lib:aviva:2017.09.04'
compileFlat 'com.convertigo.twinsoft.lib:comm:1998.11.15'
compileFlat 'com.convertigo.twinsoft.lib:ms:2002.01.03'
compileFlat 'com.convertigo.twinsoft.lib:netscape:2002.01.04'
compileFlat 'com.convertigo.twinsoft.lib:phaos:1998.11.15'
implementation 'com.convertigo.twinsoft:api:2017.12.29'
compileFlat 'com.convertigo.twinsoft:ibm:2017.03.10'
implementation 'com.convertigo.twinsoft:tas:2019.10.16'
compileFlat 'com.convertigo.twinsoft:twinj:2016.05.09'
compileFlat 'com.convertigo.twinsoft:ui:2009.06.15'
implementation 'com.convertigo.twinsoft:util:2017.12.29'
compileFlat 'com.fasterxml.jackson.core:jackson-core:' + jacksonVersion
compileFlat 'com.google.guava:guava:33.7.2-jre'
compileFlat ('com.google.gcm:gcm-server:1.0.0') {
exclude group: 'junit', module: 'junit'
}
compileFlat 'junit:junit:4.13.2'
compileFlat 'com.opencsv:opencsv:5.12.0'
compileFlat 'commons-beanutils:commons-beanutils:1.11.0'
compileFlat 'commons-collections:commons-collections:3.2.2'
compileFlat 'commons-cli:commons-cli:1.11.0'
compileFlat 'commons-fileupload:commons-fileupload:1.6.0'
compileFlat 'commons-httpclient:commons-httpclient:3.1'
compileFlat 'commons-io:commons-io:' + commonsIo
compileFlat 'commons-jxpath:commons-jxpath:1.4.0'
compileFlat 'org.snakeyaml:snakeyaml-engine:3.2'
compileFlat 'org.yaml:snakeyaml:2.7'
compileFlat 'io.swagger:swagger-models:1.6.16'
compileFlat 'io.swagger:swagger-parser:1.0.76'
compileFlat 'io.swagger.core.v3:swagger-annotations:2.2.55'
compileFlat 'io.swagger.core.v3:swagger-models:2.2.55'
compileFlat 'io.swagger.core.v3:swagger-core:2.2.55'
compileFlat 'io.swagger.parser.v3:swagger-parser-core:2.1.48'
compileFlat 'io.swagger.parser.v3:swagger-parser-v3:2.1.48'
compileFlat 'javax.activation:activation:1.1.1'
compileFlat 'javax.mail:mail:1.4.7'
compileFlat 'org.slf4j:slf4j-ext:2.0.20'
compileFlat 'org.slf4j:slf4j-simple:2.0.20'
compileFlat 'oauth.signpost:signpost-core:2.1.1'
compileFlat 'org.apache.axis2:axis2-saaj:1.8.2', { exclude module: 'servlet-api'}
compileFlat 'org.dom4j:dom4j:2.2.0'
compileFlat 'org.freemarker:freemarker:2.3.35'
// The legacy Reflections dependency otherwise selects a pre-invokedynamic parser.
compileFlat 'org.javassist:javassist:3.33.0-GA'
compileFlat 'org.apache.commons:commons-lang3:' + commonsLang3
compileFlat 'org.apache.httpcomponents:httpclient:4.5.14'
compileFlat 'org.apache.james:apache-mime4j-core:0.8.15'
compileFlat 'org.apache.pdfbox:pdfbox:3.0.8'
compileFlat 'org.apache.tika:tika-core:4.2.0'
compileFlat 'org.apache.ws.commons.axiom:axiom-api:1.4.0'
compileFlat 'org.apache.ws.commons.axiom:axiom-dom:1.4.0'
compileFlat 'org.apache.ws.commons.axiom:axiom-impl:1.4.0'
compileFlat 'org.apache.ws.commons.schema:XmlSchema:' + xmlSchemaVersion
compileFlat 'org.bouncycastle:bcprov-jdk18on:1.86'
compileFlat 'org.apache.xmlbeans:xmlbeans:3.1.1-sb-fixed'
compileFlat 'org.apache.xmlgraphics:fop:2.12', { exclude module: 'batik-js'}
compileFlat 'org.codehaus.jettison:jettison:1.5.7'
compileFlat 'org.codehaus.woodstox:stax2-api:4.3.2'
compileFlat 'org.eclipse.jgit:org.eclipse.jgit:7.8.1.202611041320-r'
compileFlat 'org.eclipse.jgit:org.eclipse.jgit.ssh.apache:7.8.1.202611041320-r'
compileFlat 'org.hibernate.orm:hibernate-core:7.4.14.Final'
compileFlat 'org.mitre.dsmiley.httpproxy:smiley-http-proxy-servlet:2.0'
compileFlat 'org.mozilla:rhino:1.9.2'
compileFlat 'org.mozilla:rhino-tools:1.9.2'
compileFlat 'org.quartz-scheduler:quartz:2.5.2'
compileFlat 'regexp:regexp:1.3'
compileFlat 'wsdl4j:wsdl4j:1.6.3'
compileFlat 'xalan:serializer:2.7.3'
compileFlat 'xalan:xalan:2.7.3'
compileFlat 'xerces:xercesImpl:2.12.2'
compileFlat 'xml-resolver:xml-resolver:1.2'
// runtime dependencies from here
compileFlat 'com.convertigo.lib:qrcode:2011.05.19-jakarta'
compileFlat 'net.sf.jt400:jt400:11.2'
compileFlat 'net.sourceforge.jtds:jtds:1.3.1'
compileFlat 'org.hsqldb:hsqldb:2.7.4'
compileFlat 'org.mariadb.jdbc:mariadb-java-client:4.0.0'
compileFlat 'org.postgresql:postgresql:42.7.14'
compileFlat 'org.redisson:redisson:4.8.0'
// end runtime dependencies
compileFlat 'org.apache.tomcat.embed:tomcat-embed-core:' + tomcatVersion
compileFlat 'org.apache.tomcat.embed:tomcat-embed-websocket:' + tomcatVersion
compileFlat 'org.apache.tomcat:tomcat-dbcp:' + tomcatVersion
//compileFlat 'org.apache.tomcat:tomcat-websocket:' + tomcatVersion
implementation "com.github.luben:zstd-jni:${zstdJniVersion}"
implementation "com.aayushatharva.brotli4j:brotli4j:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-linux-x86_64:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-linux-aarch64:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-osx-x86_64:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-osx-aarch64:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-windows-x86_64:${brotli4jVersion}"
runtimeOnly "com.aayushatharva.brotli4j:native-windows-aarch64:${brotli4jVersion}"
implementation project.property('sapjco3Version')
sapjco3 project.property('sapjco3Version')
implementation files(dependenciesJar.archiveFile)
runtimeOnly project(path: ':placeholders', configuration: 'allPlaceholders')
}
task dependenciesSourceJar(type: Jar) {
group = 'convertigo'
def sourceConfig = configurations.create('sources')
def sourceExcludes = [
// Skip sources that trigger false-positive CVEs in dependency-check.
'commons-httpclient:commons-httpclient',
'org.apache.james:apache-mime4j-core',
'org.apache.ws.commons.schema:XmlSchema',
'org.mitre.dsmiley.httpproxy:smiley-http-proxy-servlet'
]
sourceExcludes.each { ga ->
def (group, module) = ga.split(':', 2)
sourceConfig.exclude group: group, module: module
}
configurations.compileFlat.allDependencies.each { dependency ->
if (dependency instanceof ExternalModuleDependency) {
if (sourceExcludes.contains("${dependency.group}:${dependency.name}")) {
return
}
def sourceNotation = "${dependency.group}:${dependency.name}:${dependency.version}:sources@jar"
sourceConfig.dependencies.add(dependencies.create(sourceNotation))
}
}
from {
sourceConfig.incoming.artifactView {
lenient(true) // ignore errors
}.files.findAll { it.exists() && it.name.endsWith('sources.jar') }
.collect { zipTree(it) }
}
include '**/*.java'
archiveBaseName = 'dependencies-sources'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task updateProductVersion {
group = 'convertigo'
inputs.property("convertigoVersion", convertigoVersion)
inputs.property("convertigoTag", convertigoTag)
inputs.property("convertigoRevision", convertigoRevision)
outputs.file 'src/com/twinsoft/convertigo/engine/ProductVersion.java'
doLast {
def vers = convertigoVersion.split('\\.')
def file = file 'src/com/twinsoft/convertigo/engine/ProductVersion.java'
file.text = file.text
.replaceFirst('(majorProductVersion = ).*;', "\$1\"${vers[0]}\";")
.replaceFirst('(minorProductVersion = ).*;', "\$1\"${vers[1]}\";")
.replaceFirst('(servicePack = ).*;', "\$1\"${vers[2]}\";")
.replaceFirst('(tag = ).*;', '$1' + (convertigoTag.isEmpty() ? 'null;' : "\"${convertigoTag}\";"))
.replaceFirst('(revision = ).*;', '$1' + (convertigoRevision.isEmpty() ? 'null;': "\"${convertigoRevision}\";"))
}
}
task engineApiJar(type: Jar) {
group = 'build'
archiveBaseName = 'convertigo-engine-api'
from sourceSets.main.output
include '**/*.class'
exclude 'com/twinsoft/convertigo/engine/parsers/**'
exclude 'com/twinsoft/convertigo/engine/plugins/**'
exclude 'com/twinsoft/convertigo/engine/providers/**'
}
task unzipSwaggerUI {
group = 'convertigo'
def zip = file "build/tmp/swagger-v${swaggerUiVersion}.zip"
inputs.properties(
'swaggerUiVersion': swaggerUiVersion
)
def patch = file '../eclipse-plugin-studio/tomcat/webapps/convertigo/swagger/patch'
def dist = file '../eclipse-plugin-studio/tomcat/webapps/convertigo/swagger/dist'
outputs.dir dist
doLast {
file('build/tmp').mkdirs()
new URI("https://codeload.github.com/swagger-api/swagger-ui/zip/refs/tags/v${swaggerUiVersion}").toURL().withInputStream{ i -> zip.withOutputStream{ it << i }}
dist.delete()
copy {
from zipTree(zip)
include '**/dist/*.png', '**/dist/*.html', '**/dist/*.css', '**/dist/*.js'
includeEmptyDirs = false
into dist
eachFile { f ->
f.path = f.path.replaceFirst('.*/', '')
}
}
zip.delete()
copy {
from patch
into dist
}
}
}
task copyLicense(type: Copy, dependsOn: [':checkLicenseDate']) {
group = 'convertigo'
from('../legal/dual-license.txt') {
rename { 'license.txt' }
}
into '../eclipse-plugin-studio/tomcat/webapps/convertigo/licenses'
}
task copyFlashUpdateDependencies(type: Copy) {
group = 'convertigo'
from '../eclipse-plugin-studio/tomcat/webapps/convertigo/scripts/jquery2.min.js'
from('../eclipse-plugin-studio/tomcat/webapps/convertigo/css') {
include 'flashupdate.css'
include 'flashupdate_android.css'
include 'flashupdate_ios.css'
include 'flashupdate_fonts/**'
include 'flashupdate_images/**'
}
into 'src/com/twinsoft/convertigo/engine/admin/services/mobiles/res'
}
task engineDependenciesClasspathJar(type: Jar, dependsOn: dependenciesJar) {
group = 'convertigo'
archiveAppendix = 'updateBeansDefaultValues'
manifest {
attributes 'Class-Path': files(sourceSets.main.compileClasspath, sourceSets.main.runtimeClasspath)
.filter { it.name.endsWith '.jar' }
.collect {it.toURI().toString().substring(5)}
.join(' ')
}
}
task updateBeansDefaultValues(type: JavaExec, dependsOn: engineDependenciesClasspathJar) {
group = 'convertigo'
inputs.files fileTree('src/com/twinsoft/convertigo/beans')
outputs.file 'src/com/twinsoft/convertigo/beans/database_objects_default.xml'
outputs.file 'src/com/twinsoft/convertigo/beans/mobile/components/dynamic/ion_objects_default.json'
outputs.file 'src/com/twinsoft/convertigo/beans/ngx/components/dynamic/ion_objects_default.json'
classpath sourceSets.main.output
classpath engineDependenciesClasspathJar.archiveFile
mainClass = 'com.twinsoft.convertigo.beans.BeansDefaultValues'
args 'src', sourceSets.main.output.resourcesDir
}
task generateDocumentationMd(type: JavaExec, dependsOn: [engineDependenciesClasspathJar, updateBeansDefaultValues]) {
group = 'convertigo'
onlyIf {
project.hasProperty('documentationPath')
}
if (project.hasProperty('documentationPath')) {
def docPath = file(project.property('documentationPath'))
def docMax = project.hasProperty('documentationMax') ? project.property('documentationMax') : -1
println docPath
inputs.files fileTree('src/com/twinsoft/convertigo/beans')
outputs.dir docPath
classpath sourceSets.main.output
classpath engineDependenciesClasspathJar.archiveFile
mainClass = 'com.twinsoft.convertigo.beans.BeansDoc'
args docPath.absolutePath, docMax
}
}
processResources.dependsOn('copyFlashUpdateDependencies')
compileJava.dependsOn(['copyLicense', 'copyFlashUpdateDependencies', 'updateProductVersion'])
processResources.dependsOn(':convertigo-svg-icons:run')
jar.dependsOn('updateBeansDefaultValues')