[Test infra] Take into account transitive compatible targets while checking compatibility.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -231,7 +231,12 @@ public final class InTextDirectivesUtils {
|
||||
return false;
|
||||
|
||||
List<String> backends = findLinesWithPrefixesRemoved(textWithDirectives(file), "// TARGET_BACKEND: ");
|
||||
return backends.isEmpty() || backends.contains(targetBackend.name()) || backends.contains(targetBackend.getCompatibleWith().name());
|
||||
return isCompatibleTargetExceptAny(targetBackend, backends);
|
||||
}
|
||||
|
||||
private static boolean isCompatibleTargetExceptAny(TargetBackend targetBackend, List<String> backends) {
|
||||
if (targetBackend == TargetBackend.ANY) return false;
|
||||
return backends.isEmpty() || backends.contains(targetBackend.name()) || isCompatibleTargetExceptAny(targetBackend.getCompatibleWith(), backends);
|
||||
}
|
||||
|
||||
public static boolean isIgnoredTarget(TargetBackend targetBackend, File file, String ignoreBackendDirectivePrefix) {
|
||||
|
||||
Reference in New Issue
Block a user