Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define settings of mlmodel files #1132

Closed
WesleyJacobsMP opened this issue Sep 28, 2021 · 3 comments
Closed

Define settings of mlmodel files #1132

WesleyJacobsMP opened this issue Sep 28, 2021 · 3 comments

Comments

@WesleyJacobsMP
Copy link

I've currently been unable to find how to keep my settings of mlmodel files when running xcodegen.
The change done in xcode (Change the model class to not be generated in "Target Membership") results in the following addition in the project file:

BAF7A3E854C74A605097D91F /* digits.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = FA1AF80468D8D39346D72A20 /* digits.mlmodel */; settings = {ATTRIBUTES = (no_codegen, ); }; };

I want to be able to keep that last part (the settings) when running xcodegen.

@Sherlouk
Copy link

I believe this is the code which powers this:

https://github.com/yonaskolb/XcodeGen/blob/master/Sources/XcodeGenKit/PBXProjGenerator.swift#L685-L698

I too require this change, but for an 'intentdefinition' file, which I want to have look a little something like:

25349A18EC6E9EF7D2887BA2 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 4EF78D0C887E7CB991044D30 /* Intents.intentdefinition */; settings = {ATTRIBUTES = (private_codegen, ); }; };

I tried setting it using the attributes array which is available in the docs, but that doesn't seem to work:

    sources:
      - path: Intents.intentdefinition
        attributes: 
          - private_codegen

@Sherlouk
Copy link

Found what was broken in my code after looking at #583 - this issue can probably be closed down as it is supported.

For the original author (@WesleyJacobsMP), add the following YAML to your configuration under the target in which the file is added.

    sources:
      - path: PATH/TO/digits.mlmodel
        attributes: 
          - no_codegen

The mistake I was making above was that the full configuration had numerous sources, and they're evaluated in a top-down approach with the ones at the top taking higher priority. So I needed to move my Intents attributes property further up the sources array.

Here's my full sources YAML now.

    sources:
      - Project.xcassets
      - path: Project/Ext/Widget/Intents.intentdefinition
        attributes: 
          - private_codegen
      - Project/Ext/Widget

Notably, the third item in this array, was at position two, which was overriding the attributes I was trying to specify.

@yonaskolb
Copy link
Owner

Glad you got this sorted @Sherlouk, I'll close this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants