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

MBS-12266 Support using testFixtures inside TestKit project #1284

Merged
merged 3 commits into from
Nov 19, 2021

Conversation

eugene-krivobokov
Copy link
Contributor

@eugene-krivobokov eugene-krivobokov commented Nov 18, 2021

The problem

I need to test a case when a user extends classes from a plugin inside a precompiled script plugin.
These custom classes are used in build scripts in modules with the plugin.

Constraints

I can't declare these classes in build scripts directly because they won't be accessible to all modules.

I couldn't simulate this case directly with a precompiled script plugin in generated project.
The plugin classpath (GradleRunner.withPluginClasspath) is not accessible inside included builds (where precompiled script plugins live).
My question in Gradle slack: link

Changes

I've supported a workaround:

  • Declare classes inside testFixtures
  • Add them to plugin classpath

Screenshot from 2021-11-18 21-29-30

This is a preliminary PR, usages will be in the next PR.

UPD: Example - #1286

withPluginClasspath(
pluginClasspath + testFixturesClasspath()
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We add testFixtures here

@@ -6,9 +6,13 @@ import com.avito.test.gradle.plugin.PluginsSpec

public interface Module : Generator {
public val name: String
public val imports: List<String>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imports are valid in any Gradle project even without plugins

@eugene-krivobokov eugene-krivobokov marked this pull request as ready for review November 18, 2021 18:32
@eugene-krivobokov eugene-krivobokov enabled auto-merge (squash) November 19, 2021 09:41
@eugene-krivobokov eugene-krivobokov merged commit 59b18ea into develop Nov 19, 2021
@eugene-krivobokov eugene-krivobokov deleted the MBS-12266-testFixtures branch November 19, 2021 11:42
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 this pull request may close these issues.

None yet

3 participants