@Override public void execute(CopySpec copySpec) { copySpec.from(sourceDir); copySpec.include(getSoySrcIncludes()); copySpec.include(getSrcIncludes()); copySpec.into(workingDir); copySpec.setIncludeEmptyDirs(false); }
public CopySpec eachFile(Closure closure) { delegate.eachFile(closure); return this; }
@Override public Object call(Object... args) { CopySpec spec = (CopySpec)getDelegate(); // do filters for (String s : filters) { if (s.startsWith("!")) spec.exclude(s.substring(1)); else spec.include(s); } // expands if (!expands.isEmpty()) spec.expand(expands); if (!Strings.isNullOrEmpty(dir)) spec.into(dir); return null; } };
public CopySpec from(Object... input) { return root.from(input); } }
private void configureCopySpec( final CopySpec spec ) { spec.into( getDeployDir() ); spec.from( getFiles() ); spec.setIncludeEmptyDirs( false ); } }
@Override public void execute(Task task) { if (configuration.getFiles().size() != 1) { throw new IllegalArgumentException("Expected to find exactly one config dependency in the " + "'baseline' configuration, found: " + configuration.getFiles()); } rootProject.copy(copySpec -> { copySpec.from(rootProject.zipTree(configuration.getSingleFile())); copySpec.into(BaselineConfig.this.getConfigDir()); copySpec.exclude("**/scalastyle_config.xml"); copySpec.setIncludeEmptyDirs(false); }); if (rootProject .getAllprojects() .stream() .anyMatch(p -> p.getPluginManager().hasPlugin("scala") && p .getPluginManager() .hasPlugin("com.palantir.baseline-scalastyle"))) { // Matches intellij scala plugin settings per // https://github.com/JetBrains/intellij-scala/blob/baaa7c1dabe5222c4bca7c4dd8d80890ad2a8c6b/scala/scala-impl/src/org/jetbrains/plugins/scala/codeInspection/scalastyle/ScalastyleCodeInspection.scala#L19 rootProject.copy(copySpec -> { copySpec.from(rootProject .zipTree(configuration.getSingleFile()) .filter(file -> file.getName().equals("scalastyle_config.xml"))); copySpec.into(rootProject.getRootDir().toPath().resolve("project")); copySpec.setIncludeEmptyDirs(false); }); } } }
@Override public void execute(CopySpec copySpec) { copySpec.into("WEB-INF/classes"); } });
Action<? super CopySpec> action = (Action<CopySpec>) copySpec -> { File compressedFile = getDownloadedFile(); copySpec.setFileMode(755); if (isCompressed()) { if (compressedFile.getName().endsWith("zip")) { copySpec.from(project.zipTree(compressedFile)); } else { copySpec.from(project.tarTree(project.getResources().gzip(compressedFile))); copySpec.exclude("LICENSE"); copySpec.exclude("README.md"); copySpec.eachFile( details -> details.setPath(details.getPath().substring(details.getPath().indexOf('/') + 1))); copySpec.from(compressedFile, it -> it.setFileMode(755)); copySpec.into(unzippedDir); }; project.copy(action);
public Object doCall(CopySpec cs) { cs.from(project.zipTree(bundle)); cs.into(folderOut); cs.filesMatching("**/*.jar", new Action<FileCopyDetails>() { @Override public void execute(FileCopyDetails details) { /* * For each jar, check where it is. /classes.jar, /lint.jar and jars in * /libs are moved inside the FD_JARS directory. Jars inside /assets or * /res/raw are kept where they were. All other jars are ignored and a * warning is issued. */ String path = details.getRelativePath().getPathString(); if (path.equals("classes.jar") || path.equals("lint.jar") || path.startsWith("libs/")) { details.setRelativePath(new RelativePath(false, FD_JARS).plus( details.getRelativePath())); } else if (!path.startsWith("res/raw/*") && !path.startsWith("assets/*")) { project.getLogger().warn("Jar found at unexpected path (" + path + ") in " + bundle + " and will be ignored. Jars should be " + "placed inside 'jars' folder to be merged into dex. Jars " + "that are in assets/ or res/raw/ will be copied as-is."); } } }); return cs; } });
private Copy createGeneratedModelOrganizationTask(Project project, Task dependencyTask) { String generatedModelsOutputBaseDirPath = generatedModelsOutputDirBasePath.get(); String generatedModelsBasePackagePath = project.getBuildDir().getPath() + "/generated/source/rocky/src/com/shopify/rocky"; return project.getTasks().create("organizeGeneratedModels", Copy.class, (Copy task) -> { task.dependsOn(dependencyTask); task.from(generatedModelsOutputBaseDirPath + "/tmp/Enums", copySpec -> { copySpec.into("/enums"); copySpec.include("*.kt"); }); task.from(generatedModelsOutputBaseDirPath + "/tmp/Queries", copySpec -> { copySpec.into("/queries"); copySpec.include("*.kt"); }); task.from(generatedModelsOutputBaseDirPath + "/tmp/Inputs", copySpec -> { copySpec.into("/inputs"); copySpec.include("*.kt"); }); task.from(generatedModelsOutputBaseDirPath + "/tmp/Mutations", copySpec -> { copySpec.into("/mutations"); copySpec.include("*.kt"); }); task.from(generatedModelsOutputBaseDirPath + "/tmp/Responses", copySpec -> { copySpec.into("/responses"); copySpec.include("*.kt"); }); task.setIncludeEmptyDirs(true); task.into(generatedModelsBasePackagePath); task.execute(); }); }
protected void addVaultDefinition(File contentSrc) { this.exclude("META-INF/vault/definition/.content.xml"); this.exclude("META-INF/vault/properties.xml"); this.into("META-INF/vault", it -> { it.from(new File(contentSrc, "META-INF/vault/properties.xml")); it.expand(getProject().getProperties()); }); this.into("META-INF/vault/definition", it -> { it.from(new File(contentSrc, "META-INF/vault/definition/.content.xml")); it.expand(getProject().getProperties()); }); }
public CopySpec include(String... includes) { delegate.include(includes); return this; }