public void apply(final ProjectInternal project) { project.getPlugins().apply(NativeBinariesModelPlugin.class); modelRules.rule(new CreateTestBinaries(instantiator, resolver, project)); project.getExtensions().create("testSuites", DefaultTestSuiteContainer.class, instantiator); }
public void apply(ProjectInternal project) { project.getPluginManager().apply(ReportingBasePlugin.class); this.project = project; addJacocoConfigurations(); JacocoAgentJar agent = instantiator.newInstance(JacocoAgentJar.class, project); JacocoPluginExtension extension = project .getExtensions() .create(PLUGIN_EXTENSION_NAME, JacocoPluginExtension.class, project, agent); final ReportingExtension reportingExtension = (ReportingExtension) project.getExtensions().getByName(ReportingExtension.NAME); ((IConventionAware) extension) .getConventionMapping() .map( "reportsDir", new Callable<File>() { @Override public File call() { return reportingExtension.file("jacoco"); } }); configureAgentDependencies(agent, extension); configureTaskClasspathDefaults(extension); applyToDefaultTasks(extension); configureDefaultOutputPathForJacocoMerge(); configureJacocoReportsDefaults(extension); addDefaultReportTasks(extension); }
protected ScriptHandler createScriptHandler() { ScriptHandlerFactory factory = new DefaultScriptHandlerFactory( get(DependencyManagementServices.class), get(FileResolver.class), get(DependencyMetaDataProvider.class)); return factory.create(project.getBuildScriptSource(), project.getClassLoaderScope(), project); }
public void projectsLoaded(Gradle gradle) { ProjectInternal projectInternal = (ProjectInternal) gradle.getRootProject(); logger.info( String.format( "Projects loaded. Root project using %s.", projectInternal.getBuildScriptSource().getDisplayName())); logger.info(String.format("Included projects: %s", projectInternal.getAllprojects())); }
@Override public void graphPopulated(TaskExecutionGraph graph) { Set<Project> seen = Sets.newHashSet(); for (Task task : graph.getAllTasks()) { if (seen.add(task.getProject())) { ProjectInternal projectInternal = (ProjectInternal) task.getProject(); projectInternal.bindAllModelRules(); } } }
public VisualStudioProjectConfiguration lookupProjectConfiguration( NativeBinarySpec nativeBinary) { // Looks in the correct project registry for this binary ProjectInternal componentProject = getComponentProject(nativeBinary); VisualStudioExtension visualStudioExtension = componentProject .getModelRegistry() .get(ModelPath.path("visualStudio"), ModelType.of(VisualStudioExtension.class)); VisualStudioProjectRegistry projectRegistry = ((VisualStudioExtensionInternal) visualStudioExtension).getProjectRegistry(); return projectRegistry.getProjectConfiguration(nativeBinary); }
@Override public void configureHierarchyFully(ProjectInternal project) { configureFully(project); for (Project sub : project.getSubprojects()) { configureFully((ProjectInternal) sub); } }
public void apply(ProjectInternal project) { project.getPluginManager().apply(BasePlugin.class); project.getPluginManager().apply(ReportingBasePlugin.class); project.getPluginManager().apply(LanguageBasePlugin.class); JavaPluginConvention javaConvention = new JavaPluginConvention(project, instantiator); project.getConvention().getPlugins().put("java", javaConvention); configureCompileDefaults(project, javaConvention); configureSourceSetDefaults(javaConvention); configureJavaDoc(project, javaConvention); configureTest(project, javaConvention); configureBuildNeeded(project); configureBuildDependents(project); }
@Override public void addConfiguration(Runnable runnable, boolean deferrable) { if (deferrable) { target.addDeferredConfiguration(runnable); } else { runnable.run(); } }
protected DefaultFileOperations createFileOperations() { return new DefaultFileOperations( get(FileResolver.class), project.getTasks(), get(TemporaryFileProvider.class), get(Instantiator.class), get(FileLookup.class)); }
private void addPropertiesToProject( Map<String, String> externalProperties, ProjectInternal project) { Properties projectProperties = new Properties(); File projectPropertiesFile = new File(project.getProjectDir(), Project.GRADLE_PROPERTIES); logger.debug("Looking for project properties from: {}", projectPropertiesFile); if (projectPropertiesFile.isFile()) { projectProperties = GUtil.loadProperties(projectPropertiesFile); logger.debug( "Adding project properties (if not overwritten by user properties): {}", projectProperties.keySet()); } else { logger.debug("project property file does not exists. We continue!"); } projectProperties.putAll(externalProperties); for (Object key : projectProperties.keySet()) { project.setProperty((String) key, projectProperties.get(key)); } }
public DefaultCppSourceSet(String name, ProjectInternal project) { this.name = name; this.exportedHeaders = new DefaultSourceDirectorySet("exported headers", project.getFileResolver()); this.source = new DefaultSourceDirectorySet("source", project.getFileResolver()); this.libs = new DefaultDomainObjectSet<NativeDependencySet>(NativeDependencySet.class); this.configurationDependencySet = new ConfigurationBasedNativeDependencySet(project, name); libs.add(configurationDependencySet); }
private Compiler<JavaCompileSpec> createTargetCompiler(CompileOptions options) { if (options.isFork() && options.getForkOptions().getExecutable() != null) { return new CommandLineJavaCompiler( createSerializableTempFileProvider(), project.getProjectDir()); } Compiler<JavaCompileSpec> compiler = inProcessCompilerFactory.create(options); if (options.isFork() && !jointCompilation) { return new DaemonJavaCompiler(project, compiler, compilerDaemonManager); } return compiler; }
public void configure(BuildExecutionContext context) { StartParameter startParameter = context.getGradle().getStartParameter(); for (TaskExecutionRequest request : startParameter.getTaskRequests()) { if (!request.getArgs().isEmpty()) { context.proceed(); return; } } // Gather the default tasks from this first group project ProjectInternal project = context.getGradle().getDefaultProject(); List<String> defaultTasks = project.getDefaultTasks(); if (defaultTasks.size() == 0) { defaultTasks = Arrays.asList(ImplicitTasksConfigurer.HELP_TASK); LOGGER.info("No tasks specified. Using default task {}", GUtil.toString(defaultTasks)); } else { LOGGER.info( "No tasks specified. Using project default tasks {}", GUtil.toString(defaultTasks)); } startParameter.setTaskNames(defaultTasks); context.proceed(); }
public TaskSelection getSelection(String path) { SetMultimap<String, Task> tasksByName; String baseName; String prefix; ProjectInternal project = gradle.getDefaultProject(); if (path.contains(Project.PATH_SEPARATOR)) { project = projectFinder.findProject(path, project); baseName = StringUtils.substringAfterLast(path, Project.PATH_SEPARATOR); prefix = project.getPath() + Project.PATH_SEPARATOR; tasksByName = taskNameResolver.select(baseName, project); } else { baseName = path; prefix = ""; tasksByName = taskNameResolver.selectAll(path, project); } Set<Task> tasks = tasksByName.get(baseName); if (!tasks.isEmpty()) { // An exact match return new TaskSelection(path, tasks); } NameMatcher matcher = new NameMatcher(); String actualName = matcher.find(baseName, tasksByName.keySet()); if (actualName != null) { // A partial match return new TaskSelection(prefix + actualName, tasksByName.get(actualName)); } throw new TaskSelectionException(matcher.formatErrorMessage("task", project)); }
private void addProjects( ProjectInternal parent, ProjectDescriptor parentProjectDescriptor, GradleInternal gradle, ClassLoaderScope buildRootClassLoaderScope) { for (ProjectDescriptor childProjectDescriptor : parentProjectDescriptor.getChildren()) { ProjectInternal childProject = projectFactory.createProject( childProjectDescriptor, parent, gradle, parent .getClassLoaderScope() .createChild("project-" + childProjectDescriptor.getName()), buildRootClassLoaderScope); addProjects(childProject, childProjectDescriptor, gradle, buildRootClassLoaderScope); } }
public void configure(ProjectInternal project) { if (cancellationToken.isCancellationRequested()) { throw new BuildCancelledException(); } project.evaluate(); }
public void apply(ProjectInternal project) { project.getPlugins().apply(NativeComponentModelPlugin.class); }
protected PluginRegistry createPluginRegistry(PluginRegistry parentRegistry) { return parentRegistry.createChild(project.getClassLoaderScope().createChild("plugins").lock()); }
protected FileResolver createFileResolver() { return new BaseDirFileResolver(get(FileSystem.class), project.getProjectDir()); }
@Override public void attachScript(Script script) { target.setScript(script); }
@Override public PluginManagerInternal getPluginManager() { return target.getPluginManager(); }
private TemporaryFileProvider createSerializableTempFileProvider() { return new DefaultTemporaryFileProvider(new FileFactory(project.getBuildDir())); }
public Object buildAll(Class<?> type, ProjectInternal project) { return buildProjectOutput(project.getRootProject(), null); }
private void discoverTasks(ProjectInternal project) { if (cancellationToken.isCancellationRequested()) { throw new BuildCancelledException(); } project.getTasks().discoverTasks(); }
public void configureHierarchy(ProjectInternal project) { configure(project); for (Project sub : project.getSubprojects()) { configure((ProjectInternal) sub); } }
private void bindAllModelRules(ProjectInternal project) { if (cancellationToken.isCancellationRequested()) { throw new BuildCancelledException(); } project.bindAllModelRules(); }