-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change project build structure and use version catalog for storing dependencies #50
base: main
Are you sure you want to change the base?
Conversation
I also had problems with compilation after removing casts to KProperty1 in ValidatableTest despite my IDE compiler was pretty sure those casts were unnecessary (and project was alredy using kotlin version 2.0.20). I was able to fix this in c8ad3f4, what do you think? Looks like method api should stay the same |
Reverted my changes regarding definitely non-nullable types. @nesk Is there any chance you'll be able to look at this PR anytime soon and provide some feedback? |
- build-conventions module moved to akkurate-build-conventions for consistency - lib version updated to 0.11.0 (forgot about this during merge) - extension for kmp library component plugin renamed from "kmpLibrary" to "component" - "ignoreTargets" renamed to "ignoredTargets" for better consistency with similar gradle kotlin dsl - simplify ignoredTargets method realization. KmpTarget enum is no longer needed
Fixes #46. Sorry I did not discussed these changes with you ahead of time. I'm completely ok with you discarding this PR because I did this mostly as an exercise in gradle configuration. So mostly what I've done is:
Ok, now for some implementation details.
Convention plugins now organized into 3 different categories: base, component and feature. Base plugins just contains some reusable build logic for component plugins. Component plugins configure project modules. Feature plugins configure separate build features. I'm also rearrange plugin hierarchy a bit. Namely kmp-library (successor of kmp-library-conventions) plugin now not applying publishing-conventions. Did this because publishing seams to me like a feature which component could have or not.
Pretty much all versions are now listed inside version catalog with few small exception due to the fact that it's impossible to use generated catalog accessors in convention plugins. Plugin versions are declared by including concrete plugin dependencies inside root build.gradle.kts in included build. I don't use plugin aliases because in my experience their usage is problematic, especially with kotlin plugin (see gradle/gradle#17968 for example).
I switched from extension method to convention plugin for target configuration inside kmp library modules. Firstly, I made attempt to make target ignoring syntax similar to how we adding new targets in kotlin multiplatform plugin. Secondly, for configuring actual ignored targets I have to add plugin extension and it was quite tricky to figure out how to configure targets from convention plugin and, at the same time, get fully configured extension from the build script apllying this plugin. It seems gradle have no way to await specific extension configuration, my first solution was to configure targets in
afterEvaluate {}
block but later I tried another approach - to initially add all targets and remove them by name while subscribing to property changes in plugin extension and to my surprice this seem to work. I don't really like this solution but after reading a TON of forums, github issues and slack conversations it seems there is no idiomatic way to sync configuration phases between convention plugin and extensions in consumer plugin. Either this orafterEvaluate {}
and everybody sayingafterEvaluate
is bad (duh).I had to update some deps in the process, most notably:
I ran all unit tests locally, all seems green. My main concern is I don't know how to check if publication stuff still working as intended. Can I somehow test this on my side or will you help me to check?