Build scripts: copy dependencies file to artifacts while distributions

building
This commit is contained in:
Alexander Zolotov
2017-04-17 18:31:03 +03:00
parent 80d18f6dc7
commit e69ee7fdd8
2 changed files with 21 additions and 8 deletions
@@ -32,22 +32,24 @@ class GradleRunner {
* Invokes Gradle tasks on {@link #projectDir} project.
* Logs error and stops the build process if Gradle process is failed.
*/
def run(String title, String... tasks) {
runInner(title, false, tasks)
boolean run(String title, String... tasks) {
return runInner(title, false, tasks)
}
/**
* Invokes Gradle tasks on {@link #projectDir} project.
* Ignores the result of running Gradle.
*/
def forceRun(String title, String... tasks) {
runInner(title, true, tasks)
boolean forceRun(String title, String... tasks) {
return runInner(title, true, tasks)
}
private def runInner(String title, boolean force, String... tasks) {
private boolean runInner(String title, boolean force, String... tasks) {
def result = false
messages.block("Gradle $tasks") {
messages.progress(title)
if (!runInner(tasks)) {
result = runInner(tasks)
if (!result) {
def errorMessage = "Failed to complete `gradle ${tasks.join(' ')}`"
if (!force) {
messages.warning(errorMessage)
@@ -57,9 +59,10 @@ class GradleRunner {
}
}
}
return result
}
private def runInner(String... tasks) {
private boolean runInner(String... tasks) {
def gradleScript = SystemInfo.isWindows ? 'gradlew.bat' : 'gradlew'
List<String> command = new ArrayList()
command.add("${projectDir.absolutePath}/$gradleScript".toString())
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,6 +179,8 @@ class DistributionJARsBuilder {
}
void buildAdditionalArtifacts() {
copyDependenciesFile()
def productProperties = buildContext.productProperties
if (productProperties.generateLibrariesLicensesTable) {
buildContext.messages.block("Generate table of licenses for used third-party libraries") {
@@ -511,4 +513,12 @@ class DistributionJARsBuilder {
targetFile.text = defaultKeymapContent
return patchedKeyMapDir
}
private def copyDependenciesFile() {
if (buildContext.gradle.forceRun('Preparing dependencies file', 'dependenciesFile')) {
def outputFile = "$buildContext.paths.artifacts/dependencies.txt"
buildContext.ant.copy(file: "$buildContext.paths.communityHome/build/dependencies/build/dependencies.properties", tofile: outputFile)
buildContext.notifyArtifactBuilt(outputFile)
}
}
}