Slackbot
05/16/2023, 8:06 PMChris Lee
05/16/2023, 8:23 PMLaurence Gonsalves
05/16/2023, 8:39 PMClass bootstrap() {
def classpaths = [
file('src/main/groovy').absolutePath,
file('src/main/resources').absolutePath
]
String[] classpathArray = classpaths.toArray(new String[classpaths.size()])
def engine = new GroovyScriptEngine(classpathArray, this.getClass().getClassLoader())
return engine.loadScriptByName('com/example/plugin/Plugin.groovy')
}
apply plugin: bootstrap()
I think that's probably the cause of this. The jacocoTestReport task is from an external plugin that's pulled in by our plugin.
Is there a better way for us to share code between our plugin and our plugin's build, so we don't have to duplicate that logic?Vampire
05/16/2023, 8:44 PMAdam
05/16/2023, 9:41 PMincludeBuild(".") and dependency substitutions https://docs.gradle.org/8.1.1/userguide/composite_builds.html#included_build_declaring_substitutions. On paper I think it does what you needVampire
05/16/2023, 10:36 PMLaurence Gonsalves
05/16/2023, 10:52 PMLaurence Gonsalves
05/16/2023, 11:01 PMVampire
05/16/2023, 11:10 PMLaurence Gonsalves
05/17/2023, 12:32 AMVampire
05/17/2023, 6:47 AMLaurence Gonsalves
05/17/2023, 9:42 PMYou have the main build and you have the plugin build. You would add another build that builds the logic used by both builds.Ah, ok, I think I understand what you mean. Our "main build" is really multiple projects, each with its own git repo, each with its own
build.gradle.
The plugin also has its own git repo and its own build.gradle. The plugin publishes to our private maven repo, which is how the other projects consume (apply) it.
If we split the plugin into two parts, let's call them "plugin-core" and "plugin-complete", both in the same git repo, but two separate builds (ie: two subdirectories each with their own build.gradle) is there a way we could have other projects be able to consume "plugin-complete", yet still have access to the "plugin-core" functionality? We don't want to have to publish a separate "plugin-core" artifact — we essentially want "plugin-core" inlined into "plugin-complete".
The reason I ask is that one of the bigger things that would go into "plugin-core" is the publishing logic itself, so if we have to publish "plugin-core", we're back to the same chicken and egg problem.Vampire
05/18/2023, 10:12 AMplugin-complete can apply plugin-core, so that the consumer gets it applied transitively. Just like java-library applies java which applies java-base and so on. But yeah, the publishing setup you probably need to duplicate.Vampire
05/18/2023, 10:14 AM