private DefaultGradleProject<LaunchableGradleTask> buildHierarchy(Project project) {
    List<DefaultGradleProject<LaunchableGradleTask>> children =
        new ArrayList<DefaultGradleProject<LaunchableGradleTask>>();
    for (Project child : project.getChildProjects().values()) {
      children.add(buildHierarchy(child));
    }

    DefaultGradleProject<LaunchableGradleTask> gradleProject =
        new DefaultGradleProject<LaunchableGradleTask>()
            .setPath(project.getPath())
            .setName(project.getName())
            .setDescription(project.getDescription())
            .setBuildDirectory(project.getBuildDir())
            .setProjectDirectory(project.getProjectDir())
            .setChildren(children);

    gradleProject.getBuildScript().setSourceFile(project.getBuildFile());
    gradleProject.setTasks(tasks(gradleProject, (TaskContainerInternal) project.getTasks()));

    for (DefaultGradleProject child : children) {
      child.setParent(gradleProject);
    }

    return gradleProject;
  }
  private void addPropertiesToProject(Project 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!");
    }

    Map<String, String> mergedProperties =
        propertiesLoader.mergeProperties(new HashMap(projectProperties));
    ExtraPropertiesExtension extraProperties =
        new DslObject(project).getExtensions().getExtraProperties();
    for (Map.Entry<String, String> entry : mergedProperties.entrySet()) {
      if (project.hasProperty(entry.getKey())) {
        project.setProperty(entry.getKey(), entry.getValue());
      } else {
        extraProperties.set(entry.getKey(), entry.getValue());
      }
    }
  }
예제 #3
0
  private void configureTestDefaults(
      final Test test, Project project, final JavaPluginConvention convention) {
    DslObject htmlReport = new DslObject(test.getReports().getHtml());
    DslObject xmlReport = new DslObject(test.getReports().getJunitXml());

    xmlReport
        .getConventionMapping()
        .map(
            "destination",
            new Callable<Object>() {
              public Object call() throws Exception {
                return convention.getTestResultsDir();
              }
            });
    htmlReport
        .getConventionMapping()
        .map(
            "destination",
            new Callable<Object>() {
              public Object call() throws Exception {
                return convention.getTestReportDir();
              }
            });
    test.getConventionMapping()
        .map(
            "binResultsDir",
            new Callable<Object>() {
              public Object call() throws Exception {
                return new File(
                    convention.getTestResultsDir(), String.format("binary/%s", test.getName()));
              }
            });
    test.workingDir(project.getProjectDir());
  }
 private String getId(PublishArtifact artifact, Project project) {
   // Assume that each artifact points to a unique file, and use the relative path from the project
   // as the id
   URI artifactUri = artifact.getFile().toURI();
   URI projectDirUri = project.getProjectDir().toURI();
   URI relativeUri = projectDirUri.relativize(artifactUri);
   return relativeUri.getPath();
 }
  @Override
  public void executeNode() throws Exception {
    Project project = getProject();

    if (FileUtil.isChild(getCacheDir(), project.getProjectDir())) {
      super.executeNode();
    } else {
      synchronized (ExecuteNpmTask.class) {
        super.executeNode();
      }
    }
  }
 private DefaultProjectOutcomes buildProjectOutput(Project project, ProjectOutcomes parent) {
   DefaultProjectOutcomes projectOutput =
       new DefaultProjectOutcomes(
           project.getName(),
           project.getPath(),
           project.getDescription(),
           project.getProjectDir(),
           getFileOutcomes(project),
           parent);
   for (Project child : project.getChildProjects().values()) {
     projectOutput.addChild(buildProjectOutput(child, projectOutput));
   }
   return projectOutput;
 }
예제 #7
0
 private void configureTestDefaults(
     Test test, Project project, final JavaPluginConvention convention) {
   test.getConventionMapping()
       .map(
           "testResultsDir",
           new Callable<Object>() {
             public Object call() throws Exception {
               return convention.getTestResultsDir();
             }
           });
   test.getConventionMapping()
       .map(
           "testReportDir",
           new Callable<Object>() {
             public Object call() throws Exception {
               return convention.getTestReportDir();
             }
           });
   test.workingDir(project.getProjectDir());
 }