Re: Is there an undocumented Syntax Check in Meson?

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Is there an undocumented Syntax Check in Meson?
Date: 2024-05-09 21:29:56
Message-ID: 87edaahdwr.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:

> Hi,
>
> On 2024-05-09 20:53:27 +0100, Dagfinn Ilmari Mannsåker wrote:
>> Andres Freund <andres(at)anarazel(dot)de> writes:
>> > On 2024-05-09 20:12:38 +0100, Dagfinn Ilmari Mannsåker wrote:
>> >> Attached is a patch which adds a check-docs target for meson, which
>> >> takes 0.3s on my laptop.
>> >> +checkdocs = custom_target('check-docs',
>> >> + input: 'postgres.sgml',
>> >> + output: 'check-docs',
>> >> + depfile: 'postgres-full.xml.d',
>> >> + command: [xmllint, '--nonet', '--valid', '--noout',
>> >> + '--path', '@OUTDIR@', '@INPUT@'],
>> >> + depends: doc_generated,
>> >> + build_by_default: false,
>> >> +)
>> >> +alias_target('check-docs', checkdocs)
>> >
>> > Isn't the custom target redundant with postgres_full_xml? I.e. you could just
>> > have the alias_target depend on postgres_full_xml?
>>
>> We could, but that would actually rebuild postgres-full.xml, not just
>> check the syntax (but that only takes 0.1-0.2s longer),
>
> I don't think this is performance critical enough to worry about 0.1s. If
> anything I think the performance argument goes the other way round - doing the
> validation work multiple times is a waste of time...

These targets are both build_by_default: false, so the checkdocs target
won't both be built when building the docs. But reusing the
postgres_full_xml target will save half a second of the half-minute
build time if you then go on to actually build the docs without changing
anything after the syntax check passes.

>> and only run if the docs have been modified since it was last built (which I
>> guess is fine, since if you haven't modified the docs you can't have
>> introduced any syntax errors).
>
> That actually seems good to me.
>
>
>> It's already possible to run that target directly, i.e.
>>
>> ninja doc/src/sgml/postgres-full.xml
>>
>> We could just document that in the list of meson doc targets, but a
>> shortcut alias would roll off the fingers more easily and be more
>> discoverable.
>
> Agreed.

Here's a v2 patch that does it that way. Should we document that
check-docs actually builds postgres-full.xml, and if so, where?

> Greetings,
>
> Andres Freund

- ilmari

Attachment Content-Type Size
v2-0001-Add-a-check-docs-target-for-meson.patch text/x-diff 1.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-05-09 23:10:43 Re: open items
Previous Message Bruce Momjian 2024-05-09 20:35:54 Re: First draft of PG 17 release notes