On 15/05/2016 20:38, Nick Wellnhofer wrote:
Lucifers,
I'd like to tackle an issue that's been nagging me for quite some time and
build separate binaries for our test suites. Then the test binaries can be
skipped when installing a Clownfish project.
My original plan focused too much on the Perl side of things. Thinking more
about it, we need a solution that works for all host languages. Maybe I should
start by finishing my work on making the Perl build use the Makefile generated
by charmonizer.exe. I like the general idea that we have a
language-independent system to build static libraries which the host
language's build system can link with.
The next step is to have the Makefile generate separate static libraries for
the test and non-test parts of a project, or simply for each parcel. For the C
build, we can link the static test library directly into a test executable,
for example.
The main problem I see is that for now, charmonizer.exe needs a lot of
knowledge about the locations of different source files, autogenerated or not,
leading to code like the following that must be repeated for every Clownfish
project:
https://github.com/apache/lucy-clownfish/blob/615d033e45b6fc768e62370780e322aaa68339ac/runtime/common/charmonizer.main#L276
This only gets worse if we build multiple binaries.
There is an obvious improvement: Use a consistent name for the directory that
contains host-specific C code. Currently, we have "cfext", "ext, "xs", and
"src". I think Marvin already proposed to standardize on "cfext".
Regarding the autogenerated C files, maybe we should create only a single file
per parcel named after the host language. So for Perl instead of
boot.c
callbacks.c
we have
cfish_perl.c // Boot and callback code for the
// Clownfish parcel.
testcfish_perl.c // Boot and callback code for the tests.
For languages that don't need extra code, we can create empty files:
cfish_c.c // Empty.
testcfish_c.c // Empty.
This leaves the question of how to find the source files of a parcel. Maybe we
should stick to the rule to have a single source directory for each parcel? Or
even enforce a directory layout involving parcel names? Then charmonizer.exe
only needs the parcel (nick)name and the source directory to work out the
source files for each parcel and host language:
$source_dir/*.c // Or even core/$parcel_nick/*.c
$host_lang/cfext/*.c // Must somehow handle parcels
autogen/source/${parcel_nick}_parcel.c
autogen/source/${parcel_nick}_${host_lang}.c
The remaining problem is that that the host-specific, non-generated .c files
in "cfext" must also be assigned to the correct parcel.
Speaking more generally, the .c files can be categorized as static or
generated, and as core or host-specific, resulting in four overall categories:
- static core
- static host-specific
- generated core
- generated host-specific
This again is multiplied by the number of parcels.
Nick