org.gradle.integtests.fixtures.executer.TaskOrderSpecs 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.executer;
import org.gradle.util.internal.GUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Provides common assertions for querying task order.
*
* An 'any' rule asserts that all of the specified tasks occur in any order.
*
* any(':a', ':b', ':c') would match on any permutation of ':a', ':b', ':c'.
*
* An 'exact' rule asserts that all of the specified tasks occur in the order
* provided. Note that other tasks may appear - it only verifies that the
* given tasks occur in order.
*
* exact(':b', ':d') would match on [ ':b', ':d' ] or say [ ':a', ':b', ':c', ':d' ]
*
* Assertions can also be nested:
*
* exact(':a', any(':b', ':c'), ':d') would match any of the following:
* - [ ':a', ':b', ':c', ':d' ]
* - [ ':a', ':c', ':b', ':d' ]
* but not
* - [ ':b', ':a', ':c', ':d' ]
*
* Similarly, an exact rule can be nested inside of an any rule:
*
* any(':a', exact(':b', ':c)) would match any of the following:
* - [ ':a', ':b', ':c' ]
* - [ ':b', ':c', ':a' ]
* - [ ':b', ':a', ':c' ]
* but not
* - [ ':c', ':a', ':b' ]
* - [ ':a', ':c', ':b' ]
* or any other combination where :c occurs before :b
*/
public class TaskOrderSpecs {
public static TaskOrderSpec any(Object[] constraints) {
return new AnyOrderSpec(Arrays.asList(constraints));
}
public static TaskOrderSpec exact(Object[] constraints) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy