@Mutate @SuppressWarnings("GroovyUnusedDeclaration") public static void createTasksForVisualStudio( TaskContainer tasks, VisualStudioExtensionInternal visualStudioExtension) { for (VisualStudioProject vsProject : visualStudioExtension.getProjects()) { vsProject.builtBy(createProjectsFileTask(tasks, vsProject)); vsProject.builtBy(createFiltersFileTask(tasks, vsProject)); } for (VisualStudioSolution vsSolution : visualStudioExtension.getSolutions()) { Task solutionTask = tasks.create(vsSolution.getName() + "VisualStudio"); solutionTask.setDescription( String.format("Generates the '%s' Visual Studio solution file.", vsSolution.getName())); vsSolution.setBuildTask(solutionTask); vsSolution.builtBy(createSolutionTask(tasks, vsSolution)); // Lifecycle task for component ProjectNativeComponent component = vsSolution.getComponent(); Task lifecycleTask = tasks.maybeCreate(component.getName() + "VisualStudio"); lifecycleTask.dependsOn(vsSolution); lifecycleTask.setGroup("IDE"); lifecycleTask.setDescription( String.format("Generates the Visual Studio solution for %s.", component)); } addCleanTask(tasks); }
private static Task createSolutionTask(TaskContainer tasks, VisualStudioSolution solution) { GenerateSolutionFileTask solutionFileTask = tasks.create(solution.getName() + "VisualStudioSolution", GenerateSolutionFileTask.class); solutionFileTask.setVisualStudioSolution(solution); return solutionFileTask; }