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

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

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

Project.getBuildDir介绍

暂无

代码示例

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

private void configureJoobyAssets(final Project project) {
 project.getTasks()
   .withType(AssetTask.class, task -> {
    ConventionMapping mapping = task.getConventionMapping();
    mapping.map("env", () -> "dist");
    mapping.map("maxAge", () -> "365d");
    mapping.map("mainClassName", () -> project.getProperties().get("mainClassName"));
    mapping.map("output", () -> new JoobyProject(project).classes());
    mapping.map("assemblyOutput", () -> new File(project.getBuildDir(), "__public_"));
   });
 Map<String, Object> options = new HashMap<>();
 options.put(Task.TASK_TYPE, AssetTask.class);
 options.put(Task.TASK_DEPENDS_ON, "classes");
 options.put(Task.TASK_NAME, "joobyAssets");
 options.put(Task.TASK_DESCRIPTION, "Process, optimize and compress static files");
 options.put(Task.TASK_GROUP, "jooby");
 project.getTasks().create(options);
}

代码示例来源:origin: linkedin/rest.li

File destinationDir = new File(project.getBuildDir(), taskName);
destinationDir.mkdirs();
File pathingJarPath = new File(destinationDir, project.getName() + "-pathing.jar");

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

/**
 * Returns the locally install apollo-codegen version as found in the package.json file.
 *
 * @return null if build/apollo-codegen/node_modules/apollo-codegen/package.json wasn't found, version otherwise
 */
private String getApolloVersion() {
 File packageFile = new File(getProject().getBuildDir(), INSTALL_DIR + "/package.json");
 if (!packageFile.isFile()) {
  return null;
 }
 Moshi moshi = new Moshi.Builder().build();
 JsonAdapter<PackageJson> adapter = moshi.adapter(PackageJson.class);
 try {
  PackageJson packageJson = adapter.fromJson(Okio.buffer(Okio.source(packageFile)));
  return packageJson.version;
 } catch (IOException e) {
  e.printStackTrace();
  return null;
 }
}
private boolean isSameApolloCodegenVersion(String packageVersion) {

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

public ApolloCodegenInstallTask() {
 // TODO: set to const when ApolloPlugin is in java
 setGroup("apollo");
 setDescription("Runs npm install for apollo-codegen");
 installDir = getProject().file(getProject().getBuildDir() + File.separator + INSTALL_DIR);
 File workingDir = new File(getProject().getBuildDir(), "apollo-codegen");
 setWorkingDir(workingDir);
 apolloPackageFile = getProject().file(workingDir + File.separator + "package.json");
 final boolean isSameCodegenVersion = isSameApolloCodegenVersion(getApolloVersion());
 if (!isSameCodegenVersion) {
  Utils.deleteDirectory(installDir);
 }
 getOutputs().upToDateWhen(new Spec<Task>() {
  public boolean isSatisfiedBy(Task element) {
   return apolloPackageFile.isFile() && isSameCodegenVersion;
  }
 });
}

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

private File getCacheFile() {
  return new File(getProject().getBuildDir(), getName());
}

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

private static File diagnoseDir(SpotlessTask task) {
  return new File(task.getProject().getBuildDir(), "spotless-diagnose-" + task.formatName());
}

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

FormatterStep createStep() {
    final Project project = getProject();
    return PrettierFormatterStep.create(
        GradleProvisioner.fromProject(project),
        project.getBuildDir(),
        npmFileOrNull(),
        new com.diffplug.spotless.npm.PrettierConfig(
            this.prettierConfigFile != null ? project.file(this.prettierConfigFile) : null,
            this.prettierConfig));
  }
}

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

relativizeIfSubdir(excludes, dir, getProject().getBuildDir());
for (Project subproject : getProject().getSubprojects()) {
  relativizeIfSubdir(excludes, dir, subproject.getBuildDir());

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

@Override
public File getVirtualEnv() {
  if (venvOverride == null) {
    return new File(project.getBuildDir(), "venv");
  } else {
    return venvOverride;
  }
}

代码示例来源:origin: michel-kraemer/gradle-download-task

/**
 * Creates a new download action
 * @param project the project to be built
 */
public DownloadAction(Project project) {
  this.project = project;
  this.downloadTaskDir = new File(project.getBuildDir(), "download-task");
}

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

public DeployableExtension(Project project) {
  deployableBuildDir = new File(project.getBuildDir(), "deployable");
  deployableBinDir = new File(deployableBuildDir, "bin");
  deployableEtcDir = new File(deployableBuildDir, "etc");
}

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

@Override
  public File call() throws Exception {
    String reportsDir = extension.getReportDir();
    if (reportsDir == null) {
      return new File(new File(project.getBuildDir(),  FD_REPORTS), FD_ANDROID_TESTS);
    } else {
      return project.file(reportsDir);
    }
  }
});

代码示例来源:origin: gradle.plugin.com.enonic.gradle/xp-gradle-plugin

@OutputDirectory
public File getOutputDir()
{
  return new File( getProject().getBuildDir(), "webjars" );
}

代码示例来源:origin: gradle.plugin.com.enonic.gradle/xp-gradle-plugin

public AppExtension( final Project project )
{
  this.project = project;
  this.instructions = new HashMap<>();
  this.devSourcePaths = new ArrayList<>();
  addDevSourcePath( this.project.getProjectDir(), "src", "main", "resources" );
  addDevSourcePath( this.project.getBuildDir(), "resources", "main" );
  this.rawDevSourcePaths = new ArrayList<>();
  this.systemApp = false;
  this.capabilities = new HashSet<>();
}

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

@Override
@Nullable
public File getCacheDir(boolean create) {
  File dir = new File(gradleProject.getRootProject().getBuildDir(),
      FD_INTERMEDIATES + separator + "lint-cache"); //$NON-NLS-1$
  if (dir.exists() || create && dir.mkdirs()) {
    return dir;
  }
  return super.getCacheDir(create);
}

代码示例来源:origin: gradle.plugin.com.enonic.gradle/xp-gradle-plugin

private File resolveHomeDir()
{
  final File file = this.homeDir.getOrNull();
  return file != null ? file : getProject().getBuildDir();
}

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

public TransformationTask() {
 // empty classpath
 this.classpath = this.getProject().files();
 this.destinationDir = Paths.get(this.getProject().getBuildDir().toString(), "transformations", this.getName()).toFile();
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

@OutputFile
public File getSourceDigestFile() {
  Project project = getProject();
  String pathname =
    "npm/" + getNpmCommand() + "/" + getName() + "/.digest";
  return new File(project.getBuildDir(), pathname);
}

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

@TaskAction
public void cloneRepository() {
  if (!isTargetEmpty()) {
    LOG.lifecycle("{} - target directory already exists and is not empty. Skipping execution of the task. Exists: {}", getPath(), targetDir);
    return;
  }
  LOG.lifecycle("  Cloning repository {}\n    into {}", repositoryUrl, targetDir);
  getProject().getBuildDir().mkdirs();    // build dir can be not created yet
  ProcessRunner processRunner = Exec.getProcessRunner(getProject().getBuildDir());
  processRunner.run(getCloneCommand());
}

相关文章