WindowsResourceCompile: Is the Windows system includes list published and accessible from a script?


I am using the native-sample native-sample windows-resource snippet to compile a local DLLVersion.rc file. But this resource file is including “winres.h” and thus, one needs to know which Windows system includes list is used to set properly the include paths.

So, the question is: Is the Windows system include list published and accessible from a script?

Given DLLVersion.rc file is most likely compiled using the same configuration that the main library code, you could like the WindowsResourceCompile#getIncludes() with the same property from CppCompile. Something like the following should do the trick:

application {
    targetMachines = []
    binaries.whenElementFinalized { binary ->
        def compileResources = tasks.register("compileResources${}", WindowsResourceCompile) {
            targetPlatform = binary.compileTask.get().targetPlatform
            toolChain = binary.toolChain
            includes.from binary.compileTask.get().includes  // Change this line
            source.from fileTree(dir: "src/main/rc", includes: ["**/*.rc"])
            compilerArgs.addAll{ NativeToolChain toolChain ->
                if (toolChain instanceof VisualCpp) {
                    return ["/v"]
                return []
            it.outputDir = layout.buildDirectory.dir("windows-resources/${}").get().asFile

I create this issue to demonstrate this better.