org.gradle.api.Project.getRootDir()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中org.gradle.api.Project.getRootDir()方法的一些代码示例,展示了Project.getRootDir()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getRootDir()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:getRootDir

Project.getRootDir介绍

暂无

代码示例

代码示例来源:origin: uber/okbuck

@Nullable
public String getProguardMapping() {
 if (!minifyEnabled || proguardMappingFile == null || !proguardMappingFile.exists()) {
  return null;
 }
 return FileUtil.getRelativePath(getProject().getRootDir(), proguardMappingFile);
}

代码示例来源:origin: uber/okbuck

@Nullable
public String getProguardConfig() {
 if (minifyEnabled) {
  Set<File> proguardFiles =
    new ImmutableSet.Builder<File>()
      .addAll(getBaseVariant().getMergedFlavor().getProguardFiles())
      .addAll(getBaseVariant().getBuildType().getProguardFiles())
      .build();
  Preconditions.checkArgument(
    proguardFiles.size() == 1,
    "%s proguard files found. Only one can be used.",
    proguardFiles.size());
  File proguardFile = proguardFiles.iterator().next();
  Preconditions.checkArgument(
    proguardFile.exists(), "Proguard file %s does not exist", proguardFile);
  return FileUtil.getRelativePath(getProject().getRootDir(), proguardFile);
 }
 return null;
}

代码示例来源:origin: uber/okbuck

private void processDependencies(
  Map<VersionlessDependency, Collection<ExternalDependency>> dependencyMap) {
 Path rootPath = project.getRootDir().toPath();
 File cacheDir = rootPath.resolve(externalDependenciesExtension.getCache()).toFile();
 if (cacheDir.exists()) {

代码示例来源:origin: uber/okbuck

rootBuckProject.getRootDir().toPath().resolve(entry.getKey()).resolve(BUCK).toFile();
try (OutputStream os =
  new FileOutputStream(buckFile, currentProjectPaths.contains(entry.getKey()))) {

代码示例来源:origin: jooby-project/jooby

.forProjectDirectory(project.getRootDir())
.connect();

代码示例来源:origin: diffplug/spotless

static GradleException youShouldTurnOnPaddedCell(SpotlessTask task) {
  Path rootPath = task.getProject().getRootDir().toPath();
  return new GradleException(StringPrinter.buildStringFromLines(
      "You have a misbehaving rule which can't make up its mind.",
      "This means that spotlessCheck will fail even after spotlessApply has run.",
      "",
      "This is a bug in a formatting rule, not Spotless itself, but Spotless can",
      "work around this bug and generate helpful bug reports for the broken rule",
      "if you add 'paddedCell()' to your build.gradle as such: ",
      "",
      "    spotless {",
      "        format 'someFormat', {",
      "            ...",
      "            paddedCell()",
      "        }",
      "    }",
      "",
      "The next time you run spotlessCheck, it will put helpful bug reports into",
      "'" + rootPath.relativize(diagnoseDir(task).toPath()) + "', and spotlessApply",
      "and spotlessCheck will be self-consistent from here on out.",
      "",
      "For details see " + URL));
}

代码示例来源:origin: diffplug/spotless

@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
  static void check(SpotlessTask task, Formatter formatter, List<File> problemFiles) throws IOException {
    if (problemFiles.isEmpty()) {
      // if the first pass was successful, then paddedCell() mode is unnecessary
      task.getLogger().info(StringPrinter.buildStringFromLines(
          task.getName() + " is in paddedCell() mode, but it doesn't need to be.",
          "If you remove that option, spotless will run ~2x faster.",
          "For details see " + URL));
    }

    File diagnoseDir = diagnoseDir(task);
    File rootDir = task.getProject().getRootDir();
    List<File> stillFailing = PaddedCellBulk.check(rootDir, diagnoseDir, formatter, problemFiles);
    if (!stillFailing.isEmpty()) {
      throw task.formatViolationsFor(formatter, problemFiles);
    }
  }
}

代码示例来源:origin: diffplug/spotless

.lineEndingsPolicy(lineEndingsPolicy)
.encoding(Charset.forName(encoding))
.rootDir(getProject().getRootDir().toPath())
.steps(steps)
.exceptionPolicy(exceptionPolicy)

代码示例来源:origin: gradle.plugin.me.taku_k.gradle.yarn/gradle-yarn-plugin

public String getBinPath() {
  if ("".equals(version)) {
    return "yarn";
  }
  return format("%s/.gradle/%s/yarn-%s.js", project.getRootDir(), workingDir, version);
}

代码示例来源:origin: com.github.rodm/gradle-teamcity-dsl-plugin

private String formatPath(File dir) {
  Path root = Paths.get(getProject().getRootDir().toURI());
  Path path = Paths.get(dir.toURI());
  if (path.startsWith(root)) {
    return root.relativize(path).toString();
  } else {
    return path.toAbsolutePath().toString();
  }
}

代码示例来源:origin: gradle.plugin.org.shipkit/shipkit

public void execute(InitTravisTask t) {
    t.setDescription("Creates '.travis.yml' file if not already present.");
    t.setOutputFile(new File(project.getRootDir(), ".travis.yml"));
  }
});

