Files
ncore-sample/build.gradle
2025-05-23 17:11:52 +03:00

139 lines
4.1 KiB
Groovy

plugins {
id 'nu.studer.credentials' version('1.0.4')
id 'idea'
id 'eclipse'
id 'application'
id 'java-library'
id 'war'
id 'gradle-ncore' version('3.0.59')
}
targetCompatibility = 1.8
ncore {
coreVersion = project.properties.'biz.redsoft.ncore.version'
sourceEncoding = 'UTF-8'
}
repositories {
maven {
url 'https://ncore-repo.red-soft.ru/repository/ncore'
if (project.credentials.user != null && project.credentials.password != null) {
credentials {
username project.credentials.user
password project.credentials.password
}
}
}
}
dependencies {
implementation 'javax.servlet:javax.servlet-api:3.1.0'
testCompileClasspath 'org.junit.jupiter:junit-jupiter:5.8.2'
testImplementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.76'
testImplementation 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.76'
runtimeClasspath files(ncoreGenerateControlDataJar)
runtimeClasspath files(genJar)
}
group = 'biz.redsoft.sample'
// writing build process to a log file
// --------------------- BUILD LOG SETTINGS ----------------------
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
def buildLogDir = "${rootDir}/logs"
mkdir("${buildLogDir}")
def buildLog = new File("${buildLogDir}/${tstamp}_buildLog.log")
import org.gradle.internal.logging.LoggingOutputInternal
import java.util.regex.Matcher
System.setProperty('org.gradle.color.error', 'RED')
gradle.services.get(LoggingOutputInternal).addStandardOutputListener(new StandardOutputListener() {
void onOutput(CharSequence output) {
buildLog << output
}
})
gradle.services.get(LoggingOutputInternal).addStandardErrorListener(new StandardOutputListener() {
void onOutput(CharSequence output) {
buildLog << output
}
})
// --------------------- BUILD LOG SETTINGS ----------------------
run.args = ['client',
'-config', 'ncore-properties.xml',
'-config', 'ncore-properties-local.xml']
task copyDist(type: Copy) {
from distZip
from distTar
from war
def releaseDir
if (project.hasProperty('biz.redsoft.release.dir') && project.getProperty('biz.redsoft.release.dir'))
releaseDir = "${project.getProperty('biz.redsoft.release.dir')}"
else
releaseDir = "$projectDir/../releases"
into "$releaseDir/$project.name/$version"
}
def versionPropertiesFilePath = sourceSets.main.resources.srcDirs[0].toString() + File.separator + "META-INF/ncore-product/${project.group}/version.properties"
release {
commitNewVersion.enabled(true)
failOnCommitNeeded = false
failOnPublishNeeded = true
failOnSnapshotDependencies = true
failOnUnversionedFiles = false
failOnUpdateNeeded = false
revertOnFail = true
preCommitText = ''
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = "${project.name}/v${version}"
versionPropertyFile = versionPropertiesFilePath
versionProperties = []
snapshotSuffix = '-SNAPSHOT'
buildTasks = ['buildRelease', 'commitNewVersion']
ignoredSnapshotDependencies = []
versionPatterns = [
/(\d+)(\.)(\d+)(\.)(\d+)([^\d]*\u0024)/: { Matcher m, Project p ->
project.getVersion().newVersion().toString()
}
]
pushReleaseVersionBranch = null
}
task buildRelease(type: GradleBuild) {
tasks = ['clean', 'writeVersion', 'nbackup', 'build', 'copyDist', 'publish']
}
jar{
manifest{
attributes(
'Main-Class': 'biz.redsoft.ncore.client.MainForm',
'Class-Path': configurations.runtimeClasspath.collect { it.name }.join(' ')
)
}
}
startScripts {
project.startScripts.defaultJvmOpts = ['-Dlogback.configurationFile=./config/logback.xml']
}
distTar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
distZip {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
ncoreRestoreDB.writeToWebProps = false
ncoreRestoreDB.generateUniqueDBPath = false