コード例 #1
0
  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);
  }
コード例 #2
0
ファイル: JacocoPlugin.java プロジェクト: Cazen/gradle
  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);
  }
コード例 #3
0
 protected ScriptHandler createScriptHandler() {
   ScriptHandlerFactory factory =
       new DefaultScriptHandlerFactory(
           get(DependencyManagementServices.class),
           get(FileResolver.class),
           get(DependencyMetaDataProvider.class));
   return factory.create(project.getBuildScriptSource(), project.getClassLoaderScope(), project);
 }
コード例 #4
0
ファイル: BuildLogger.java プロジェクト: gmercer/gradle
 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()));
 }
コード例 #5
0
 @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();
     }
   }
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 @Override
 public void configureHierarchyFully(ProjectInternal project) {
   configureFully(project);
   for (Project sub : project.getSubprojects()) {
     configureFully((ProjectInternal) sub);
   }
 }
コード例 #8
0
  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);
  }
コード例 #9
0
 @Override
 public void addConfiguration(Runnable runnable, boolean deferrable) {
   if (deferrable) {
     target.addDeferredConfiguration(runnable);
   } else {
     runnable.run();
   }
 }
コード例 #10
0
 protected DefaultFileOperations createFileOperations() {
   return new DefaultFileOperations(
       get(FileResolver.class),
       project.getTasks(),
       get(TemporaryFileProvider.class),
       get(Instantiator.class),
       get(FileLookup.class));
 }
コード例 #11
0
ファイル: BuildLoader.java プロジェクト: ncurzon/gradle
 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));
   }
 }
コード例 #12
0
  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);
  }
コード例 #13
0
  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;
  }
コード例 #14
0
  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();
  }
コード例 #15
0
ファイル: TaskSelector.java プロジェクト: Ashoka107/s4-class1
  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));
  }
コード例 #16
0
 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);
   }
 }
コード例 #17
0
 public void configure(ProjectInternal project) {
   if (cancellationToken.isCancellationRequested()) {
     throw new BuildCancelledException();
   }
   project.evaluate();
 }
コード例 #18
0
ファイル: VisualStudioPlugin.java プロジェクト: k3mist/gradle
 public void apply(ProjectInternal project) {
   project.getPlugins().apply(NativeComponentModelPlugin.class);
 }
コード例 #19
0
 protected PluginRegistry createPluginRegistry(PluginRegistry parentRegistry) {
   return parentRegistry.createChild(project.getClassLoaderScope().createChild("plugins").lock());
 }
コード例 #20
0
 protected FileResolver createFileResolver() {
   return new BaseDirFileResolver(get(FileSystem.class), project.getProjectDir());
 }
コード例 #21
0
 @Override
 public void attachScript(Script script) {
   target.setScript(script);
 }
コード例 #22
0
 @Override
 public PluginManagerInternal getPluginManager() {
   return target.getPluginManager();
 }
コード例 #23
0
 private TemporaryFileProvider createSerializableTempFileProvider() {
   return new DefaultTemporaryFileProvider(new FileFactory(project.getBuildDir()));
 }
コード例 #24
0
 public Object buildAll(Class<?> type, ProjectInternal project) {
   return buildProjectOutput(project.getRootProject(), null);
 }
コード例 #25
0
 private void discoverTasks(ProjectInternal project) {
   if (cancellationToken.isCancellationRequested()) {
     throw new BuildCancelledException();
   }
   project.getTasks().discoverTasks();
 }
コード例 #26
0
 public void configureHierarchy(ProjectInternal project) {
   configure(project);
   for (Project sub : project.getSubprojects()) {
     configure((ProjectInternal) sub);
   }
 }
コード例 #27
0
 private void bindAllModelRules(ProjectInternal project) {
   if (cancellationToken.isCancellationRequested()) {
     throw new BuildCancelledException();
   }
   project.bindAllModelRules();
 }