From e69ee7fdd82b4ad825e8f0350e2e28f5610e89cf Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Mon, 17 Apr 2017 17:51:18 +0300 Subject: [PATCH] Build scripts: copy dependencies file to artifacts while distributions building --- .../intellij/build/GradleRunner.groovy | 17 ++++++++++------- .../build/impl/DistributionJARsBuilder.groovy | 12 +++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/GradleRunner.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/GradleRunner.groovy index 616300cb9ba2..ba36dda7db7f 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/GradleRunner.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/GradleRunner.groovy @@ -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 command = new ArrayList() command.add("${projectDir.absolutePath}/$gradleScript".toString()) diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy index f298e65bca34..1b30db2208f4 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy @@ -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) + } + } }