代码示例来源:origin: mockito/shipkit

public void execute(InitTravisTask t) {
    t.setDescription("Creates '.travis.yml' file if not already present.");
    t.setOutputFile(new File(project.getRootDir(), ".travis.yml"));
  }
});

代码示例来源:origin: gradle.plugin.us.ihmc.continuousIntegration/ihmc-continuous-integration-gradle-plugin

@Override
public void apply(Project project)
{
 projectPath = project.getProjectDir().toPath();
 multiProjectPath = project.getRootDir().toPath().resolve("..");
 
 createTask(project, "generateTestSuitesStandalone");
 createTask(project, "generateTestSuitesMultiProject");
}

代码示例来源:origin: gradle.plugin.us.ihmc.continuousIntegration/IHMCContinuousIntegrationGradlePlugin

@Override
public void apply(Project project)
{
 projectPath = project.getProjectDir().toPath();
 multiProjectPath = project.getRootDir().toPath().resolve("..");
 
 createTask(project, "generateTestSuitesStandalone");
 createTask(project, "generateTestSuitesMultiProject");
}

代码示例来源:origin: com.github.rodm/gradle-teamcity-dsl-plugin

@NotNull
private TeamCityDSLExtension createExtension(Project project) {
  TeamCityDSLExtension extension = project.getExtensions().create(EXTENSION_NAME, TeamCityDSLExtension.class);
  extension.setTeamcityVersion(DEFAULT_TEAMCITY_VERSION);
  extension.setFormat(DEFAULT_FORMAT);
  extension.setBaseDir(new File(project.getRootDir(), DEFAULT_BASE_DIR));
  extension.setDestDir(new File(project.getBuildDir(), DEFAULT_DEST_DIR));
  return extension;
}

代码示例来源:origin: org.shipkit/shipkit

public void execute(InitTravisTask t) {
    t.setDescription("Creates '.travis.yml' file if not already present.");
    t.setOutputFile(new File(project.getRootDir(), ".travis.yml"));
  }
});

代码示例来源:origin: gradle.plugin.net.orekyuu/library-version-updater

private List<DependencyUpdate> loadDependencyReport() {
  Path path = Paths.get(getProject().getRootDir().getAbsolutePath(), "build", "dependencyUpdates", "report.json");
  Object dependencyUpdatesJson = new JsonSlurper().parse(path.toFile());
  return getOutDatedDependencies(dependencyUpdatesJson);
}

代码示例来源:origin: gradle.plugin.com.xiaoquan.gradle.plugin/support-plugin

private void createWebProject(Project project) {
  Task createWebDir = project.getTasks().create("createWebDir");
  createWebDir.dependsOn(":createJavaDir");
  createWebDir.setGroup(Task_Group_Nuke);
  createWebDir.getActions().add(task -> {
    WarPluginConvention warPluginConvention = new WarPluginConvention(project);
    File file = new File(project.getRootDir(), warPluginConvention.getWebAppDirName());
    createIfNotExist(file);
  });
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-change-log-builder

public BuildChangeLogTask() {
  Project project = getProject();
  setGitDir(project.getRootDir());
  setTicketIdPrefixes("CLDSVCS", "LPS", "SOS", "SYNC");
}

代码示例来源:origin: com.darylteo.gradle/gradle-watcher

public synchronized ProjectConnection getConnection() {
 if (connection == null) {
  this.connection = GradleConnector.newConnector().forProjectDirectory(this.project.getRootDir()).connect();
 }
 return this.connection;
}

相关文章