Gradle-为多个本机组件生成单个Visual Studio解决方案

Gradle-为多个本机组件生成单个Visual Studio解决方案,gradle,build.gradle,Gradle,Build.gradle,我正在将大型代码库从定制构建系统移植到Gradle 我有没有办法用两个项目而不是两个单独的解决方案生成单个VS解决方案 我的示例build.gradle文件: apply plugin: 'cpp' apply plugin: 'visual-studio' model { components { debugger(NativeExecutableSpec) { } nativeagent(NativeLibrarySpec) {

我正在将大型代码库从定制构建系统移植到Gradle

我有没有办法用两个项目而不是两个单独的解决方案生成单个VS解决方案

我的示例build.gradle文件:

apply plugin: 'cpp'
apply plugin: 'visual-studio'


model {
    components {
        debugger(NativeExecutableSpec) {
        }

        nativeagent(NativeLibrarySpec) {
        }
    }

    visualStudio {
            solutions.all {
                solutionFile.location = "vs/${name}.sln"
            }

            projects.all {
                projectFile.location = "vs/${name}.vcxproj"
                filtersFile.location = "vs/${name}.filters"
            }
    }
}
\gradlew任务的输出

.....
IDE tasks
---------
cleanVisualStudio - Removes all generated Visual Studio project and solution files
debuggerVisualStudio - Generates the Visual Studio solution for native executable 'debugger'.
nativeagentVisualStudio - Generates the Visual Studio solution for native library 'nativeagent'.

我自己想出来了,只需指定项目之间的依赖关系:

debugger(NativeExecutableSpec) {
            sources {
                cpp {
                    lib library: "nativeagent"                      
                    source {
                        srcDir "debugger/src"
                        include "**/*.cpp"
                    }
                }
            }
        }
然后运行
\gradlew debuggerVisualStudio