Giter Site home page Giter Site logo

Comments (5)

yonaskolb avatar yonaskolb commented on July 22, 2024

It's similar to xcconfigs #include in the way that it merges files. But instead of just using it for build settings you can split up your whole project spec. For example having one yaml file that has common build settings for different projects, or one that has a few targets, that another one then adds to or overrides specific properties of the targets, for example changing the platform of them all or something.
You can see an example here in the tests https://github.com/yonaskolb/XcodeGen/blob/master/Fixtures/include_test.yml
https://github.com/yonaskolb/XcodeGen/blob/master/Fixtures/included.yml

We use it for white label apps, where some things are defined in a base.yml and then the different projects have their own project.yml that include base.yml to override some settings, and add some project specific targets.

In terms of the name, do you suggest something other than include to make the purpose clearer? In either case the documentation for this feature should be improved. At the moment it's just documented briefly as a property in the project spec

from xcodegen.

toshi0383 avatar toshi0383 commented on July 22, 2024

Thanks for sharing the details. I think include just fits the use-case.👌
It isn't possible to inherit while overriding (like $(inherited) of Xcode) though, is it?

from xcodegen.

yonaskolb avatar yonaskolb commented on July 22, 2024

$(inherited) isn't really part of it, as that is inheriting between different levels of settings (target, target config, project, project config, sdk).
Any property that supports $(inherited) can actually be an array of values. If you define a setting as an array, then a different spec can add values to this.

This is because the logic of the include merging is as follows:

  • if existing value and new value are both dictionaries merge them
  • if existing value and new value are both an array then add the value
  • otherwise replace the existing value with the new value

This lets you add or replace something deep down in a hierachy. The only downside is that it's not possible to replace a whole dictionary or array as it's additive. I've been thinking of having some sort of syntax for replacing though (something like targets(REPLACE):)

Not sure if that all makes sense :)

from xcodegen.

toshi0383 avatar toshi0383 commented on July 22, 2024

Understood. It sounds great!

Because xcconfig's #include does not allow inheritance or merging, when you have xcconfig from CocoaPods, configuring your xcconfig is kind of troublesome. Resently I presented about this. So for some users, it can be better option to use XcodeGen's include feature than xcconfig.
Only thing to consider is that XcodeGen is a third party, so it might be broken by future release of Xcode. But it's not likely to happen because pbxproj format haven't changed much for years, did it?
Even #include is a bit troublesome as described in my slide, xcconfig is still a good option, too. Because it's even separated from XcodeGen's spec(project.yml), it's easier to be reviewed by or share with others who don't know about XcodeGen.

Related: #59

from xcodegen.

yonaskolb avatar yonaskolb commented on July 22, 2024

The :REPLACE syntax for includes has been added in #68

from xcodegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.