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

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

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

Project.delete介绍

暂无

代码示例

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

@Override
public void execute(Task task) {
  Project project = task.getProject();
  project.delete(destinationDir);
}

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

@Override
public void execute(Task task) {
  NpmRunTask npmRunTask = (NpmRunTask)task;
  String result = npmRunTask.getResult();
  if (result.contains("errors during Soy compilation")) {
    project.delete(npmRunTask.getSourceDigestFile());
    throw new GradleException("Soy compile error");
  }
}

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

@Override
public void execute(Task task) {
  NpmRunTask npmRunTask = (NpmRunTask)task;
  String result = npmRunTask.getResult();
  if (result.contains("errors during Soy compilation")) {
    project.delete(npmRunTask.getSourceDigestFile());
    throw new GradleException("Soy compile error");
  }
}

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

@Override
  public void execute(InputFileDetails inputFileDetails) {
    File input = inputFileDetails.getFile();
    if (input.isDirectory()) {
      return;
    }
    getProject().delete(outputFileFor(input));
  }
});

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-js-transpiler

@Override
public void execute(Task task) {
  Copy copy = (Copy)task;
  Project project = copy.getProject();
  project.delete(copy.getDestinationDir());
}

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

@Override
public void execute(Task task) {
  ProcessResources processResourcesTask =
    (ProcessResources)task;
  final File processResourcesDir =
    processResourcesTask.getDestinationDir();
  final File npmRunBuildOutputsDir = new File(
    sourceDigestFile.getParentFile(), "outputs");
  project.delete(npmRunBuildOutputsDir);
  npmRunBuildOutputsDir.mkdirs();
  project.copy(
    new Action<CopySpec>() {
      @Override
      public void execute(CopySpec copySpec) {
        copySpec.from(processResourcesDir);
        copySpec.include("**/*.js");
        copySpec.into(npmRunBuildOutputsDir);
        copySpec.setIncludeEmptyDirs(false);
      }
    });
}

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

@Override
public void execute(Task task) {
  ProcessResources processResourcesTask =
    (ProcessResources)task;
  final File processResourcesDir =
    processResourcesTask.getDestinationDir();
  final File npmRunBuildOutputsDir = new File(
    sourceDigestFile.getParentFile(), "outputs");
  project.delete(npmRunBuildOutputsDir);
  npmRunBuildOutputsDir.mkdirs();
  project.copy(
    new Action<CopySpec>() {
      @Override
      public void execute(CopySpec copySpec) {
        copySpec.from(processResourcesDir);
        copySpec.include("**/*.js");
        copySpec.into(npmRunBuildOutputsDir);
        copySpec.setIncludeEmptyDirs(false);
      }
    });
}

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

@Override
  public void execute(Task task) {
    if (miniconda.getBuildEnvironmentDirectory().exists()) {
      getProject().delete(miniconda.getBuildEnvironmentDirectory());
      LOG.debug("Deleted BuildEnvironmentDir dir: {}", miniconda.getBuildEnvironmentDirectory());
    }
  }
});

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

@Override
  public void execute(Task task) {
    if (!miniconda.getBootstrapDirectoryPrefix().mkdirs()) {
      getProject().delete(miniconda.getBootstrapDirectory());
      LOG.debug("Deleted BootstrapPython dir: {}", miniconda.getBootstrapDirectory());
    }
  }
});

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

@TaskAction
public void action()
{
  getProject().delete( getInstallDir() );
  getProject().copy( this::configureCopySpec );
}

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

@TaskAction
public void action()
{
  getProject().delete( getInstallDir() );
  getProject().copy( this::configureCopySpec );
}

代码示例来源:origin: com.google.cloud.tools/appengine-gradle-plugin

/** Task entrypoint : Stage the flexible application. */
 @TaskAction
 public void stageAction() throws AppEngineException {
  getProject().delete(stagingConfig.getStagingDirectory());
  getProject().mkdir(stagingConfig.getStagingDirectory().getAbsolutePath());

  AppEngineFlexibleStaging staging = new CloudSdkAppEngineFlexibleStaging();
  staging.stageFlexible(stagingConfig);
 }
}

代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin

/** Task entrypoint : Stage the app.yaml based application. */
 @TaskAction
 public void stageAction() throws AppEngineException {
  getProject().delete(appYamlExtension.getStagingDirectory());
  getProject().mkdir(appYamlExtension.getStagingDirectory().getAbsolutePath());

  AppYamlProjectStaging staging = new AppYamlProjectStaging();
  staging.stageArchive(appYamlExtension.toAppYamlProjectStageConfiguration());
 }
}

代码示例来源:origin: gradle.plugin.edu.wpi.first/gradle-jni

@Validate
 void createJniTasks(ComponentSpecContainer components, ProjectLayout projectLayout) {
  Project project = (Project) projectLayout.getProjectIdentifier();
  for (ComponentSpec oComponent : components) {
   if (oComponent instanceof JniNativeLibrarySpec) {
    JniNativeLibrarySpec component = (JniNativeLibrarySpec) oComponent;

    assert !component.getJavaCompileTasks().isEmpty();

    for (JavaCompile compileTask : component.getJavaCompileTasks()) {
     String jniHeaderLocation = project.getBuildDir().toString() + "/jniinclude/" + compileTask.getName();
     compileTask.getOutputs().dir(jniHeaderLocation);
     component.getJniHeaderLocations().put(compileTask, jniHeaderLocation);
     List<String> args = compileTask.getOptions().getCompilerArgs();
     args.add("-h");
     args.add(jniHeaderLocation);
     compileTask.doFirst(t -> {
      project.delete(jniHeaderLocation);
     });
    }
   }
  }
 }
}

