varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.51k stars 68 forks source link

The Gradle library plugin should generate a top-level metadata file #344

Closed bitspittle closed 10 months ago

bitspittle commented 11 months ago

Currently, the only way we know if a library was built using the Kobweb library plugin is to check for the existence of a META-INF/kobweb/frontend.json file. This technically works but feels like we're taking advantage of a side effect. It might also not be future proof -- will we support libraries in the future that are backend support only? Will we support artifacts which are just bundled resources and no code, meant to be shared and consumed by upstream Kobweb applications?

Our proposal is to add a top level file, say META-INF/kobweb/manifest.json, to serve as a consistent indicator file.

In addition to creating this file, there are two important related feature requests:

Version

We should also add a version value in the manifest file, the version of Kobweb the library was built with. This could give us a chance to make major changes in the future and still recover if a newer version of Kobweb tries to load an older library (since we can check the version of the library first and then branch logic based on that).

It could also help us debug some weird user reports. If if a lot of people say a library is busted, we can check its Kobweb version first to see if that's potentially the issue.

KobwebCopySupplementalResourcesTask

Currently, the Kobweb application copies all resources under all dependency artifacts if they are found under their public/ folder. However, random libraries may have a jsMain/resources/public folder by chance, and we don't want to suddenly be copying all of that stuff into the user's site.

Instead, we should only copy these files IF that's true and the META-INF/kobweb/manifest.json exists.


TL;DR:


Side note: #260 could possibly be implemented by adding data to this manifest.json file also.

bitspittle commented 10 months ago

Released in 0.15.1