Open ItsJamie9494 opened 2 years ago
Tihs looks wrong to me
blueprints = custom_target('blueprints',
input: files(
'data/ui/main_window.blp',
'data/ui/menu.blp',
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
I think this needs to be:
blueprints = custom_target('blueprints',
input: files(
'data/ui/main_window.blp',
'data/ui/menu.blp',
),
output: ['main_window.ui', 'menu.ui'],
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
(note that you want to use @OUTDIR@
, not @OUTPUT@
, and set the actual outputs)
otherwise what happens is that ninja creates a dependency on '.', which it may decide is up to date before main_window.ui or menu.ui is actually created. with the changes it creates a dependency on the acutal output files, and will both order correctly and rebuild correctly, which is absolutely not happening in this case.
Tihs looks wrong to me
blueprints = custom_target('blueprints', input: files( 'data/ui/main_window.blp', 'data/ui/menu.blp', ), output: '.', command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], )
I think this needs to be:
blueprints = custom_target('blueprints', input: files( 'data/ui/main_window.blp', 'data/ui/menu.blp', ), output: ['main_window.ui', 'menu.ui'], command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], )
(note that you want to use
@OUTDIR@
, not@OUTPUT@
, and set the actual outputs) otherwise what happens is that ninja creates a dependency on '.', which it may decide is up to date before main_window.ui or menu.ui is actually created. with the changes it creates a dependency on the acutal output files, and will both order correctly and rebuild correctly, which is absolutely not happening in this case.
I applied these changes locally and the error is still persisting.
I'm assuming that this recommendation from upstream is about keeping your meson.build DRY, so I've proposed https://github.com/mesonbuild/meson/pull/10498 to help with that.
hmmm, okay. That seems relavent then. Let me look at the gnome module then.
After finding this bug, we put this together to make it work. The env
in the custom target is because we need to get gir file available to blueprint-compiler
as well.
bpfiles = [
'demo.blp'
]
# We need to define our outputs from the custom_target, so we just create a new
# list based off of the input with the extension changed.
uifiles = []
foreach bpfile : bpfiles
uifiles += bpfile.replace('.blp', '.ui')
endforeach
blueprints = custom_target('blueprints',
input: files(bpfiles),
output: uifiles,
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
depends: [talkatu, talkatu_gir],
env: bpenv,
)
Describe the bug A project I use uses blueprint-compiler to convert files into XML. To do this, a custom build target is created, and set as the
dependencies
argument for the compile resources target. However, the resources are compiledbefore
the custom target is executed, thus creating errors when the XML files are not created in time.To Reproduce meson.txt meson.txt
These two files are the meson.build files for this project. The source code for this project is at https://github.com/tau-OS/enigma, in case it's helpful.
Expected behavior
Meson/Ninja should execute the custom target before the compile_resources, as the custom target is a dependency.
system parameters