代码示例来源:origin: com.google.cloud.tools/appengine-gradle-plugin

/** Task entrypoint : stage the standard app. */
 @TaskAction
 public void stageAction() throws AppEngineException {
  getProject().delete(stagingConfig.getStagingDirectory());

  CloudSdk sdk = cloudSdkBuilderFactory.newBuilder(getLogger()).build();
  CloudSdkAppEngineStandardStaging staging = new CloudSdkAppEngineStandardStaging(sdk);
  staging.stageStandard(stagingConfig);
 }
}

代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin

/** Task entrypoint : stage the standard app. */
 @TaskAction
 public void stageAction() throws AppEngineException {
  getProject().delete(stageStandardExtension.getStagingDirectory());
  appCfg
    .newStaging(CloudSdkOperations.getDefaultHandler(getLogger()))
    .stageStandard(stageStandardExtension.toStageStandardConfiguration());
 }
}

代码示例来源:origin: gradle.plugin.net.karlmartens.dotnet/dotnet-plugin

@TaskAction
void exec() {
  DotnetExtension ext = getExtension();
  getProject().exec(execSpec -> {
    execSpec.setExecutable(ext.getExecutable());
    List<String> args = new ArrayList<>();
    args.add("clean");
    whenHasValue(ext.getSolution(), args::add);
    whenHasValue(ext.getConfiguration(), addNamedParameter(args, "--configuration"));
    whenHasValue(ext.getFramework(), addNamedParameter(args, "--framework"));
    whenHasValue(ext.getRuntime(), addNamedParameter(args, "--runtime"));
    execSpec.setArgs(args);
  });
  cleanPackages();
  getProject().delete(getProject().getProjectDir().toPath().resolve("TestResults"));
  getProject().delete(getProject().getBuildDir());
}

代码示例来源:origin: gradle-clojure/gradle-clojure

private void start() {
 if (!getProject().delete(getTemporaryDir())) {
  throw new GradleException("Cannot clean temporary directory: " + getTemporaryDir().getAbsolutePath());
 }
 FileCollection cp = getProject().files(getTemporaryDir(), getClasspath());
 List<String> middleware = Stream.of(defaultMiddleware.getOrElse(Collections.emptyList()), userMiddleware.getOrElse(Collections.emptyList()))
   .flatMap(List::stream)
   .collect(Collectors.toList());
 clojureExecutor.exec(spec -> {
  spec.setClasspath(cp);
  spec.setMain("gradle-clojure.tools.clojure-nrepl");
  spec.setArgs(port, controlPort, handler.getOrNull(), middleware, Edn.keywordize(contextData));
  spec.forkOptions(fork -> {
   fork.setJvmArgs(getForkOptions().getJvmArgs());
   fork.setMinHeapSize(getForkOptions().getMemoryInitialSize());
   fork.setMaxHeapSize(getForkOptions().getMemoryMaximumSize());
   fork.setDefaultCharacterEncoding(StandardCharsets.UTF_8.name());
  });
 });
}

代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin

private void start() {
 if (!getProject().delete(getTemporaryDir())) {
  throw new GradleException("Cannot clean temporary directory: " + getTemporaryDir().getAbsolutePath());
 }
 FileCollection cp = getProject().files(getTemporaryDir(), getClasspath());
 List<String> middleware = Stream.of(defaultMiddleware.getOrElse(Collections.emptyList()), userMiddleware.getOrElse(Collections.emptyList()))
   .flatMap(List::stream)
   .collect(Collectors.toList());
 clojureExecutor.exec(spec -> {
  spec.setClasspath(cp);
  spec.setMain("gradle-clojure.tools.clojure-nrepl");
  spec.setArgs(port, controlPort, handler.getOrNull(), middleware, Edn.keywordize(contextData));
  spec.forkOptions(fork -> {
   fork.setJvmArgs(getForkOptions().getJvmArgs());
   fork.setMinHeapSize(getForkOptions().getMemoryInitialSize());
   fork.setMaxHeapSize(getForkOptions().getMemoryMaximumSize());
   fork.setDefaultCharacterEncoding(StandardCharsets.UTF_8.name());
  });
 });
}

代码示例来源:origin: stephanenicolas/ormlite-android-gradle-plugin

@TaskAction
protected void exec(IncrementalTaskInputs inputs) throws IOException, SQLException, InterruptedException {
  if (!inputs.isIncremental()) {
    getProject().delete(getOutputFile());
  }
  final Set<String> lastFilesInState = loadFileNames();
  final Set<String> newFilesInState = new HashSet<>(lastFilesInState);
  if (!hasNewState(inputs, lastFilesInState, newFilesInState)) {
    return;
  }
  saveFileNames(newFilesInState);
  final CreateOrmLiteConfigAction createOrmLiteConfigAction
      = new CreateOrmLiteConfigAction(configFileName,
                      getProject().file(sourceDir),
                      classpath.getAsPath(), getLogger());
  createOrmLiteConfigAction.execute();
  this.setDidWork(true);
}

相关文章