reflex-frp / reflex-platform

A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
719 stars 164 forks source link

The .cabal file mangling in android/impl.nix is fragile #494

Open nomeata opened 5 years ago

nomeata commented 5 years ago

I was just staring at an odd error

Setup: No 'main-is' field found for executable libkaleidogen.so

No 'main-is' field found for executable libkaleidogen-sdl.so

No 'main-is' field found for executable libkaleidogen-android.so

and it took me some sleuthing to find out that there is a sed script in https://github.com/reflex-frp/reflex-platform/blob/04672fbd55bb6d97d4efcc3657af9f4bc0d1215d/android/impl.nix#L4 that only works if the executable section is indented by two spaces (I had four).

Not sure what an easy solution is. But maybe add an echo after the sed saying “Mangling .cabal file to produce android libraries” so leave a breadcrumb for debugging.

ryantrinkle commented 5 years ago

Ah wow, sorry about that! Yes, we should make it more debuggable, and I do wonder if there's a better way to do it. Maybe we can write a Haskell script that parses the file with cabal, mangles it, and then produces the new version with cabal?

nomeata commented 5 years ago

You could probably use a multi-line regex to match on the header for executable and the indent of the next non-empty line, and use that. Still fragile and hacky, but pushes the line a bit further.