Update build.gradle
This commit is contained in:
52
build.gradle
52
build.gradle
@ -5,11 +5,9 @@ plugins {
|
|||||||
id 'application'
|
id 'application'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'war'
|
id 'war'
|
||||||
id 'gradle-ncore' version('3.0.59')
|
id 'gradle-ncore' version("$pluginVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
//apply from: "dependencies.gradle"
|
|
||||||
|
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
ncore {
|
ncore {
|
||||||
@ -17,10 +15,11 @@ ncore {
|
|||||||
sourceEncoding = 'UTF-8'
|
sourceEncoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group = 'biz.redsoft.sample'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url 'https://ncore-repo.red-soft.ru/repository/public'
|
url 'https://ncore-repo.red-soft.ru/repository/ncore'
|
||||||
if (project.credentials.user != null && project.credentials.password != null) {
|
if (project.credentials.user != null && project.credentials.password != null) {
|
||||||
credentials {
|
credentials {
|
||||||
username project.credentials.user
|
username project.credentials.user
|
||||||
@ -40,8 +39,6 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group = 'biz.redsoft.sample'
|
|
||||||
|
|
||||||
// writing build process to a log file
|
// writing build process to a log file
|
||||||
// --------------------- BUILD LOG SETTINGS ----------------------
|
// --------------------- BUILD LOG SETTINGS ----------------------
|
||||||
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
|
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
|
||||||
@ -88,6 +85,7 @@ task copyDist(type: Copy) {
|
|||||||
def versionPropertiesFilePath = sourceSets.main.resources.srcDirs[0].toString() + File.separator + "META-INF/ncore-product/${project.group}/version.properties"
|
def versionPropertiesFilePath = sourceSets.main.resources.srcDirs[0].toString() + File.separator + "META-INF/ncore-product/${project.group}/version.properties"
|
||||||
|
|
||||||
release {
|
release {
|
||||||
|
def newVersion = project.getVersion().toString().replace("-SNAPSHOT", "")
|
||||||
commitNewVersion.enabled(true)
|
commitNewVersion.enabled(true)
|
||||||
failOnCommitNeeded = false
|
failOnCommitNeeded = false
|
||||||
failOnPublishNeeded = true
|
failOnPublishNeeded = true
|
||||||
@ -99,22 +97,50 @@ release {
|
|||||||
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
|
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
|
||||||
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
|
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
|
||||||
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
|
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
|
||||||
tagTemplate = "${project.name}/v${version}"
|
tagTemplate = "${project.name}/v${newVersion}"
|
||||||
versionPropertyFile = versionPropertiesFilePath
|
versionPropertyFile = versionPropertiesFilePath
|
||||||
versionProperties = []
|
versionProperties = []
|
||||||
snapshotSuffix = '-SNAPSHOT'
|
snapshotSuffix = '-SNAPSHOT'
|
||||||
buildTasks = ['buildRelease', 'commitNewVersion']
|
buildTasks = ['ncoreTestDbConnection', 'clean', 'unSnapshotVersion', 'writeVersion', 'commitNewVersion', 'nbackup', 'build', 'copyDist', 'publish', 'dockerFile', 'commitNewVersion']
|
||||||
ignoredSnapshotDependencies = []
|
ignoredSnapshotDependencies = []
|
||||||
versionPatterns = [
|
versionPatterns = [
|
||||||
/(\d+)(\.)(\d+)(\.)(\d+)([^\d]*\u0024)/: { Matcher m, Project p ->
|
/(\d+)(\.)(\d+)(\.)(\d+)([^\d]*\u0024)/: { Matcher m, Project p ->
|
||||||
project.getVersion().newVersion().toString()
|
project.getVersion().newVersion().toString()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
pushReleaseVersionBranch = null
|
git.requireBranch.set('master')
|
||||||
|
pushReleaseVersionBranch = 'master'
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildRelease(type: GradleBuild) {
|
//Добавить флаг -Pbiz.redsoft.release=true к таске release для того чтобы публиковалось в releases и false если в snapshots.
|
||||||
tasks = ['clean', 'writeVersion', 'nbackup', 'build', 'copyDist', 'publish']
|
//./gradlew release -Pbiz.redsoft.release=true
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
def isRepoCredetionals = project.hasProperty('biz.redsoft.repo.user') && project.hasProperty('biz.redsoft.repo.password')
|
||||||
|
def isCredentialsInsideBuildScript = project.credentials.user != null && project.credentials.password != null
|
||||||
|
println(isRepoCredetionals ? "Using repoCredentials for publish..." :
|
||||||
|
isCredentialsInsideBuildScript ? "Using buildScript credentials for publish..." : "Credentials are not presented!!!")
|
||||||
|
if (isRepoCredetionals) {
|
||||||
|
credentials {
|
||||||
|
username project.'biz.redsoft.repo.user'
|
||||||
|
password project.'biz.redsoft.repo.password'
|
||||||
|
}
|
||||||
|
} else if (isCredentialsInsideBuildScript) {
|
||||||
|
credentials {
|
||||||
|
username project.credentials.user
|
||||||
|
password project.credentials.password
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def suffix = project.findProperty('biz.redsoft.release') ? 'releases' : 'snapshots'
|
||||||
|
url "https://ncore-repo.red-soft.ru/repository/${suffix}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,6 +162,4 @@ distTar {
|
|||||||
}
|
}
|
||||||
distZip {
|
distZip {
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
ncoreRestoreDB.writeToWebProps = false
|
|
||||||
ncoreRestoreDB.generateUniqueDBPath = false
|
|
Reference in New Issue
Block a user