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

Unwanted generated source file when using forceParse #1343

Open
CyrilAngerCG opened this issue Jun 14, 2024 · 0 comments
Open

Unwanted generated source file when using forceParse #1343

CyrilAngerCG opened this issue Jun 14, 2024 · 0 comments

Comments

@CyrilAngerCG
Copy link

Here is a simple swifttemplate that generates inline code for types implementing a custom protocol.

<%_ for type in types.all where type.implements["MyProtocol"] != nil { -%>
// sourcery:inline:auto:<%= type.name %>.MyTemplate
let someVar = "test"
// sourcery:end
<%_ } -%>

Everything is working fine and the code is generated inline as expected :

struct MyStruct: MyProtocol {
   // sourcery:inline:auto:MyStruct.MyTemplate
   let someVar = "test"
   // sourcery:end
}

Now, I want to be able to parse the generated code to use it in another template so I add the forceParse option in my .sourcery.yml config file :

forceParse:
        - MyTemplate

It works as expected and the generated is correctly parsed and available when using the other template but it also generates a MyTemplate.generated.swift file in my output folder with the following contents :

// Generated using Sourcery 2.2.4 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// sourcery:inline:auto:MyStruct.MyTemplate
let someVar = "test"
// sourcery:end
// sourcery:inline:auto:MyStruct2.MyTemplate
let someVar = "test"
// sourcery:end
// sourcery:inline:auto:MyStruct3.MyTemplate
let someVar = "test"
// sourcery:end

Obviously the project doesn't compile anymore with it.
Is this file supposed to be generated as well or am I doing something wrong ? How can I get rid of it without deleting it manually after each generation ?

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

1 participant