Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for lifecycle callbacks access to surrounding methods #29164

Merged
merged 2 commits into from
May 20, 2024

Conversation

alllex
Copy link
Member

@alllex alllex commented May 15, 2024

Test-only PR that capture the current behavior of the gradle.lifecycle callbacks with respect to access of functions outside of the callback lambdas.

@alllex alllex self-assigned this May 15, 2024
@alllex alllex added this to the 8.9 RC1 milestone May 15, 2024
@alllex alllex marked this pull request as ready for review May 15, 2024 18:30
@alllex alllex requested review from a team as code owners May 15, 2024 18:30
@alllex alllex requested review from bamboo, abstratt and 6hundreds and removed request for a team May 15, 2024 18:30
println("project name = " + p.name)
}

allprojects {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ What value are we getting from this test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed, this test mirrors the similar one for Groovy DSL and locks in the behavior that, in Kotlin DSL, there is no violation.

def "build script can query basic details of projects in a #description called from allprojects block"() {

Perhaps the test needs a better name. Do you have ideas?

Copy link
Member

@bamboo bamboo May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still feels a bit wasteful in compute time. I mean, this would/should be covered elsewhere by tests that use allprojects when running with isolatedProjectsIntegTest...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have thought the same about the Groovy member resolution that was not caught by tests before 🙃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, we're just now adding Isolated Projects test coverage to :core (#29202) and we do see some Groovy related errors there. No harm in having some explicit test coverage I guess.

}

gradle.lifecycle.beforeProject {
Helper.printInfo(project)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

gradle.lifecycle.beforeProject {
${owner}.printInfo(project)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"static" | "static " | "Helper"
}

@ToBeImplemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// outputContains("project name = b")
}

@ToBeImplemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alllex alllex requested a review from bamboo May 20, 2024 10:02
println("project name = " + p.name)
}

allprojects {
Copy link
Member

@bamboo bamboo May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still feels a bit wasteful in compute time. I mean, this would/should be covered elsewhere by tests that use allprojects when running with isolatedProjectsIntegTest...

@alllex alllex added this pull request to the merge queue May 20, 2024
Merged via the queue into master with commit a955e2d May 20, 2024
24 of 26 checks passed
@alllex alllex deleted the alllex/ip/tests-using-functions-from-context branch May 20, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants