From 41f4f24f539b8c647e7b8bb1f48bbad5383ef47a Mon Sep 17 00:00:00 2001 From: Damien Merenne Date: Fri, 21 Apr 2017 11:32:00 +0200 Subject: [PATCH] Allow out of tree builds. Before modularisation of the code, it was possible to do an out of tree build giving an -PbuildDir=someDir argument to gradle. With the modularisation, it's broken as using -PbuildDir=someDir will force the same directory for each projects, which breaks the gradle build system. This commit adds a new externalBuildDir project property to allow out of tree builds again. When set, it updates the buildDir property for each project to point to ${externalBuildDir}/${project.name}. That way, the build artifacts are written in the out of tree directory in a project specific folder. To do an out of tree build, use gradle -PexternalBuildDir=someDir ... It supports absolute and relative path. Relative path are interpreted against the ExoPlayer root directory. --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 9c83e045db..5b3c955df4 100644 --- a/build.gradle +++ b/build.gradle @@ -51,6 +51,11 @@ allprojects { releaseVersion = 'r2.3.1' releaseWebsite = 'https://github.com/google/ExoPlayer' } + if (it.hasProperty('externalBuildDir')) { + if (!new File(externalBuildDir).isAbsolute()) + externalBuildDir = new File(rootDir, externalBuildDir) + buildDir = "${externalBuildDir}/${project.name}" + } } def getBintrayRepo() {