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

Gradle tasks order is not deterministic #1153

Open
snicoll opened this issue Nov 27, 2020 · 2 comments
Open

Gradle tasks order is not deterministic #1153

snicoll opened this issue Nov 27, 2020 · 2 comments

Comments

@snicoll
Copy link
Contributor

snicoll commented Nov 27, 2020

While working on code and build convention integration tests, I've noticed that the outcome of the test is not deterministic as the following two snippets are generated in reverse order depending of the bean processing order:

tasks.withType(KotlinCompile) {
	kotlinOptions {
		freeCompilerArgs = ['-Xjsr305=strict']
		jvmTarget = '1.8'
	}
}

and

test {
	useJUnitPlatform()
}

There's no obvious way to order those tasks but we could order the customizers that mutate the build.

@snicoll snicoll added this to the 0.10.0 milestone Nov 27, 2020
@snicoll snicoll self-assigned this Nov 27, 2020
@snicoll snicoll changed the title Spring conventions processing order is not deterministic Gradle tasks order is not deterministic Nov 27, 2020
@snicoll
Copy link
Contributor Author

snicoll commented Nov 27, 2020

This seems to be limited to GradleBuid where we provide a name with a task (and several contributors can add attribue or customise it) but the writer has no way to order them. A naive approach could be that tasks are written according to their alphabetic order. Another would be that whoever calls the task first wins but I suspect neither are ideal.

snicoll added a commit that referenced this issue Nov 27, 2020
@snicoll snicoll modified the milestones: 0.10.0, 0.11.0, 0.10.1 Feb 18, 2021
@snicoll snicoll modified the milestones: 0.10.1, 0.11.0 Mar 23, 2021
@snicoll snicoll modified the milestones: 0.11.0, 0.11.1 Sep 9, 2021
@snicoll snicoll modified the milestones: 0.11.1, 0.12.0 Oct 28, 2021
@snicoll snicoll removed this from the 0.12.0 milestone Jan 21, 2022
@snicoll snicoll removed their assignment Jan 29, 2024
@mhalbritter
Copy link
Contributor

One idea would be to see if we can order the customizers (or their output) somehow so that more general configurations are on top of the more specific ones. In our example, the test configuration would always be below the tasks.withType(KotlinCompile) one, because it configures the test task, while the withType one configures all tasks with this type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants