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

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

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

Project.getProjectDir介绍

暂无

代码示例

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

public static ImmutableSet<String> available(Project project, Collection<File> files) {
 return files
   .stream()
   .filter(File::exists)
   .map(f -> getRelativePath(project.getProjectDir(), f))
   .collect(MoreCollectors.toImmutableSet());
}

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

private static String getTransformConfigRuleForFile(Project project, File config) {
  String relativeConfigPath =
    FileUtil.getRelativePath(project.getRootProject().getProjectDir(), config);
  ProjectUtil.getPlugin(project.getRootProject()).exportedPaths.add(relativeConfigPath);

  if (project.getProjectDir().equals(config.getParentFile())) {
   return ":" + config.getName();
  } else {
   String configTarget = BuckRuleComposer.fileRule(relativeConfigPath);
   Preconditions.checkNotNull(configTarget);
   return configTarget;
  }
 }
}

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

project ->
       rootBuckProject
         .getProjectDir()
         .toPath()
         .relativize(project.getProjectDir().toPath())
         .toString())
   .collect(MoreCollectors.toImmutableSet());
File exportedFile = rootBuckProject.file(exportedPath);
String containingPath =
  FileUtil.getRelativePath(rootBuckProject.getProjectDir(), exportedFile.getParentFile());
Set<Rule> rules = pathToRules.getOrDefault(containingPath, new HashSet<>());
rules.add(new ExportFile().name(exportedFile.getName()));

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

@Nullable
public String getConsumerProguardConfig() {
 Set<File> consumerProguardFiles =
   new ImmutableSet.Builder<File>()
     .addAll(getBaseVariant().getMergedFlavor().getConsumerProguardFiles())
     .addAll(getBaseVariant().getBuildType().getConsumerProguardFiles())
     .build();
 if (consumerProguardFiles.size() > 0) {
  Optional<File> optionalFile = consumerProguardFiles.stream().findFirst();
  return FileUtil.getRelativePath(getProject().getProjectDir(), optionalFile.get());
 }
 return null;
}

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

@TaskAction
void clean() throws IOException {
 Project rootProject = getProject();
 Path rootProjectPath = rootProject.getProjectDir().toPath();
         project
           .getRootProject()
           .getProjectDir()
           .toPath()
           .relativize(project.getProjectDir().toPath())
           .toString())
     .collect(MoreCollectors.toImmutableSet());

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

try {
 return FileUtil.getRelativePath(
   project.getProjectDir(), found.getSingleFile());
} catch (IllegalStateException ignored) {
 return null;

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

schemaFile = Paths.get(schemaFilePath).toFile();
if (!schemaFile.exists()) {
 schemaFile = Paths.get(task.getProject().getProjectDir().getAbsolutePath(), schemaFilePath).toFile();

代码示例来源: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: jooby-project/jooby

private void configureJoobyRun(final Project project) {
 project.getTasks()
   .withType(JoobyTask.class, joobyRun -> {
    ConventionMapping mapping = joobyRun.getConventionMapping();
    mapping.map("classpath", () -> new JoobyProject(project).classpath());
    mapping.map("src", () -> new JoobyProject(project).sources());
    mapping.map("mainClassName", () -> project.getProperties().get("mainClassName"));
    mapping.map("srcExtensions", () -> Arrays.asList(".java", ".conf", ".properties", ".kt"));
    mapping.map("compiler", () -> {
     File eclipseClasspath = new File(project.getProjectDir(), ".classpath");
     return eclipseClasspath.exists() ? "off" : "on";
    });
    Gradle gradle = project.getGradle();
    mapping.map("block", () -> !gradle.getStartParameter().isContinuous());
    mapping.map("logLevel", () -> gradle.getStartParameter().getLogLevel().name());
   });
 Map<String, Object> options = new HashMap<>();
 options.put(Task.TASK_TYPE, JoobyTask.class);
 options.put(Task.TASK_DEPENDS_ON, "classes");
 options.put(Task.TASK_NAME, "joobyRun");
 options.put(Task.TASK_DESCRIPTION, "Run, debug and hot reload applications");
 options.put(Task.TASK_GROUP, "jooby");
 project.getTasks().create(options);
}

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

@TaskAction
public void process() throws Throwable {
 Project project = getProject();
 JoobyProject joobyProject = new JoobyProject(project);
 String mainClass = getMainClassName();
 try (URLClassLoader loader = joobyProject.newClassLoader()) {
  getLogger().debug("Using classloader " + loader);
  Path srcdir = project.getProjectDir().toPath();
  Path bindir = joobyProject.classes().toPath();
  Path output = new ApiParser(srcdir)
    .with(loader)
    .export(bindir, mainClass);
  getLogger().info("API file: " + output);
 }
}

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

FileUtil.getRelativePath(project.getRootProject().getProjectDir(), configFile);
ProjectUtil.getPlugin(project.getRootProject()).exportedPaths.add(relativeConfigPath);

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

external.add(externalDependency);
} else {
 String rootProjectPath = project.getRootProject().getProjectDir().getAbsolutePath();
 String artifactPath = artifact.getFile().getAbsolutePath();
         + "outside the project can cause hard to reproduce builds"
         + ". Please move dependency: %s inside %s",
       artifact.getFile(), project.getRootProject().getProjectDir()));

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

