Slackbot
04/06/2022, 5:37 PMEmil Kantis
04/06/2022, 5:46 PMVampire
04/06/2022, 5:59 PMVampire
04/06/2022, 6:01 PMmelix
04/06/2022, 6:29 PMmelix
04/06/2022, 6:29 PMJendrik Johannes
04/06/2022, 7:21 PMJendrik Johannes
04/06/2022, 7:21 PMJendrik Johannes
04/06/2022, 7:24 PMTom Gregory
04/06/2022, 8:19 PMGradle itselfNice!
Vampire
04/07/2022, 1:52 AMmelix
04/07/2022, 6:40 AMmelix
04/07/2022, 6:40 AMbuildSrc
though.melix
04/07/2022, 6:41 AMTom Gregory
04/07/2022, 7:25 AMBecause an included build is better in most regardsSo
includeBuild
is the unofficial replacement for buildSrc if performance is important? Are there any plans to fix the cache invalidation problem in buildSrc?Vampire
04/07/2022, 7:46 AMbuildSrc
should become a normal included build. But I don't know whether that's still the plan or when that would finally happen. But I actually anyway prefer to have the build logic more separated and have it for example in gradle/build-logic
.Maxim Alov
04/09/2022, 10:39 AMJendrik Johannes
04/11/2022, 5:57 AMmelix
04/12/2022, 8:59 PMEsa Firman
08/16/2022, 3:59 AMVampire
08/16/2022, 8:02 AMbuildSrc
is always run before the main build and added to the class path of each and every build script of the main build. So if anything in buildSrc
changes, the class path of all build scripts changes.
With an included build this is different. Only what is used built and added to the class path of the build script where it is used.Esa Firman
08/16/2022, 8:16 AMThe task was not up-to-date because of the following reasons:
Class path of task ':utils:compileDebugKotlin' has changed from dd4a749a8903049c26808dde8113cf04 to 078f07687a37110a2757655aa16bc6df.
Vampire
08/16/2022, 9:57 AMMy understanding is the build will always be invalidated if build dependencies are changed."the build" is too general spoken. If you have a main build with project
root
and subprojects A
and B
.
If you have buildSrc
it is prefixed to the classpath of all those projects build scripts and thus any change changes all their classpaths.
If you have a plugin in a project in an included build that is used only in A
, then it will only change the classpath of A
.Esa Firman
08/16/2022, 10:12 AMroot
Do I need to have a multiple included builds to avoid above case?
it is prefixed to the classpath of all thoseHow can I check this?
Vampire
08/16/2022, 11:24 AMAhh now I got your point. In my case though, I have one included build that contains multiple plugins that used in various projects includingAs the root projects class loader is parent of the subproject class loaders, I guess it is the same for the class path. So anyhting you use in the root project probably has the same effect of changing all class paths, but I'm not 100 % sure about that.root
Do I need to have a multiple included builds to avoid above case?Also not 100 % sure, but I think different projects in the included build should already be sufficient.
> it is prefixed to the classpath of all those
How can I check this?Check what?
Esa Firman
08/16/2022, 11:40 AMCheck what?
The classpath for each project Anyway, thanks for all the answers, it's really helpful. I will try to verify all the points above 👌 Also It seems I need to revisit all about classpath and classloader 😆
Vampire
08/16/2022, 11:41 AMVampire
08/16/2022, 11:49 AMThe classpath for each projectWhen it is about things coming from a repository or included build, the
buildEnvironment
task should give you information. A build scan probably too.
Things that are coming in through buildSrc
are not included as far as I remember as buildSrc
is special as always.
And as a last resort, set a breakpoint and inspect the class loading hierarchy.Vampire
08/16/2022, 11:56 AMA
and script plugin X
and Y
(not precompiled script plugins, legacy ones).
In both, X
and Y
, you add plugin Z
to the class path using the buildscript
block.
In X
you apply the plugin Z
which adds a task of type ZTask
.
In Y
you do tasks.withType(ZTask).configureEach { ... }
.
In A
you apply both script plugins.
But the effect of Y
will not be there.
Because Z
is in different class loaders in X
and Y
, the class ZTask
in Y
is a different class than the class ZTask
in X
, so the withType
will not found any match.Esa Firman
10/21/2022, 12:37 PMAnd as a last resort, set a breakpoint and inspect the class loading hierarchy.
Hi @Vampire, can you give me some pointer on the point above?
Vampire
10/21/2022, 1:00 PMEsa Firman
10/21/2022, 1:30 PMClass.forName("com.org.myplugin").getClassLoader();
And then get the parent of that class loader and so on?Vampire
10/21/2022, 1:31 PMcom.org.myplugin
is not a class, so you will get a CNFE.
And you don't actually need Class.forName
, you can directly use MyPlugin.class.getClassLoader()
.
But basically, yesEsa Firman
10/21/2022, 2:25 PM