use of org.gradle.ide.visualstudio.internal.DefaultVisualStudioProject in project gradle by gradle.
the class VisualStudioPlugin method applyVisualStudioCurrentModelRules.
private void applyVisualStudioCurrentModelRules(final VisualStudioExtensionInternal extension) {
project.getComponents().withType(CppApplication.class).all(cppApplication -> {
DefaultVisualStudioProject vsProject = extension.getProjectRegistry().createProject(project.getName(), cppApplication.getName());
vsProject.getSourceFiles().from(cppApplication.getCppSource());
vsProject.getHeaderFiles().from(cppApplication.getHeaderFiles());
cppApplication.getBinaries().whenElementFinalized(CppExecutable.class, executable -> {
extension.getProjectRegistry().addProjectConfiguration(new CppApplicationVisualStudioTargetBinary(project.getName(), project.getPath(), cppApplication, executable, project.getLayout()));
});
});
project.afterEvaluate(proj -> {
project.getComponents().withType(CppLibrary.class).all(cppLibrary -> {
for (Linkage linkage : cppLibrary.getLinkage().get()) {
VisualStudioTargetBinary.ProjectType projectType = VisualStudioTargetBinary.ProjectType.DLL;
if (Linkage.STATIC.equals(linkage)) {
projectType = VisualStudioTargetBinary.ProjectType.LIB;
}
DefaultVisualStudioProject vsProject = extension.getProjectRegistry().createProject(project.getName() + projectType.getSuffix(), cppLibrary.getName());
vsProject.getSourceFiles().from(cppLibrary.getCppSource());
vsProject.getHeaderFiles().from(cppLibrary.getHeaderFiles());
}
cppLibrary.getBinaries().whenElementFinalized(CppSharedLibrary.class, library -> {
extension.getProjectRegistry().addProjectConfiguration(new CppSharedLibraryVisualStudioTargetBinary(project.getName(), project.getPath(), cppLibrary, library, project.getLayout()));
});
cppLibrary.getBinaries().whenElementFinalized(CppStaticLibrary.class, library -> {
extension.getProjectRegistry().addProjectConfiguration(new CppStaticLibraryVisualStudioTargetBinary(project.getName(), project.getPath(), cppLibrary, library, project.getLayout()));
});
});
});
}
use of org.gradle.ide.visualstudio.internal.DefaultVisualStudioProject in project gradle by gradle.
the class GenerateProjectFileTask method configure.
@Override
protected void configure(VisualStudioProjectFile projectFile) {
DefaultVisualStudioProject vsProject = visualStudioProject;
projectFile.setGradleCommand(buildGradleCommand());
projectFile.setProjectUuid(DefaultVisualStudioProject.getUUID(getOutputFile()));
projectFile.setVisualStudioVersion(visualStudioProject.getVisualStudioVersion().get());
projectFile.setSdkVersion(visualStudioProject.getSdkVersion().get());
for (File sourceFile : vsProject.getSourceFiles()) {
projectFile.addSourceFile(sourceFile);
}
for (File resourceFile : vsProject.getResourceFiles()) {
projectFile.addResource(resourceFile);
}
for (File headerFile : vsProject.getHeaderFiles()) {
projectFile.addHeaderFile(headerFile);
}
if (vsProject.getConfigurations().stream().noneMatch(it -> it.isBuildable())) {
getLogger().warn("'" + vsProject.getComponentName() + "' component in project '" + getProject().getPath() + "' is not buildable.");
}
for (VisualStudioProjectConfiguration configuration : vsProject.getConfigurations()) {
projectFile.addConfiguration(configuration);
}
for (Action<? super XmlProvider> xmlAction : vsProject.getProjectFile().getXmlActions()) {
getXmlTransformer().addAction(xmlAction);
}
}
Aggregations