blob: c4b50463042462449e82750a5ae95355a4e08acc [file] [log] [blame]
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This project contains tests for code contained in buildSrc
// This project is stored outside of buildSrc/ so that waiting for these tests to complete doesn't delay the rest of the build
import androidx.build.BuildServerConfigurationKt
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
implementation(gradleApi())
testImplementation(libs.junit)
implementation(project.files(new File(BuildServerConfigurationKt.getRootOutDirectory(project), "buildSrc/private/build/libs/private.jar")))
}
// Also do style checking of the buildSrc project from within this project too
// We run that from this project so that it doesn't block other projects while it runs
def ktlintDir = "../buildSrc/"
def subdirs = ["plugins", "private", "public"]
for (d : subdirs) {
def f = file("$ktlintDir/$d")
if (!f.exists()) {
throw new GradleException("Source dir does not exist: $f")
}
}
def ktlintInputs = project.fileTree(ktlintDir) {
for (d : subdirs) {
include("$ktlintDir/$d/src/**/*.kt")
}
}
def sourceArgs = []
for (d : subdirs) {
sourceArgs = sourceArgs + "$ktlintDir/$d/src/**/*.kt"
}
tasks["ktlint"].configure({ t ->
t.inputs.files(ktlintInputs)
t.workingDir = ktlintDir
t.args = t.args + sourceArgs
})
tasks["ktlintFormat"].configure({ t ->
t.inputs.files(ktlintInputs)
t.workingDir = ktlintDir
t.args = t.args + sourceArgs
})
// Broken in AGP 7.0-alpha15 due to b/180408027
tasks["lint"].configure { t ->
t.enabled = false
}