Slackbot
05/02/2022, 10:04 PMephemient
05/02/2022, 10:18 PMgradleApi() is treated specially, I believe (ditto other internal dependencies like gradleTestKit() and localGroovy())ephemient
05/02/2022, 10:20 PMMartin
05/02/2022, 10:21 PMMartin
05/02/2022, 10:21 PMMartin
05/02/2022, 10:23 PMephemient
05/02/2022, 10:27 PMapi() is the right thing if you're publicly exposing anything based on that dependency's types, which I think a plugin is expected to do?Martin
05/02/2022, 10:39 PMephemient
05/02/2022, 10:40 PMgrossws
05/02/2022, 10:42 PMgrossws
05/02/2022, 10:44 PMdev.gradleplugins:gradle-api artifacts) you still have to add them to `compileOnly`/`compileOnlyApi`ephemient
05/02/2022, 10:44 PMgrossws
05/02/2022, 10:49 PMgradleApi() in both (implicitly via `kotlin-dsl`/`java-gradle-plugin` usually), so for more or less standard workflow you wouldn't see a differenceephemient
05/02/2022, 10:51 PMgradleApi()) versus depending on a binary artifact (where the GMM doesn't have any remnant of gradleApi())ephemient
05/02/2022, 10:52 PMgradleApi() so it doesn't make a difference, but that still seems inconsistentMartin
05/02/2022, 10:56 PM:module1
plugins {
id("java-gradle-plugin")
}
:module2
val testConfig = configurations.create("testConfig")
dependencies {
add("testConfig", project(":module1"))
}
testConfig.files.forEach { println(it.name) }
And I'm getting this in the output:
/Users/mbonnin/.gradle/caches/7.3.1/generated-gradle-jars/gradle-api-7.3.1.jarMartin
05/02/2022, 10:57 PMgradleApi() made it to my module2. It's annoying in my case because I want to shadow these dependencies so I end up shadowing gradleApi() , which I don't wantMartin
05/02/2022, 10:58 PMMartin
05/02/2022, 10:59 PMgradleApi() is not injected in the classpath by Gradle itself?grossws
05/02/2022, 11:10 PMClassPathNotation). gradleApi is added to api configuration by java-gradle-plugin unconditionally and should be visible to the projects in the same build.
I don't see where is it excluded from gmm/pom though, pluginMaven publication just use publication.from(components["java"]) internally.grossws
05/02/2022, 11:13 PMjava-library and explicit compileOnly(gradleApi()) to avoid polluting dependent project and/or source configuration for shadow plugin with gradleApi artifactMartin
05/02/2022, 11:17 PMI don't see where is it excluded from gmm/pom thoughJust made a test and it's not in the
"dependencies" section of the module file🤷grossws
05/02/2022, 11:17 PMgrossws
05/02/2022, 11:18 PMTapchicoma
05/03/2022, 7:21 AMJendrik Johannes
05/06/2022, 10:13 AMJendrik Johannes
05/06/2022, 10:14 AMMartin
05/06/2022, 12:21 PM