Adding a build-dependency on flex

Nicolás Alvarez nicolas.alvarez at gmail.com
Fri Jun 17 23:42:04 UTC 2011


On 6/17/11, Milian Wolff <mail at milianw.de> wrote:
> On Saturday 18 June 2011 01:12:48 Nicolás Alvarez wrote:
>> Hi devs,
>>
>> I'm working on some stuff in the CMake parser which involves changes
>> to the lexer. It's written in flex, and currently taken unmodified
>> from the CMake project.
>>
>> We currently ship both the generated code (.c) and the flex source
>> (.in.l) in the git repository. With current versions of flex, the
>> .in.l file doesn't even work; and after fixing it, flex unsurprisingly
>> generates a different .c than we have now.
>>
>> It's being annoying to have to manually run flex to regenerate the .c
>> between changing something and running 'make'. I think it would be
>> better to ship only the .l file and run flex at compile time. But this
>> would mean adding a required compile-time dependency on flex to
>> kdevelop. What do you think about it? Is it an acceptable dep to add?
>> Or should I just continue keeping the .l and .c in sync in every
>> commit?
>
> Do you think these changes will be frequent? I/we don't like lots of
> dependencies - even if they are only at compile time.
>
> Though from my experience of working on PHP I can completely understand your
> pov. As changes to the grammar are very frequent in PHP I also made the
> pg-qt
> a compile time dependency to guard myself against forgetting to sync the
> generated files.
>
> Hence: If you think there will be multiple grammar changes in the future, I
> think we should make flex a compile time dep.

I don't really think the changes will be frequent over time, and my
local changes are mostly cleanup and C++ification, not changes to the
actual token regexes. I also think the PHP parser is *way* more likely
to change than the CMake lexer.

But, I have something like 20 local commits that are all changing the
.l and the .c in sync. I once reordered two commits via rebase, and
the generated code didn't actually correspond to the input file
anymore, I basically had to rerun flex in the whole local history to
get them back synced. Good thing I actually know git...

How about I add the flex dependency, and remove it if users complain
about the new dep? :)

-- 
Nicolas




More information about the KDevelop-devel mailing list