blob: 7ad4cbf8f0127006af7ab18cd3d3657c4b68be78 [file] [log] [blame]
Jeff Gaston79a43f22019-04-09 16:19:12 -04001/*
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
17def init = new Properties()
18ext.init = init
19
George Mount68e85572019-05-06 16:33:16 -070020def chooseOutDir(subdir = "") {
Jeff Gaston79a43f22019-04-09 16:19:12 -040021 /*
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 Mount68e85572019-05-06 16:33:16 -070026 outDir = new File("${buildscript.getSourceFile().parent}/../../../out${subdir}")
Jeff Gaston79a43f22019-04-09 16:19:12 -040027 }
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 Gaston79a43f22019-04-09 16:19:12 -040034}
35
36ext.init.chooseOutDir = this.&chooseOutDir