@Nullable
private Keystore extractKeystore() {
 SigningConfig mergedConfig = getBaseVariant().getMergedFlavor().getSigningConfig();
 SigningConfig config =
   mergedConfig != null ? mergedConfig : getBaseVariant().getBuildType().getSigningConfig();
 if (config != null) {
  String keystoreFilePath =
    FileUtil.getRelativePath(getRootProject().getProjectDir(), config.getStoreFile());
  ProjectUtil.getPlugin(getProject()).exportedPaths.add(keystoreFilePath);
  return Keystore.create(
    keystoreFilePath,
    config.getStorePassword(),
    config.getKeyAlias(),
    config.getKeyPassword());
 }
 return null;
}

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

lintConfigPath =
   FileUtil.getRelativePath(
     target.getRootProject().getProjectDir(), target.getLintOptions().getLintConfig());
 ProjectUtil.getPlugin(target.getRootProject()).exportedPaths.add(lintConfigPath);
} else {

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

public FormatterStep createStep() {
  final Project project = getProject();
  return TsFmtFormatterStep.create(
      GradleProvisioner.fromProject(project),
      project.getBuildDir(),
      npmFileOrNull(),
      project.getProjectDir(),
      typedConfigFile(),
      config);
}

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

/** Sets up a format task according to the values in this extension. */
protected void setupTask(SpotlessTask task) {
  task.setPaddedCell(paddedCell);
  task.setEncoding(getEncoding().name());
  task.setExceptionPolicy(exceptionPolicy);
  task.setTarget(target);
  task.setSteps(steps);
  task.setLineEndingsPolicy(getLineEndings().createPolicy(getProject().getProjectDir(), () -> task.target));
}

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

File dir = getProject().getProjectDir();
List<String> excludes = new ArrayList<>();

代码示例来源:origin: org.gradle/gradle-core

private File getBuildCacheDir(Project rootProject) {
    if (projectCacheDir != null) {
      return projectCacheDir;
    }
    return new File(rootProject.getProjectDir(), ".gradle");
  }
}

代码示例来源:origin: purplejs/purplejs

private void configureAppPlugin()
  {
    final ApplicationPluginConvention convention = this.project.getConvention().findPlugin( ApplicationPluginConvention.class );
    convention.setMainClassName( "io.purplejs.boot.MainApp" );

    final JavaExec runTask = (JavaExec) this.project.getTasks().getByName( ApplicationPlugin.TASK_RUN_NAME );
    runTask.systemProperty( "io.purplejs.runMode", "dev" );

    final String devDirs = new File( this.project.getProjectDir(), "src/main/resources" ).getAbsolutePath();
    runTask.systemProperty( "io.purplejs.devSourceDirs", devDirs );
  }
}

代码示例来源:origin: linkedin/pygradle

public DefaultPythonDetails(Project project, File venvDir) {
  this.project = project;
  activateLink = new File(project.getProjectDir(), OperatingSystem.current().getScriptName("activate"));
  virtualEnvPrompt = String.format("(%s)", project.getName());
  searchPath = OperatingSystem.current().getPath();
  venvOverride = venvDir;
  this.virtualEnvironment = new DefaultVirtualEnvironment(this);
  pythonDefaultVersions = new PythonDefaultVersions();
}

相关文章