yonaskolb / yonaskolb/XcodeGen

Source incorrectly referenced when using relative path

Open
#1,023 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

Hi,

I generate XCode projects from an autotool project, using it to build and using XCode to package everything.

I have the following snippet in my configure.ac

AS_IF([ test "${SYS}" = "darwin" ],[
  AC_ARG_VAR([XCODEGEN],[xcode project generator])
  AC_PATH_PROG([XCODEGEN],[xcodegen],[no])
  AS_IF([ test "x${XCODEGEN}" != "xno" ], [
    VLC_BUILD_DIR="." VLC_SRC_DIR="${srcdir}" VLC_PLATFORM=tvOS \
    ${XCODEGEN} generate --project . --spec "${srcdir}/extras/package/apple/xcodegen.yml" --project-root .
  ])
])

Which, to be more readable, expands to

VLC_SRC_DIR=../.. VLC_PLATFORM="tvOS" VLC_BUILD_DIR=.  xcodegen generate --project . --spec ../../extras/package/apple/xcodegen.yml --project-root .

Unfortunately, xcodegen detects the files in the source directory, so raise no issues, and generate the references, but the generated xcode project uses the include directory in the build directory, discarding the ../../ relative path prefix.

To ensure this is not coming from my configuration, here is my spec file:

name: VLC
options:
  bundleIdPrefix: org.videolan.vlc
  deploymentTarget:
    iOS: 9.0
targets:
  VLCAutomake:
    type: ""
    platform: ${VLC_PLATFORM}
    legacy:
      toolPath: /usr/bin/make
      passSettings: true
      attributes: $(ACTIONS)
      workingDirectory: ${VLC_BUILD_DIR}
    sources:
      - path: "${VLC_SRC_DIR}/src"
        excludes: "**/Makefile.in"
      - path: "${VLC_SRC_DIR}/include"
        excludes: "**/Makefile.in"
      - path: "${VLC_SRC_DIR}/modules"
        excludes: "**/Makefile.in"
  vlccoreios:
    type: "application"
    platform: ${VLC_PLATFORM}
    dependencies:
      - target: VLCAutomake
    info:
      path: "vlccoreios/Info.plist"
    sources:
      - path: ${VLC_BUILD_DIR}/test/vlccoreios
        type: file
        optional: true
        buildPhase:
          copyFiles:
            destination: executables

But since I needed optional: true for the vlccoreios path, it seems to me that the generation probably has an issue with relative path here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the configure.ac snippet, the extras/package/apple/xcodegen.yml spec, and the relative paths shown in the xcodegen generate command. Inspect how the generator resolves the sources and the optional vlccoreios path. Done means the generated Xcode project preserves the ../../ prefix and correctly references source and build directories.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.