Jeff Gaston | 79a43f2 | 2019-04-09 16:19:12 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | def init = new Properties() |
| 18 | ext.init = init |
| 19 | |
George Mount | 68e8557 | 2019-05-06 16:33:16 -0700 | [diff] [blame] | 20 | def chooseOutDir(subdir = "") { |
Jeff Gaston | 79a43f2 | 2019-04-09 16:19:12 -0400 | [diff] [blame] | 21 | /* |
| 22 | * The OUT_DIR is a temporary directory you can use to put things during the build. |
| 23 | */ |
| 24 | def outDir = System.env.OUT_DIR |
| 25 | if (outDir == null) { |
George Mount | 68e8557 | 2019-05-06 16:33:16 -0700 | [diff] [blame] | 26 | outDir = new File("${buildscript.getSourceFile().parent}/../../../out${subdir}") |
Jeff Gaston | 79a43f2 | 2019-04-09 16:19:12 -0400 | [diff] [blame] | 27 | } |
| 28 | buildDir = new File(outDir, "$project.name/build") |
| 29 | .getCanonicalFile() |
| 30 | subprojects { |
| 31 | // Change buildDir first so that all plugins pick up the new value. |
| 32 | project.buildDir = new File("$project.parent.buildDir/../$project.name/build") |
| 33 | } |
Jeff Gaston | 79a43f2 | 2019-04-09 16:19:12 -0400 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | ext.init.chooseOutDir = this.&chooseOutDir |