Stylianos Gakis
10/31/2024, 2:45 PMbod
10/31/2024, 2:47 PMapollo-runtime
?Stylianos Gakis
10/31/2024, 2:54 PMmbonnin
10/31/2024, 3:43 PMThese transitive dependencies should be declared directly:
androidTestImplementation("androidx.test:monitor:1.6.1")
androidTestImplementation("junit:junit:4.13.2")
debugImplementation("com.apollographql.apollo:apollo-runtime-android-debug:4.0.1")
I'd say it's an issue of DAGP not being too aware about KMPmbonnin
10/31/2024, 3:44 PMapollo-runtime-android-debug
should be the same as android-runtime
in terms of visibilityStylianos Gakis
10/31/2024, 3:47 PMandroid-runtime
and see if it's happy.mbonnin
10/31/2024, 3:57 PMThese transitive dependencies should be declared directly:
[...]
implementation("com.apollographql.apollo:apollo-api:4.0.1")
which is a bit surprising too.mbonnin
10/31/2024, 3:58 PMapollo-api
is an api
dependency of apollo-runtime
Stylianos Gakis
10/31/2024, 4:19 PMapi
.
I am sure they got reasoning behind this. Reasoning that I am definitely not qualified to judge right now 😄mbonnin
10/31/2024, 4:21 PMApolloCall.execute(): ApolloResponse
in apollo-runtime
and ApolloResponse
is in apollo-api
, surely you're going to use it anywaysmbonnin
10/31/2024, 4:21 PMapollo-runtime
adding apollo-api
as api
dependency should be enough IMOmbonnin
10/31/2024, 4:22 PMStylianos Gakis
10/31/2024, 4:24 PMapi
to implementation
without changing the actual ABI (and therefore “safely”), but nevertheless break downstream builds who required those dependencies for compilation (in many cases without even realizing it). So we find that a simple upstream dependency change (supposedly transparent!) has broken the build.
Must be due to this ^^
If there aren't even more reasons besides thismbonnin
10/31/2024, 4:26 PM> library author could change a dependency fromIn the specific case I mentioned, changingtoapi
without changing the actual ABI (and therefore “safely”)implementation
apollo-api
to an implementation
is pretty much not an option because ApolloResponse
is part of the ABImbonnin
10/31/2024, 4:27 PMmbonnin
10/31/2024, 4:27 PMapi
dependencies that are not part of the ABI?Stylianos Gakis
10/31/2024, 4:29 PMapi
. Then notices the mitsake, fixes it.
But the client was relying on that dependency, and then bumping a library results in red code and a lot of question marks are raised 😄
I can't say I've experienced this myself, but I can see how it's possible.mbonnin
10/31/2024, 4:31 PMmbonnin
10/31/2024, 4:36 PMThat said, I must admit that this feature has always been the most controversial. If you fall into the camp of not caring, be of glad heart, for the plugin is highly configurable.
mbonnin
10/31/2024, 4:37 PMdependencyAnalysis {
issues {
all {
onUsedTransitiveDependencies {
severity("ignore")
}
}
}
}
That settles it I guessmbonnin
10/31/2024, 4:37 PMStylianos Gakis
10/31/2024, 4:37 PMStylianos Gakis
11/01/2024, 3:22 PMonUsedTransitiveDependencies { severity("ignore") }
trick
• Now my build was failing since I was relying on those otherwise unused dependencies to bring in some transitive dependencies which I was really using
One common case was that I was relying on some androidx...-ktx
but I wasn't using it, so it removed it, but I was using the non -ktx
version of it 😄
So that was fun, and I got my answer why by default it does not ignore such transitive dependencies 😄mbonnin
11/01/2024, 6:30 PMmbonnin
11/01/2024, 6:31 PMonUsedTransitiveDependencies { severity("ignore") }
is a good default because it did find the unused androidx...-ktx
dependency, right?Stylianos Gakis
11/01/2024, 7:54 PMonUsedTransitiveDependencies
, run it again, to see what it is that it would be bringing in, and then add it back and put it manually.
In this case I knew I needed the one without the -ktx
suffix just because it was a bit obvious. But it won't be like that every time.
Overall I am a bit torn on this tool. I ran it and it detected quite a lot of unused dependencies, and more importantly it removed dependencies between my own modules which did not need to be there anymore, which means improved potential for parallelization.
However it then removed some dependencies and when I let it pick itself it tried to bring in some deps which I am not sure are the right ones. For a jvm only module I have with compose (for molecule) it tried to bring in some ...compose-runtime-jvm-stubs
dependency or something like that for example, and I really don't think that's the right one. I suppose here I would have to explicitly bring in the Jetbrains compose dependency or something like that.
It also turned a bunch of dependencies into debugImplementation
or runtimeImplementation
and at that point I don't even know if that would break anything, especially runtimeImplementation is not something I am truly familiar with.
I feel like I might need to just run it manually once every few months, get the easy wins and ignore the rest or I need to go all-in and let it do everything and just trust it if all tests pass 😄mbonnin
11/01/2024, 11:06 PMyou do end up in a scenario where if you don’t know what it is that you were transitively depending on, then you are a bit lost.Look at missing symbols in the compilation errors and google them? (we’re still missing a tool that gives you the maven coordinates from a class name, that’d be a cool hobby project)
mbonnin
11/01/2024, 11:07 PMmbonnin
11/01/2024, 11:08 PMI feel like I might need to just run it manually once every few months, get the easy wins and ignore the rest or I need to go all-in and let it do everything and just trust it if all tests passSounds like a very sensible approach 👍
mbonnin
11/01/2024, 11:09 PMStylianos Gakis
11/01/2024, 11:15 PMLook at missing symbols in the compilation errors and google them?
it should be relatively doable to find which ones you were using?Yes, you are right of course, you're not going to hit a complete roadblock. But at the same time, it's far from a "run this tool and get your fixes" 😄 Which of course I wish it was, but things are never that simple 😄
mbonnin
11/01/2024, 11:18 PMmbonnin
11/01/2024, 11:19 PMmbonnin
11/01/2024, 11:19 PM