Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Code generation for layer styling #1

Open
dellisd opened this issue May 23, 2021 · 0 comments
Open

Code generation for layer styling #1

dellisd opened this issue May 23, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@dellisd
Copy link
Member

dellisd commented May 23, 2021

Currently we have a DSL for building layers and defining their styles. This is fine, but requires defining a multiplatform-compatible implementation of style expressions which all need to be mapped to the platform-specific implementations at run time.

Alternatively, we could look at making use of code generation to avoid most of this work needing to be done at runtime. Layers could be defined in .json files which would be converted by the gradle plugin into the respective platform implementations directly. Those implementations could be imported immediately and used like normal, while still keeping the style definitions consistent between platforms.

Another nice advantage of using JSON to define the layers like this is that it becomes much easier to look up documentation for applying Mapbox styles, as their docs are written with a focus primarily on the JS syntax, which would be emulated directly in the JSON.

Runtime parameterization could also be accomplished by defining some kind of syntax (maybe prefixing variables with a $ character) to allow the plugin to generate a function with the specified parameters that would return an instance of the layer that has those parameters filled in.

@dellisd dellisd added the enhancement New feature or request label May 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant