org.gradle.integtests.fixtures.BuildOperationsFixture.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2017 the original author or authors.
*
* 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.
*/
package org.gradle.integtests.fixtures
import org.gradle.api.specs.Spec
import org.gradle.api.specs.Specs
import org.gradle.integtests.fixtures.executer.GradleExecuter
import org.gradle.internal.operations.BuildOperationType
import org.gradle.internal.operations.trace.BuildOperationRecord
import org.gradle.internal.operations.trace.BuildOperationTrace
import org.gradle.test.fixtures.file.TestDirectoryProvider
import java.util.regex.Pattern
class BuildOperationsFixture extends BuildOperationTreeQueries {
private BuildOperationTreeFixture tree
BuildOperationsFixture(GradleExecuter executer, TestDirectoryProvider projectDir) {
String path = projectDir.testDirectory.file("operations").absolutePath
executer.beforeExecute {
executer.withArgument("-D$BuildOperationTrace.SYSPROP=$path")
executer.afterExecute {
tree = new BuildOperationTreeFixture(BuildOperationTrace.read(path))
}
}
}
@Override
List getRoots() {
tree.roots
}
@Override
@SuppressWarnings("GrUnnecessaryPublicModifier")
public > BuildOperationRecord root(Class type, Spec super BuildOperationRecord> predicate = Specs.satisfyAll()) {
return tree.root(type, predicate)
}
@Override
@SuppressWarnings("GrUnnecessaryPublicModifier")
public > BuildOperationRecord first(Class type, Spec super BuildOperationRecord> predicate = Specs.satisfyAll()) {
return tree.first(type, predicate)
}
@Override
@SuppressWarnings("GrUnnecessaryPublicModifier")
public > boolean isType(BuildOperationRecord record, Class type) {
return tree.isType(record, type)
}
@Override
@SuppressWarnings("GrUnnecessaryPublicModifier")
public > List all(Class type, Spec super BuildOperationRecord> predicate = Specs.satisfyAll()) {
return tree.all(type, predicate)
}
@Override
BuildOperationRecord first(Pattern displayName) {
return tree.first(displayName)
}
@Override
List all() {
return tree.all()
}
@Override
List all(Pattern displayName) {
return tree.all(displayName)
}
@Override
BuildOperationRecord only(Pattern displayName) {
return tree.only(displayName)
}
@Override
List parentsOf(BuildOperationRecord child) {
return tree.parentsOf(child)
}
@Override
void none(Pattern displayName) {
tree.none(displayName)
}
@Override
void debugTree(
Spec super BuildOperationRecord> predicate = Specs.SATISFIES_ALL,
Spec super BuildOperationRecord> progressPredicate = Specs.SATISFIES_ALL
) {
tree.debugTree(predicate, progressPredicate)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy