This message was deleted.
# community-support
s
This message was deleted.
v
While I prefer the build logic in an included build instead of
buildSrc
, both works perfectly fine here in regards to IntelliJ. Can you throw together a quick MCVE that shows red for you so I can see whether it shows red here too or whether it is a problem local to your environment?
c
oh it seems that with the latest idea version it currently does not show my scripts in red. but it still inspects the autogenerated classes when I run “inspect code”. does that also work for you?
v
Actually I'm not yet on latest but still on 2021.3 😞 But yeah, those folders are marked as source root, not generated source root. So yes, inspect code inspects them, unless I mark them as generated source root.
c
oh is that the underlying issue? can I just change that in project structure? I guess a gradle reimport overwrites it again?
v
Yes, that's the underlying issue. Whoever registers the source root should also configure the
idea
plugin so that the source is configured as generated source root. You can mark it manually, yes. I would have expected that a reimport overwrites it, yes. But from a quick try it indeed survived the reimport.
Alternatively you can configure it via the
idea
plugin configuration if you don't mind having IDE specific config in your build script
c
I’m happy with any fix that works, thanks for the pointer!
👌 1
Vampire [3:06 PM]
While I prefer the build logic in an included build instead of
buildSrc
btw what do you mean by that? included build as in includeBuild as in composite build? can you point me to an example project?
v
btw what do you mean by that? included build as in includeBuild as in composite build?
yes
can you point me to an example project?
While there are many out there , I don't have one "at hand" right now. But what do you need an example for? It's basically not more than renaming
buildSrc
to something different, for example
build-logic
or
gradle/build-logic
or whatever you like and adding an
includeBuild
to your settings script. One slight difference is, that you do not get type-safe accessors for the plugins anymore but have to apply them by ID, or you have to have a settings plugin (even a no-op) to get them with an included build.
c
thanks. i was just confused, I was actually already using build logic in a composite build in a monorepo on a contract I worked on.
👌 1
about excluding the generated sources via the idea plugin, I can not get that to work. I tried adding this to my buildSrc/build.gradle.kts:
Copy code
idea {
    module {
        generatedSourceDirs.add(File(buildDir, "generated-sources/dsl-accessors/kotlin"))
    }
}
but it does not seem to work
@Vampire do you know how to fix this?
v
Hard to guess without hands-on. One thing is, did you try to completely delete the IDE files and reimport the project freshly? At least in the past sometimes IJ did not properly switch the type after the initali import if it changed in the build script. I also reported it in YouTrack, but I thought it was resolved at some point, but I might misremember about the last part.