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

Avoid eager resolving artifact in CreateDmg#jdkDependency #69

Open
vlsi opened this issue Jul 14, 2020 · 2 comments · May be fixed by #70
Open

Avoid eager resolving artifact in CreateDmg#jdkDependency #69

vlsi opened this issue Jul 14, 2020 · 2 comments · May be fixed by #70

Comments

@vlsi
Copy link

vlsi commented Jul 14, 2020

Dependency dep = project.dependencies.create(jdkDependency)
def files = project.configurations.detachedConfiguration(dep).resolve()
if (files.size() != 1) {
throw new GradleException(
"Expected a single file for jdkDependency '$jdkDependency', got ${files.size()} files")
}

Gradle tasks should not perform artifact resolution at the configuration time as the task might even be non-required at all.

@vlsi
Copy link
Author

vlsi commented Jul 15, 2020

Oh, it looks like the eager resolution is caused by the fact that the task wants to store File jdk property:

I guess it would make sense to use Property<File> (or RegularFile) API.

@vlsi
Copy link
Author

vlsi commented Jul 15, 2020

What do you think if CreateDmg task (and the relevant others) were updated to use Property<...> APIs?

What do you think if the task was converted to Kotlin?

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

Successfully merging a pull request may close this issue.

1 participant