https://kotlinlang.org logo
#kotlin-inject
Title
# kotlin-inject
e

evant

08/03/2022, 4:49 AM
p

Paul Woitaschek

08/03/2022, 9:46 AM
Nice 🎉 The native publication seems broken: https://github.com/evant/kotlin-inject/issues/222
d

dave08

08/03/2022, 1:37 PM
Tried upgrading, and encountered those new errors with parent/child components, even though it was working well with 0.4.0... is it for sure a mistake in all cases to ignore those errors?
p

Paul Woitaschek

08/03/2022, 1:38 PM
Yeah probably they shouldn’t be ignored. Or the warnings are wrong, in that case a reproducer would be top 👍
e

eygraber

08/03/2022, 2:48 PM
Gonna have to make some big changes due to parents not being able to use child injections, but I'd much rather have the safety of not leaking so 😁
p

Paul Woitaschek

08/03/2022, 2:50 PM
Gonna have to make some big changes due to parents not being able to use child injections
Can you give an example? That should still work
e

eygraber

08/03/2022, 2:53 PM
From the release notes
In other words a parent component can no longer depend on a dependency provided by a child component. Not only does this lead to confusing graphs, but it can lead to memory leaks if the parent component lives longer than the child and ends holding on to that child dependency.
p

Paul Woitaschek

08/03/2022, 2:53 PM
But why would you do that in the first place?
e

eygraber

08/03/2022, 2:54 PM
I was porting concepts from runtime frameworks for Kodein, and it was the only way to get it to work.
It was much easier than restructuring everything in my app/head
p

Paul Woitaschek

08/03/2022, 2:56 PM
Still can’t think of a practical example ^^
e

eygraber

08/03/2022, 3:01 PM
When I update my code I'll try to remember to post the scenario here
e

evant

08/03/2022, 3:54 PM
Oof sorry about that native publication getting messed up. I fixed one issue with it before release but missed that.
p

Paul Woitaschek

08/03/2022, 6:56 PM
@evant Are you already onto this?
I couldn’t reproduce it locally so it might be related to that nexus stuff? Is that nexus plugin even necessary?
e

evant

08/03/2022, 7:35 PM
Yeah will take a look either today or tomorrow. I think it's only the mac build? Which is weird.
p

Paul Woitaschek

08/03/2022, 7:36 PM
On my mac, publishToMavenLocal creates correct publications
e

evant

08/03/2022, 7:37 PM
And yeah with kotlin multiplatform the nexus plugin is basically required cause otherwise I've run into issues where it will randomly split artifacts across publications
Sqldelight seems to do it without the nexus one
e

evant

08/05/2022, 5:53 AM
@Paul Woitaschek I think I have a fix but don't have a kmm project handy at the moment, mind verifying that 0.5.1-SNAPSHOT works now when you get a chance?
p

Paul Woitaschek

08/05/2022, 7:07 AM
Yep, building!
Copy code
public override val welcomeScreenViewModelFactory: WelcomeScreenViewModel.Factory
    get() = WelcomeScreenViewModel.Factory(
      creator = { arg0_________________________________ ->
        WelcomeScreenViewModel(
          dispatcherProvider = dispatcherProvider,
          localizer = localizer,
          remoteConfig = remoteConfig,
          tracker = WelcomeTracker(
            tracker = _tracker,
            screenTracker = _screenTracker
          ),
          navigator = arg0_________________________________
        )
      }
    )
😄
e

evant

08/05/2022, 8:00 AM
_______ Oh is it making the names unique across the whole component?
p

Paul Woitaschek

08/05/2022, 8:02 AM
Yes. Is that a problem?
e

evant

08/05/2022, 8:03 AM
I mean it'll work but it probably could be improved to take scope into account to make them shorter
p

Paul Woitaschek

08/05/2022, 8:04 AM
I’d prefer to leave it like this because it doesn’t cause issues and is simple to read and test. Else we’d need a way more complex test setup and it would make the processor way more complex as well
e

evant

08/05/2022, 8:10 AM
Long identifiers lead to code bloat in the executable, I mean you could use proguard to fix but not everyone is. I really don't think it would be that complicated but yeah not the highest priority
p

Paul Woitaschek

08/06/2022, 6:44 AM
Thanks 🎉 Im on vacation now but the renovate PR is all green
8 Views