Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a3443e5
Update doc as deprecation of Task.getProject` is now unconditional
abstratt Oct 11, 2024
9fc0089
Make deprecation of Task.getProject` no longer conditional on STABLE_…
abstratt Oct 11, 2024
808e23e
Expect deprecations in testing/integ-test
abstratt Oct 11, 2024
9c1eaf4
Add expected deprecations in dependency-management
abstratt Oct 15, 2024
0bb5f0b
Expect deprecation for Task.project in `language-java`tests
abstratt Oct 16, 2024
4413f13
Expect deprecation for Task.project
abstratt Oct 16, 2024
924635f
Avoid or expect deprecation for Task.project in `core` tests
abstratt Oct 16, 2024
75457b8
Avoid or expect deprecation for Task.project in `plugins-groovy`
abstratt Oct 16, 2024
da31467
Avoid or expect deprecation for Task.project in `platform-native` tests
abstratt Oct 16, 2024
a3a1cd2
Avoid deprecation warning for `Task.project` in `version-control` tests
abstratt Oct 16, 2024
2c3690c
Expect deprecation for `Task.project` in `plugin-application` tests
abstratt Oct 16, 2024
9859faf
Avoid deprecation for `Task.project` in `language-native`
abstratt Oct 16, 2024
2611ff9
Expect Task.project deprecation for smoke tests
abstratt Oct 16, 2024
87ab0b5
Expect deprecation warning for using a ToolingModelBuilder from a tas…
abstratt Oct 16, 2024
c0f40da
Add trait for popular deprecations
abstratt Oct 28, 2024
050ff6d
Expect `Task.project` deprecation in `diagnostics` tests
abstratt Oct 28, 2024
460eddb
Allow configuring executer before every run
abstratt Oct 28, 2024
37ed061
Avoid `Task.project` deprecation in `tooling-api` cross-version tests
abstratt Oct 28, 2024
c8a8c12
Expect `Task.project` deprecation for software model tests
abstratt Oct 29, 2024
be3cf87
Expect `Task.project` deprecation in components and model tasks in `t…
abstratt Oct 29, 2024
c4aa9d6
Expect `Task.project` deprecation for model and components tasks in `…
abstratt Oct 29, 2024
844008a
Expect `Task.project` deprecation in `model-groovy` tests
abstratt Oct 29, 2024
242d15e
Make common deprecations available to JUnit tests
abstratt Oct 30, 2024
da3a749
Expect deprecation for `Task.project` in `cleanIdea`
abstratt Oct 30, 2024
0593493
Revert misc.xml
abstratt Oct 31, 2024
9c1beb0
Revert unnecessary change
abstratt Oct 31, 2024
7bfca41
Ignore deprecations in deprecated tasks
abstratt Nov 1, 2024
6eed67f
Revert "Revert misc.xml"
abstratt Nov 11, 2024
0e353d7
Rename `Deprecations` to `StableConfigurationCacheDeprecations`
abstratt Nov 13, 2024
3cbdf63
Move nebula deprecations into Nebula plugin smoke test class
abstratt Nov 13, 2024
ca2762f
Revert introduction of unnecessary `public` modifier
abstratt Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DeprecatedFeaturesListener(
}

