XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Add `enable` option for `include` to enable optional including for addtional spec

Open freddi-kit opened this issue 3 years ago • 2 comments

Motivation

Currently, we cannot disable the adding additional spec from other file, by include option so it is unable to generate variety project by XcodeGen.

For example, we cannot generate the project which has difference between Debug and Release. We may have the dependency which is not necessary for release environment, like debug logger framework.

Achivement

By this PR, we can achive the such things by XcodeGen. For example,

include:
  - path: dependency_for_debug.yml
    enable: ${DEBUG_BUILD}

This yml files only imports debug dependency if DEBUG_BUILD environment object is defined as "YES".

We also can specify normal boolean literal.

include:
  - path: dependency_for_debug.yml
    enable: false

Changes

  • Add enable option for include
  • Fix checking environment variable in include

Test

Added to Tests/ProjectSpecTests/SpecLoadingTests.swift

freddi-kit avatar Aug 08 '22 07:08 freddi-kit

Environment variables are already resolved here. It's strange to resolve variables on SpecFile side. https://github.com/yonaskolb/XcodeGen/blob/34f50d645e6a3b0d9930c2b105c00521bfe2c8cf/Sources/ProjectSpec/SpecLoader.swift#L20

I suggest moving the process resolves variables before including sub specs.

giginet avatar Aug 09 '22 07:08 giginet

@giginet I fixed by resolving variable here to not make resolve twice. Please check it https://github.com/yonaskolb/XcodeGen/blob/0cfb122a0d35ffeb94a42c247ff470e75e0cb8ce/Sources/ProjectSpec/SpecFile.swift#L72

freddi-kit avatar Aug 10 '22 07:08 freddi-kit

Hello, when new version of XcodeGen released?

freddi-kit avatar Aug 18 '22 08:08 freddi-kit

I'm happy if there is new release for using it

freddi-kit avatar Aug 18 '22 08:08 freddi-kit

2.32.0 released

yonaskolb avatar Aug 18 '22 14:08 yonaskolb

Thanks!

freddi-kit avatar Aug 22 '22 03:08 freddi-kit