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

Ability to test precompiled Kotlin script plugins #112

Open
Vampire opened this issue May 15, 2019 · 2 comments
Open

Ability to test precompiled Kotlin script plugins #112

Vampire opened this issue May 15, 2019 · 2 comments

Comments

@Vampire
Copy link
Contributor

Vampire commented May 15, 2019

I wanted to contribute a fix for an issue in a plugin I'm using that uses nebula-test.
Unfortunately it seems this is not possible right now.
The issue I want to fix is only happening when applying the plugin in a precompiled Kotlin script plugin.

The problem is, that you use a command-line init script to inject the project classes to the test build.
Those init scripts are only applied to the main build, not to the buildSrc build. (gradle/gradle#1055)

To also inject into the buildSrc build, you would need to use a custom Gradle distribution (e. g. let the wrapper / tooling api download the version to test against into a custom folder, then manipulate it before executing the actual test) in which the init script is present in init.d, then it would also be effective on the buildSrc build.

But even then I'm not sure whether it would work, as for the issue to test I need to apply the plugin via plugins-DSL block so that static accessors are generated for it and I think this would not work with just having the plugin in the classpath.
Instead you would probably need to actually build the artifacts, make a maven or ivy repository out of it and configure it as plugin repository using the init script in the custom gradle distribution.

@szpak
Copy link
Contributor

szpak commented May 15, 2019

@Vampire two questions.

  1. I completely don't know that mechanism, but have you checked it with copyResources("sampleProjects//nexus-at-minimal", "") approach instead of just provide buildFile <<? It should simulate getting the project "from the Internet" and execute the build.
  2. It is supported by Gradle TestKit at all?

@Vampire
Copy link
Contributor Author

Vampire commented May 17, 2019

  1. Yes, that's exactly what I'm doing
  2. I don't know

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

No branches or pull requests

2 participants