override fun onProjectAccess(invocationDescription: String, task: TaskInternal, runningTask: TaskInternal?) {
if (shouldNagFor(task, runningTask)) {
if (shouldNagFor(task, runningTask, ignoreStable = true)) {
nagUserAbout("Invocation of $invocationDescription at execution time", 7, "task_project")
}
}
Expand Down Expand Up @@ -98,13 +98,13 @@ class DeprecatedFeaturesListener(
}

private
fun shouldNagFor(task: TaskInternal, runningTask: TaskInternal?) =
shouldNag() && shouldReportInContext(task, runningTask)
fun shouldNagFor(task: TaskInternal, runningTask: TaskInternal?, ignoreStable: Boolean = false) =
shouldNag(ignoreStable) && shouldReportInContext(task, runningTask)

private
fun shouldNag(): Boolean =
fun shouldNag(ignoreStable: Boolean = false): Boolean =
// TODO:configuration-cache - this listener shouldn't be registered when cc is enabled
!buildModelParameters.isConfigurationCache && featureFlags.isEnabled(STABLE_CONFIGURATION_CACHE)
!buildModelParameters.isConfigurationCache && (ignoreStable || featureFlags.isEnabled(STABLE_CONFIGURATION_CACHE))

private
fun shouldNagAbout(listener: Any): Boolean = shouldNag() && !isSupportedListener(listener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ package org.gradle.model

import org.gradle.api.reporting.model.ModelReportOutput
import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache
import org.gradle.language.base.FunctionalSourceSet
import org.gradle.platform.base.ComponentSpec
import spock.lang.Issue

@UnsupportedWithConfigurationCache(because = "software model")
class ModelMapIntegrationTest extends AbstractIntegrationSpec {
class ModelMapIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {
def "provides basic meta-data for map"() {
when:
buildFile '''
Expand Down Expand Up @@ -117,6 +118,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "components"
failure.assertHasCause("Cannot create an instance of type 'NonRegisteredComponent' as this type is not known. Known types: ${ComponentSpec.name}, SampleComponent.")
}
Expand All @@ -142,6 +144,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "model"
failure.assertHasCause("Cannot create an instance of type 'NonRegisteredComponent' as this type is not known. Known types: ${ComponentSpec.name}, SampleComponent.")
}
Expand Down Expand Up @@ -170,6 +173,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "model"
failure.assertHasCause("Cannot create an instance of type 'NonRegisteredComponent' as this type is not known. Known types: SampleComponent.")
}
Expand All @@ -196,6 +200,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "components"
failure.assertHasCause("Cannot create an instance of type 'NonRegisteredComponent' as this type is not known. Known types: SampleComponent.")
}
Expand All @@ -221,6 +226,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "components"
failure.assertHasCause("Cannot create 'components.other' with type 'SampleComponent' as this is not a subtype of 'Sample2Component'.")
}
Expand All @@ -247,6 +253,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
succeeds "components"
}

Expand All @@ -267,6 +274,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "model"
failureHasCause "Cannot create 'things.bad' with type '$FunctionalSourceSet.name' as this is not a subtype of 'Thing'."
}
Expand Down Expand Up @@ -322,6 +330,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
succeeds "model"
ModelReportOutput.from(output).hasNodeStructure {
things {
Expand Down Expand Up @@ -350,6 +359,7 @@ class ModelMapIntegrationTest extends AbstractIntegrationSpec {
"""

expect:
expectTaskGetProjectDeprecations()
fails "model"
failureHasCause "Exception thrown while executing model rule: things { ... } @ build.gradle line 12, column 17"
failureHasCause "Cannot create 'things.thing' with type 'UnknownThing' as this is not a subtype of 'Thing'."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
package org.gradle.model

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache
import org.gradle.language.base.LanguageSourceSet

@UnsupportedWithConfigurationCache(because = "software model")
class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSpec {
class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {
def "@Rule method can apply rules to a particular target"() {
buildFile << '''
@Managed
Expand Down Expand Up @@ -422,6 +423,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp
'''

expect:
expectTaskGetProjectDeprecations()
fails("model")
failure.assertHasCause("Exception thrown while executing model rule: MyPlugin#rules")
failure.assertHasCause("broken")
Expand Down Expand Up @@ -456,6 +458,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp
'''

expect:
expectTaskGetProjectDeprecations()
fails 'model'
failure.assertHasCause("Exception thrown while executing model rule: CalculateName#defaultName")
failure.assertHasCause("broken")
Expand Down Expand Up @@ -489,6 +492,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp
'''

expect:
expectTaskGetProjectDeprecations()
fails 'model'
failure.assertHasCause("Exception thrown while executing model rule: MyPlugin#rules")
failure.assertHasCause("broken")
Expand All @@ -511,6 +515,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp

expect:
succeeds("tasks")
expectTaskGetProjectDeprecations()
fails("model")
}

Expand Down Expand Up @@ -550,6 +555,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp
'''

expect:
expectTaskGetProjectDeprecations()
fails("model")
failure.assertHasCause("Exception thrown while executing model rule: MyPlugin#rules")
failure.assertHasCause('''Type BrokenRuleSource is not a valid rule source:
Expand Down Expand Up @@ -578,6 +584,7 @@ class RuleSourceAppliedByRuleMethodIntegrationTest extends AbstractIntegrationSp
'''

expect:
expectTaskGetProjectDeprecations()
fails "model"
failure.assertHasCause('''The following model rules could not be applied due to unbound inputs and/or subjects:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package org.gradle.model.managed

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache

@UnsupportedWithConfigurationCache(because = "software model")
class InvalidManagedModelRuleIntegrationTest extends AbstractIntegrationSpec {
class InvalidManagedModelRuleIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {

def "provides a useful error message when setting an incompatible type on a managed instance in Groovy"() {
when:
Expand Down Expand Up @@ -194,6 +195,7 @@ class InvalidManagedModelRuleIntegrationTest extends AbstractIntegrationSpec {
'''

then:
expectTaskGetProjectDeprecations()
fails "model"

and:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
package org.gradle.model.managed

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache

import static org.hamcrest.CoreMatchers.containsString

@UnsupportedWithConfigurationCache(because = "software model")
class ManagedModelGroovyScalarConfigurationIntegrationTest extends AbstractIntegrationSpec {
class ManagedModelGroovyScalarConfigurationIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {

private static final String CLASSES = '''
enum Thing {
Expand Down Expand Up @@ -495,6 +496,7 @@ The following types/formats are supported:
'''

then:
expectTaskGetProjectDeprecations(5)
succeeds 'printResolvedValues'

and:
Expand Down Expand Up @@ -531,6 +533,7 @@ The following types/formats are supported:
'''

then:
expectTaskGetProjectDeprecations()
fails 'model'

and:
Expand All @@ -546,6 +549,7 @@ The following types/formats are supported:
'''

then:
expectTaskGetProjectDeprecations()
fails 'model'

and:
Expand Down Expand Up @@ -605,6 +609,7 @@ The following types/formats are supported:
file('p2/build.gradle') << model

then:
expectTaskGetProjectDeprecations(3)
succeeds ':p1:printResolvedValues', ':p2:printResolvedValues'

and:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package org.gradle.model.managed

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache

@UnsupportedWithConfigurationCache(because = "software model")
class ManagedScalarCollectionsIntegrationTest extends AbstractIntegrationSpec {
class ManagedScalarCollectionsIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {

private final static List<String> MANAGED_SCALAR_COLLECTION_TYPES = ['List', 'Set']

Expand Down Expand Up @@ -358,6 +359,7 @@ class ManagedScalarCollectionsIntegrationTest extends AbstractIntegrationSpec {
"""

then:
expectTaskGetProjectDeprecations()
fails 'model'

and:
Expand Down Expand Up @@ -389,6 +391,7 @@ A valid scalar collection takes the form of List<T> or Set<T> where 'T' is one o
"""

then:
expectTaskGetProjectDeprecations()
fails 'model'

and:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package org.gradle.model.managed

import org.gradle.api.artifacts.Configuration
import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache

@UnsupportedWithConfigurationCache(because = "software model")
class ScalarTypesInManagedModelIntegrationTest extends AbstractIntegrationSpec {
class ScalarTypesInManagedModelIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {

def "values of primitive types and boxed primitive types are widened as usual when using groovy"() {
when:
Expand Down Expand Up @@ -390,6 +391,7 @@ class ScalarTypesInManagedModelIntegrationTest extends AbstractIntegrationSpec {
'''

then:
expectTaskGetProjectDeprecations()
succeeds "model"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package org.gradle.model.dsl

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.StableConfigurationCacheDeprecations
import org.gradle.integtests.fixtures.UnsupportedWithConfigurationCache

@UnsupportedWithConfigurationCache(because = "software model")
class ManagedTypeDslIntegrationTest extends AbstractIntegrationSpec {
class ManagedTypeDslIntegrationTest extends AbstractIntegrationSpec implements StableConfigurationCacheDeprecations {

def "can configure a child of a managed type using a nested closure syntax"() {
buildFile << '''
Expand Down Expand Up @@ -118,6 +119,7 @@ model {
'''

when:
expectTaskGetProjectDeprecations()
fails "model"

then:
Expand All @@ -144,6 +146,7 @@ model {
'''

when:
expectTaskGetProjectDeprecations()
fails "model"

then:
Expand Down Expand Up @@ -171,6 +174,7 @@ model {
'''

when:
expectTaskGetProjectDeprecations()
fails "model"

then:
Expand All @@ -197,6 +201,7 @@ model {
'''

when:
expectTaskGetProjectDeprecations()
fails "model"

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ class ModelDslIntegrationTest extends AbstractIntegrationSpec {
model {
tasks {
create("printStrings") {
def projectName = it.project.name
doLast {
println it.project.name + ": " + $.strings
println projectName + ": " + $.strings
}
}
}
Expand Down
Loading