blob: e493a8fc21fa246667f2014bfa0c6c8faa48e960 [file] [log] [blame]
Jeff Gaston9cfb0a12019-11-06 17:50:14 -05001/*
2 * Copyright 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 findGradleKotlinDsl() {
18 // TODO(137044144): After we convert this file to Kotlin (build.gradle.kts), we can just
19 // directly call the getGradleKotlinDsl() method.
20 // We're not doing that yet though because Gradle takes more time to process .kts files (at the
21 // time of writing, adding a .kts file adds roughly 10 addition seconds to build startup time).
Jeff Gaston28add7b2019-11-07 14:05:22 -050022 def kotlinDsl = "" + project.gradle.getGradleHomeDir() + "/lib/gradle-kotlin-dsl-" +
23 project.gradle.getGradleVersion() + ".jar"
Jeff Gaston9cfb0a12019-11-06 17:50:14 -050024 if (!project.file(kotlinDsl).exists()) {
25 throw new GradleException("Kotlin dsl jar does not exist: " + kotlinDsl)
26 }
27 return project.files(kotlinDsl)
28}
29
30ext.findGradleKotlinDsl = this.&findGradleKotlinDsl