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

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

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

Project.relativePath介绍

暂无

代码示例

代码示例来源:origin: apollographql/apollo-android

return file.getAbsolutePath();
}).toSet(), new File(outputFolder.getAbsolutePath() + File.separator + task.getProject().relativePath(f.getParent()
))));

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

"-Xfriend-paths="
  + Paths.get("buck-out/gen")
    .resolve(getProject().getRootProject().relativePath(getProject().getProjectDir()))
    .resolve(String.format("lib__%s__output", composedTargetName))
    .resolve(composedTargetName + ".jar")

代码示例来源:origin: gradle.plugin.me.champeau.gradle/jmh-gradle-plugin

private void addOption(List<String> options, File f, String option) {
  if (f!=null) {
    options.add("-"+option);
    options.add(project.relativePath(f));
  }
}

代码示例来源:origin: commercehub-oss/gradle-avro-plugin

ProcessingState(Set<File> files, Project project) {
  for (File file : files) {
    filesToProcess.add(new FileState(file, project.relativePath(file)));
  }
}

代码示例来源:origin: com.android.tools.build/gradle-core

private void renderDirectorySet(String name, AndroidSourceDirectorySet java, Project project) {
  String relativePaths = java.getSrcDirs().stream()
      .map(file -> project.getRootProject().relativePath(file))
      .collect(Collectors.joining(", "));
  renderKeyValue(name + ": ", String.format("[%s]", relativePaths));
}

代码示例来源:origin: com.amazon.device.tools.build/gradle-core

private void renderDirectorySet(String name, AndroidSourceDirectorySet java, Project project) {
  List<String> relativePaths = Lists.newArrayList();
  for (File file : java.getSrcDirs()) {
    relativePaths.add(project.getRootProject().relativePath(file));
  }
  renderKeyValue(name + ": ",
      String.format("[%s]", CollectionUtils.join(", ", relativePaths)));
}

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

public String getReleaseNotesUrl(UpdateReleaseNotesTask task, String branch) {
    return task.getGitHubUrl() + "/" + task.getGitHubRepository() + "/blob/" + branch + "/" + task.getProject().relativePath(task.getReleaseNotesFile()).replace('\\', '/');
  }
}

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

public String getReleaseNotesUrl(UpdateReleaseNotesTask task, String branch) {
    return task.getGitHubUrl() + "/" + task.getGitHubRepository() + "/blob/" + branch + "/" + task.getProject().relativePath(task.getReleaseNotesFile()).replace('\\', '/');
  }
}

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

public void initTravis(InitTravisTask task) {
    String relativePath = task.getProject().getRootProject().relativePath(task.getOutputFile());
    if (task.getOutputFile().exists()) {
      InitMessages.skipping(relativePath);
      return;
    }
    InputStream resource = this.getClass().getClassLoader().getResourceAsStream("template.travis.yml");
    String template = IOUtil.readFully(resource);
    IOUtil.writeFile(task.getOutputFile(), template);
    InitMessages.generated(relativePath);
  }
}

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

public void initTravis(InitTravisTask task) {
    String relativePath = task.getProject().getRootProject().relativePath(task.getOutputFile());
    if (task.getOutputFile().exists()) {
      InitMessages.skipping(relativePath);
      return;
    }
    InputStream resource = this.getClass().getClassLoader().getResourceAsStream("template.travis.yml");
    String template = IOUtil.readFully(resource);
    IOUtil.writeFile(task.getOutputFile(), template);
    InitMessages.generated(relativePath);
  }
}

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

public void initVersioning(InitVersioningTask task) {
  File file = task.getVersionFile();
  if (file.exists()) {
    String relativePath = task.getProject().getRootProject().relativePath(file);
    InitMessages.skipping(relativePath);
  } else {
    createVersionPropertiesFile(task.getProject(), file);
  }
}

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

public void initVersioning(InitVersioningTask task) {
  File file = task.getVersionFile();
  if (file.exists()) {
    String relativePath = task.getProject().getRootProject().relativePath(file);
    InitMessages.skipping(relativePath);
  } else {
    createVersionPropertiesFile(task.getProject(), file);
  }
}

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

