@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 void addCleanTask(TaskContainer tasks) { Delete cleanTask = tasks.create("cleanVisualStudio", Delete.class); for (Task task : tasks.withType(GenerateSolutionFileTask.class)) { cleanTask.delete(task.getOutputs().getFiles()); } for (Task task : tasks.withType(GenerateFiltersFileTask.class)) { cleanTask.delete(task.getOutputs().getFiles()); } for (Task task : tasks.withType(GenerateProjectFileTask.class)) { cleanTask.delete(task.getOutputs().getFiles()); } cleanTask.setGroup("IDE"); cleanTask.setDescription("Removes all generated Visual Studio project and solution files"); }
private void _configureTasksBuildSoy(Project project, final Configuration soyConfiguration) { TaskContainer taskContainer = project.getTasks(); taskContainer.withType( BuildSoyTask.class, new Action<BuildSoyTask>() { @Override public void execute(BuildSoyTask buildSoyTask) { _configureTaskBuildSoyClasspath(buildSoyTask, soyConfiguration); } }); }
private String _getAppJavadocGroupName(Project project) { String groupName = project.getDescription(); if (Validator.isNull(groupName)) { groupName = project.getName(); } TaskContainer taskContainer = project.getTasks(); WritePropertiesTask recordArtifactTask = (WritePropertiesTask) taskContainer.findByName(LiferayRelengPlugin.RECORD_ARTIFACT_TASK_NAME); if (recordArtifactTask != null) { String artifactURL = null; File artifactPropertiesFile = recordArtifactTask.getOutputFile(); if (artifactPropertiesFile.exists()) { Properties properties = GUtil.loadProperties(artifactPropertiesFile); artifactURL = properties.getProperty("artifact.url"); } if (Validator.isNotNull(artifactURL)) { int start = artifactURL.lastIndexOf('/') + 1; int end = artifactURL.lastIndexOf('.'); int pos = artifactURL.indexOf('-', start); String moduleName = artifactURL.substring(start, pos); String moduleVersion = artifactURL.substring(pos + 1, end); StringBuilder sb = new StringBuilder(); sb.append("Module "); sb.append(moduleName); sb.append(' '); sb.append(moduleVersion); sb.append(" - "); sb.append(groupName); groupName = sb.toString(); } } return groupName; }
private static Task createProjectsFileTask(TaskContainer tasks, VisualStudioProject vsProject) { GenerateProjectFileTask task = tasks.create(vsProject.getName() + "VisualStudioProject", GenerateProjectFileTask.class); task.setVisualStudioProject(vsProject); task.initGradleCommand(); return task; }
private void _configureTasksTranspileJS( Project project, final DownloadNodeModuleTask downloadMetalCliTask, final ExecuteNpmTask npmInstallTask) { TaskContainer taskContainer = project.getTasks(); taskContainer.withType( TranspileJSTask.class, new Action<TranspileJSTask>() { @Override public void execute(TranspileJSTask transpileJSTask) { _configureTaskTranspileJS(transpileJSTask, downloadMetalCliTask, npmInstallTask); } }); }
@Finalize public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) { for (NativeTestSuiteBinarySpec testBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) { NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary; final BinaryNamingScheme namingScheme = binary.getNamingScheme(); RunTestExecutable runTask = tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class); final Project project = runTask.getProject(); runTask.setDescription(String.format("Runs the %s", binary)); final InstallExecutable installTask = binary.getTasks().withType(InstallExecutable.class).iterator().next(); runTask.getInputs().files(installTask.getOutputs().getFiles()); runTask.setExecutable(installTask.getRunScript().getPath()); runTask.setOutputDir( new File( project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase())); testBinary.getTasks().add(runTask); } }
private static Task createFiltersFileTask(TaskContainer tasks, VisualStudioProject vsProject) { GenerateFiltersFileTask task = tasks.create(vsProject.getName() + "VisualStudioFilters", GenerateFiltersFileTask.class); task.setVisualStudioProject(vsProject); return task; }
private static Task createSolutionTask(TaskContainer tasks, VisualStudioSolution solution) { GenerateSolutionFileTask solutionFileTask = tasks.create(solution.getName() + "VisualStudioSolution", GenerateSolutionFileTask.class); solutionFileTask.setVisualStudioSolution(solution); return solutionFileTask; }