Repository: mesonbuild/meson

Issue:
Resource "res3.txt" listed in "resources/generated.gresource.xml" was not found. If this is a generated file, pass the target that generates it to gnome.compile_resources() using the "dependencies" keyword argument.
```
Build started at 2017-04-20T07:35:35.575544
Python binary: /usr/bin/python3
Python system: Linux
The Meson build system
Version: 0.40.0.dev1
Source dir: /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome
Build dir: /builddir/build/BUILD/meson-0.39.1/b ysrltf81
Build type: native build
Project name: gobject-introspection
Sanity testing c compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.c -o /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command: /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.exe
Native c compiler: cc (gcc 7.0.1)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Determining dependency 'gio-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gio-2.0 found: YES 2.52.1
Determining dependency 'gio-unix-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gio-unix-2.0 found: YES 2.52.1
Determining dependency 'glib-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency glib-2.0 found: YES 2.52.1
Determining dependency 'gobject-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gobject-2.0 found: YES 2.52.1
Determining dependency 'gobject-introspection-1.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gobject-introspection-1.0 found: YES 1.52.0
Determining dependency 'gmodule-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gmodule-2.0 found: YES 2.52.1
Configuring res4.txt using configuration
Program copyfile.py found: YES (/usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/copyfile.py)
Configuring simple-gen.gresource.xml with command
Running command: /usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/copyfile.py /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/simple.gresource.xml /builddir/build/BUILD/meson-0.39.1/b ysrltf81/resources/simple-gen.gresource.xml
Determining dependency 'glib-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency glib-2.0 found: YES 2.52.1
Adding test "simple resource test".
Program resources.py found: YES (/usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/resources.py)
Adding test "simple resource test (gresource)".
Meson encountered an error in file resources/meson.build, line 37, column 2:
Resource "res3.txt" listed in "resources/generated.gresource.xml" was not found. If this is a generated file, pass the target that generates it to gnome.compile_resources() using the "dependencies" keyword argument.
```
Resource "res3.txt" listed in "resources/generated.gresource.xml" was not found. If this is a generated file, pass the target that generates it to gnome.compile_resources() using the "dependencies" keyword argument.
```
Build started at 2017-04-20T07:35:35.575544
Python binary: /usr/bin/python3
Python system: Linux
The Meson build system
Version: 0.40.0.dev1
Source dir: /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome
Build dir: /builddir/build/BUILD/meson-0.39.1/b ysrltf81
Build type: native build
Project name: gobject-introspection
Sanity testing c compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.c -o /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command: /builddir/build/BUILD/meson-0.39.1/b ysrltf81/meson-private/sanitycheckc.exe
Native c compiler: cc (gcc 7.0.1)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Determining dependency 'gio-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gio-2.0 found: YES 2.52.1
Determining dependency 'gio-unix-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gio-unix-2.0 found: YES 2.52.1
Determining dependency 'glib-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency glib-2.0 found: YES 2.52.1
Determining dependency 'gobject-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gobject-2.0 found: YES 2.52.1
Determining dependency 'gobject-introspection-1.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gobject-introspection-1.0 found: YES 1.52.0
Determining dependency 'gmodule-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency gmodule-2.0 found: YES 2.52.1
Configuring res4.txt using configuration
Program copyfile.py found: YES (/usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/copyfile.py)
Configuring simple-gen.gresource.xml with command
Running command: /usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/copyfile.py /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/simple.gresource.xml /builddir/build/BUILD/meson-0.39.1/b ysrltf81/resources/simple-gen.gresource.xml
Determining dependency 'glib-2.0' with pkg-config executable '/usr/bin/pkg-config'
Native dependency glib-2.0 found: YES 2.52.1
Adding test "simple resource test".
Program resources.py found: YES (/usr/bin/env python3 /builddir/build/BUILD/meson-0.39.1/test cases/frameworks/7 gnome/resources/resources.py)
Adding test "simple resource test (gresource)".
Meson encountered an error in file resources/meson.build, line 37, column 2:
Resource "res3.txt" listed in "resources/generated.gresource.xml" was not found. If this is a generated file, pass the target that generates it to gnome.compile_resources() using the "dependencies" keyword argument.
```


Discussion:
Cannot reproduce on released Fedora. Are you running Git head and have purged every non-tracked file? IIRC there was something weird about this.
I'm running Rawhide. It has newer version of glib than F25...


Cannot reproduce on released Fedora. Are you running Git head and have purged every non-tracked file? IIRC there was something weird about this.
I'm running Rawhide. It has newer version of glib than F25...



Resolving patch:
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -253,6 +253,8 @@ def exists_in_srcdir(f):
             missing_basename = os.path.basename(missing)
 
             for dep in dependencies:
+                if hasattr(dep, 'held_object'):
+                    dep = dep.held_object
                 if isinstance(dep, mesonlib.File):
                     if dep.fname == missing_basename:
                         found = True
@@ -260,18 +262,20 @@ def exists_in_srcdir(f):
                         dep_files.append(dep)
                         subdirs.append(dep.subdir)
                         break
-                elif isinstance(dep, interpreter.CustomTargetHolder):
-                    if dep.held_object.get_basename() == missing_basename:
+                elif isinstance(dep, build.CustomTarget):
+                    if dep.get_basename() == missing_basename:
                         found = True
                         dep_files.remove(missing)
                         dep_files.append(
                             mesonlib.File(
                                 is_built=True,
-                                subdir=dep.held_object.get_subdir(),
-                                fname=dep.held_object.get_basename()))
-                        depends.append(dep.held_object)
-                        subdirs.append(dep.held_object.get_subdir())
+                                subdir=dep.get_subdir(),
+                                fname=dep.get_basename()))
+                        depends.append(dep)
+                        subdirs.append(dep.get_subdir())
                         break
+                else:
+                    raise RuntimeError('Unreachable code.')
 
             if not found:
                 raise MesonException(


Test patch: