Repository: mesonbuild/meson

Issue:
Python traceback when I run meson setup --backend xcode
**Describe the bug**

When I try to set up a build directory with the Xcode backend, I get the following traceback:

```
Traceback (most recent call last):
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 146, in run
    return options.run_func(options)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 294, in run
    app.generate()
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 185, in generate
    self._generate(env)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 247, in _generate
    intr.backend.generate()
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/backend/xcodebackend.py", line 302, in generate
    self.generate_pbx_file_reference(objects_dict)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/backend/xcodebackend.py", line 825, in generate_pbx_file_reference
    s = os.path.joni(t.subdir, s)
AttributeError: module 'posixpath' has no attribute 'joni'
```

This is clearly caused by a misspelling of the word `join`.

**To Reproduce**

1. Create the following empty files:

   - `main.c`
   - `ui.gresources.xml`

2. Create a `meson.build` file with the following content:

   ```meson
   project('xcode-test', 'c')
   
   gnome = import('gnome')
   ui_resources = gnome.compile_resources(
     'ui_resources',
     'ui.gresource.xml',
     source_dir : 'res/ui',
   )
   
   exe = executable('xcode-test', 'main.c')
   ```

3. Set up a build with the Xcode backend

   ```bash
   meson setup build --backend xcode
   ```

**Expected behavior**

An Xcode project is created successfully, without any Python tracebacks.

**system parameters**

* Native build for Intel Mac
* OS: macOS Catalina 10.15.7 (19H1715)
* `python -V`: Python 3.8.12
* `meson --version`: 0.61.3
* `ninja --version`: 1.10.2


**Debugging information**

I debugged this with ipdb by setting a breakpoint at `mesonbuild/backend/xcodebackend.py:825`:

```
ipdb> b mesonbuild/backend/xcodebackend.py:825
```

The error arises when Meson is processing the argument `'ui.gresource.xml'` to `gnome.compile_resources`:

```
    824                 elif isinstance(s, str):
1-> 825                     s = os.path.joni(t.subdir, s)
    826                 else:

ipdb> print(s)
res/ui.gresource.xml
```

I've also located 3 occurrences of this bug in 0.61.3:


https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L825

https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L945

https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L978


As of now, the bug persists in the latest master (commit 86aaac8e4229608b25508027267f49624a9a8cb5).


Discussion:
#8649 #8671

So good to know that xcode has comprehensive testsuite coverage. :D Perhaps if we installed more testsuite dependencies. EDIT: right, that's still not running in CI is it.

Resolving patch:
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -822,7 +822,7 @@ def generate_pbx_file_reference(self, objects_dict):
                 if isinstance(s, mesonlib.File):
                     s = os.path.join(s.subdir, s.fname)
                 elif isinstance(s, str):
-                    s = os.path.joni(t.subdir, s)
+                    s = os.path.join(t.subdir, s)
                 else:
                     continue
                 custom_dict = PbxDict()
@@ -942,7 +942,7 @@ def generate_pbx_group(self, objects_dict):
                 if isinstance(s, mesonlib.File):
                     s = os.path.join(s.subdir, s.fname)
                 elif isinstance(s, str):
-                    s = os.path.joni(t.subdir, s)
+                    s = os.path.join(t.subdir, s)
                 else:
                     continue
                 source_file_children.add_item(self.fileref_ids[(tname, s)], s)
@@ -975,7 +975,7 @@ def write_group_target_entry(self, objects_dict, t):
             if isinstance(s, mesonlib.File):
                 s = os.path.join(s.subdir, s.fname)
             elif isinstance(s, str):
-                s = os.path.joni(t.subdir, s)
+                s = os.path.join(t.subdir, s)
             else:
                 continue
             target_children.add_item(self.fileref_ids[(tid, s)], s)


Test patch: