Ciao ragazzi,
Я выяснил решение, которое работает для меня, и я хочу поделиться им с вами:
plugins {
id "com.ullink.msbuild" version "2.15"
id "com.ullink.nuget" version "2.12"
// id "java"
}
println("Project : $project")
println("Name : $name")
println("Path : $path")
println("Description: $description")
println("ProjectDir : $projectDir")
println("BuildDir : $buildDir")
println("Group : $group")
println("Version : $version")
println("Ant : $ant")
def buildTimestamp = getTimestamp()
def buildNamePrefix = "ABC"
def buildTypes = ['Debug', 'Release']
buildTypes.each { variant ->
task "Build${variant}"(type: msbuild.class) {
description = "Builds the solution in '${variant}' flavour."
solutionFile = 'ABC.sln'
configuration = "${variant}"
parameters.OutDir = "${buildDir}\\${buildNamePrefix}_${buildTimestamp}_${variant}"
// you can also provide properties by name (/p:SomeProperty=Value)
parameters.GenerateProjectSpecificOutputFolder=true
parameters.OutDirWasSpecified=true
// Generates XML documentation file (from javadoc through custom DocLet)
generateDoc = false
doFirst {
println("Building '${configuration}' flavour ...")
println("${parameters}")
println()
}
doLast {
println()
println("Finished '${configuration}' build.")
}
}
}
buildTypes.each { variant ->
task "ZipBuild${variant}"(type: Zip) {
description = "Builds the solution in '${variant}' flavour and creates a zip file."
dependsOn "Build${variant}"
archiveName = "${buildNamePrefix}_${buildTimestamp}_${variant}.zip"
destinationDir = file("${buildDir}")
from("${buildDir}/${buildNamePrefix}_${buildTimestamp}_${variant}") {
include "ABC*/"
exclude "ABCAdminClasses/"
}
doFirst {
println("Creating '${destinationDir}\\${archiveName}' ...")
}
doLast {
println("Finished writing '${destinationDir}\\${archiveName}'.")
}
}
}
def getTimestamp() {
def date = new Date()
return date.format('yyyyMMdd_HHmm')
}
Запуск gradle tasks --all
показывает новые задачи .
С уважением,
Флориан