Skip to content

Commit

Permalink
Allow disabling build api restrictions for testing legacy plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Sep 18, 2023
1 parent 50a031f commit 40ec48b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ class LegacyYamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTe
// 1. TestClustersPlugin not cc compatible due to listener registration
// 2. RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
buildApiRestrictionsDisabled = true
}

def "yamlRestTestVxCompatTest does nothing when there are no tests"() {
given:
println "LegacyYamlRestCompatTestPluginFuncTest.yamlRestTestVxCompatTest does nothing when there are no tests"
subProject(":distribution:bwc:maintenance") << """
configurations { checkout }
artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import org.gradle.testkit.runner.TaskOutcome
@IgnoreIf({ os.isWindows() })
class LegacyYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {

def setup() {
buildApiRestrictionsDisabled = true
}


def "yamlRestTest does nothing when there are no tests"() {
given:
// RestIntegTestTask not cc compatible due to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ abstract class AbstractGradleFuncTest extends Specification {
File propertiesFile
File projectDir

boolean configurationCacheCompatible = true
protected boolean configurationCacheCompatible = true
protected boolean buildApiRestrictionsDisabled = false

def setup() {
projectDir = testProjectDir.root
Expand Down Expand Up @@ -78,6 +79,7 @@ abstract class AbstractGradleFuncTest extends Specification {
}

GradleRunner gradleRunner(File projectDir, Object... arguments) {
println "AbstractGradleFuncTest.gradleRunner"
return new NormalizeOutputGradleRunner(
new BuildConfigurationAwareGradleRunner(
new InternalAwareGradleRunner(
Expand All @@ -88,7 +90,8 @@ abstract class AbstractGradleFuncTest extends Specification {
.withProjectDir(projectDir)
.withPluginClasspath()
.forwardOutput()
), configurationCacheCompatible)
), configurationCacheCompatible,
buildApiRestrictionsDisabled)
).withArguments(arguments.collect { it.toString() })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class BuildConfigurationAwareGradleRunner extends GradleRunner {
private final boolean ccCompatible;
private final boolean buildApiRestrictionsDisabled;

public BuildConfigurationAwareGradleRunner(GradleRunner delegate, boolean ccCompatible) {
public BuildConfigurationAwareGradleRunner(GradleRunner delegate, boolean ccCompatible, boolean buildApiRestrictionsDisabled) {
this.delegate = delegate;
this.ccCompatible = ccCompatible;
this.buildApiRestrictionsDisabled = true;
this.buildApiRestrictionsDisabled = buildApiRestrictionsDisabled;
}

@Override
Expand Down

0 comments on commit 40ec48b

Please sign in to comment.