@@ -95,38 +95,16 @@ def _meson_common_args(pg_src, build_options, auto_features):
9595 env = env | env_meson ,
9696 lib_source = pg_src ,
9797 options = build_options | meson_tool_options ,
98- setup_args = [
99- "--auto-features=%s" % auto_features ,
100- ],
98+ target_args = {
99+ "setup" : [
100+ "--auto-features=%s" % auto_features ,
101+ ],
102+ },
101103 toolchains = toolchains ,
102104 visibility = ["//visibility:public" ],
103105 )
104106
105- def pg_build (name , pg_src , build_options , auto_features ):
106- """
107- Generates a Bazel target to build Postgres with the Meson build system.
108-
109- This rule configures the environment and invokes the rules_foreign_cc
110- `meson` rule, using preconfigured options, toolchains, etc.
111-
112- Args:
113- name (str): The name of the Bazel target to generate.
114- pg_src (str): The external Bazel repo with the Postgres source code.
115- build_options (dict): Meson build options that configure optional
116- Postgres features and other compilation parameters. For the full
117- list of available options, see [PostgreSQL
118- Features](https://www.postgresql.org/docs/current/install-meson.html#MESON-OPTIONS-FEATURES)
119- and
120- [`meson_options.txt`](https://github.com/postgres/postgres/blob/master/meson_options.txt).
121- auto_features (str): Controls whether Meson build options and optional
122- Postgres features not specified in `build_options` will be
123- `enable`d, `disable`d or `auto` (enabled or disabled based on
124- detected system capabilities). For more details, see the official
125- documentation for [Postgres
126- `--auto-features`](https://www.postgresql.org/docs/current/install-meson.html#CONFIGURE-AUTO-FEATURES-MESON)
127- and [Meson Build Options
128- "Features"](https://mesonbuild.com/Build-options.html#features).
129- """
107+ def _pg_build_meson (name , pg_src , build_options , auto_features ):
130108 pg_binaries = [
131109 "initdb" ,
132110 "postgres" ,
@@ -165,6 +143,58 @@ def pg_build(name, pg_src, build_options, auto_features):
165143 output_group = "Meson_logs" ,
166144 )
167145
146+ def _pg_build_introspect (name , pg_src , build_options , auto_features ):
147+ meson_common_args = _meson_common_args (
148+ pg_src = pg_src ,
149+ build_options = build_options ,
150+ auto_features = auto_features ,
151+ )
152+
153+ introspect_target_name = "{}--introspect" .format (name )
154+
155+ meson (** (meson_common_args | dict (
156+ name = introspect_target_name ,
157+ out_include_dir = "" ,
158+ out_data_files = ["{}.json" .format (name )],
159+ targets = ["introspect" ],
160+ tags = ["manual" ],
161+ )))
162+
163+ native .filegroup (
164+ name = "{}--logs" .format (introspect_target_name ),
165+ srcs = [introspect_target_name ],
166+ output_group = "Meson_logs" ,
167+ tags = ["manual" ],
168+ )
169+
170+ def pg_build (name , pg_src , build_options , auto_features ):
171+ """
172+ Generates a Bazel target to build Postgres with the Meson build system.
173+
174+ This rule configures the environment and invokes the rules_foreign_cc
175+ `meson` rule, using preconfigured options, toolchains, etc.
176+
177+ Args:
178+ name (str): The name of the Bazel target to generate.
179+ pg_src (str): The external Bazel repo with the Postgres source code.
180+ build_options (dict): Meson build options that configure optional
181+ Postgres features and other compilation parameters. For the full
182+ list of available options, see [PostgreSQL
183+ Features](https://www.postgresql.org/docs/current/install-meson.html#MESON-OPTIONS-FEATURES)
184+ and
185+ [`meson_options.txt`](https://github.com/postgres/postgres/blob/master/meson_options.txt).
186+ auto_features (str): Controls whether Meson build options and optional
187+ Postgres features not specified in `build_options` will be
188+ `enable`d, `disable`d or `auto` (enabled or disabled based on
189+ detected system capabilities). For more details, see the official
190+ documentation for [Postgres
191+ `--auto-features`](https://www.postgresql.org/docs/current/install-meson.html#CONFIGURE-AUTO-FEATURES-MESON)
192+ and [Meson Build Options
193+ "Features"](https://mesonbuild.com/Build-options.html#features).
194+ """
195+ _pg_build_meson (name , pg_src , build_options , auto_features )
196+ _pg_build_introspect (name , pg_src , build_options , auto_features )
197+
168198def pg_build_all (name , cfg ):
169199 """
170200 Defines Bazel targets for building all configured Postgres versions.
0 commit comments