public void initShipkitFile(InitShipkitFileTask task) {
  File shipkitFile = task.getShipkitFile();
  String originRepoName = task.getOriginRepoName();
  String relativePath = task.getProject().getRootProject().relativePath(shipkitFile);
  initShipkitFile(shipkitFile, relativePath, originRepoName);
}

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

public void initShipkitFile(InitShipkitFileTask task) {
  File shipkitFile = task.getShipkitFile();
  String originRepoName = task.getOriginRepoName();
  String relativePath = task.getProject().getRootProject().relativePath(shipkitFile);
  initShipkitFile(shipkitFile, relativePath, originRepoName);
}

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

@TaskAction
  public void fetchContributors() {
    LOG.lifecycle("  Fetching all contributors for project");

    GitHubContributorsProvider contributorsProvider = Contributors.getGitHubContributorsProvider(apiUrl, repository, readOnlyAuthToken);
    ProjectContributorsSet contributors = contributorsProvider.getAllContributorsForProject();

    AllContributorsSerializer serializer = new AllContributorsSerializer();
    final String json = serializer.serialize(contributors);
    IOUtil.writeFile(outputFile, json);

    LOG.lifecycle("  Serialized all contributors into: {}", getProject().relativePath(outputFile));
  }
}

代码示例来源:origin: gradle.plugin.com.palantir.graal/gradle-graal

@Override
  public void execute(Task task) {
    getLogger().warn("native-image available at {} ({}MB)",
        getProject().relativePath(outputFile.get().getAsFile()),
        fileSizeMegabytes(outputFile.get()));
  }
}

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

/**
   * See {@link BumpVersionFileTask}
   */
  @TaskAction public VersionInfo bumpVersionFile() {
    VersionInfo versionInfo = Version.versionInfo(this.versionFile);
    VersionInfo newVersion = versionInfo.bumpVersion();
    //TODO add unit test for the message.
    // We already had a bug related to printing VersionInfo toString() instead of neat string version.
    LOG.lifecycle("{} - updated version file '{}'\n" +
        "  - new version: {}\n" +
        "  - previous version: {}\n",
        getPath(), getProject().relativePath(this.versionFile),
        newVersion.getVersion(),
        newVersion.getPreviousVersion());

    return newVersion;
  }
}

代码示例来源:origin: palantir/gradle-graal

@Override
  public void execute(Task task) {
    getLogger().warn("native-image available at {} ({}MB)",
        getProject().relativePath(outputFile.get().getAsFile()),
        fileSizeMegabytes(outputFile.get()));
  }
}

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

public void fetchContributors(FetchGitHubContributorsTask task) {
    LOG.lifecycle("  Fetching all GitHub contributors of {}", task.getRepository());
    ContributorsProvider contributorsProvider = Contributors.getGitHubContributorsProvider(
      task.getApiUrl(), task.getRepository(), task.getReadOnlyAuthToken(), task.getIgnoredContributors());

    ProjectContributorsSet contributors = contributorsProvider.getAllContributorsForProject();

    ProjectContributorsSerializer serializer = new ProjectContributorsSerializer();
    final String json = serializer.serialize(contributors);
    IOUtil.writeFile(task.getOutputs().getFiles().getSingleFile(), json);

    LOG.lifecycle("  Serialized contributors information: {}", task.getProject().relativePath(task.getOutputs().getFiles().getSingleFile()));
  }
}

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

public void fetchContributors(FetchGitHubContributorsTask task) {
    LOG.lifecycle("  Fetching all GitHub contributors of {}", task.getRepository());
    ContributorsProvider contributorsProvider = Contributors.getGitHubContributorsProvider(
      task.getApiUrl(), task.getRepository(), task.getReadOnlyAuthToken(), task.getIgnoredContributors());

    ProjectContributorsSet contributors = contributorsProvider.getAllContributorsForProject();

    ProjectContributorsSerializer serializer = new ProjectContributorsSerializer();
    final String json = serializer.serialize(contributors);
    IOUtil.writeFile(task.getOutputs().getFiles().getSingleFile(), json);

    LOG.lifecycle("  Serialized contributors information: {}", task.getProject().relativePath(task.getOutputs().getFiles().getSingleFile()));
  }
}

相关文章