Update build.gradle
This commit is contained in:
52
build.gradle
52
build.gradle
@ -5,11 +5,9 @@ plugins {
|
||||
id 'application'
|
||||
id 'java-library'
|
||||
id 'war'
|
||||
id 'gradle-ncore' version('3.0.59')
|
||||
id 'gradle-ncore' version("$pluginVersion")
|
||||
}
|
||||
|
||||
//apply from: "dependencies.gradle"
|
||||
|
||||
targetCompatibility = 1.8
|
||||
|
||||
ncore {
|
||||
@ -17,10 +15,11 @@ ncore {
|
||||
sourceEncoding = 'UTF-8'
|
||||
}
|
||||
|
||||
group = 'biz.redsoft.sample'
|
||||
|
||||
repositories {
|
||||
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) {
|
||||
credentials {
|
||||
username project.credentials.user
|
||||
@ -40,8 +39,6 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
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')
|
||||
@ -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"
|
||||
|
||||
release {
|
||||
def newVersion = project.getVersion().toString().replace("-SNAPSHOT", "")
|
||||
commitNewVersion.enabled(true)
|
||||
failOnCommitNeeded = false
|
||||
failOnPublishNeeded = true
|
||||
@ -99,22 +97,50 @@ release {
|
||||
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}"
|
||||
tagTemplate = "${project.name}/v${newVersion}"
|
||||
versionPropertyFile = versionPropertiesFilePath
|
||||
versionProperties = []
|
||||
snapshotSuffix = '-SNAPSHOT'
|
||||
buildTasks = ['buildRelease', 'commitNewVersion']
|
||||
buildTasks = ['ncoreTestDbConnection', 'clean', 'unSnapshotVersion', 'writeVersion', 'commitNewVersion', 'nbackup', 'build', 'copyDist', 'publish', 'dockerFile', 'commitNewVersion']
|
||||
ignoredSnapshotDependencies = []
|
||||
versionPatterns = [
|
||||
/(\d+)(\.)(\d+)(\.)(\d+)([^\d]*\u0024)/: { Matcher m, Project p ->
|
||||
project.getVersion().newVersion().toString()
|
||||
}
|
||||
]
|
||||
pushReleaseVersionBranch = null
|
||||
git.requireBranch.set('master')
|
||||
pushReleaseVersionBranch = 'master'
|
||||
}
|
||||
|
||||
task buildRelease(type: GradleBuild) {
|
||||
tasks = ['clean', 'writeVersion', 'nbackup', 'build', 'copyDist', 'publish']
|
||||
//Добавить флаг -Pbiz.redsoft.release=true к таске release для того чтобы публиковалось в releases и false если в snapshots.
|
||||
//./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 {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
ncoreRestoreDB.writeToWebProps = false
|
||||
ncoreRestoreDB.generateUniqueDBPath = false
|
||||
}
|
Reference in New Issue
Block a user