public DuplicatesStrategy getDuplicatesStrategy() { return this.duplicatesStrategy; }
public DuplicatesStrategy getDuplicatesStrategy() { if (duplicatesStrategy != null) { return duplicatesStrategy; } if (parentResolver != null) { return parentResolver.getDuplicatesStrategy(); } return DuplicatesStrategy.INCLUDE; }
public WorkResult execute(final CopyActionProcessingStream stream) { final Set<RelativePath> visitedFiles = new HashSet<RelativePath>(); return delegate.execute(new CopyActionProcessingStream() { public void process(final CopyActionProcessingStreamAction action) { stream.process(new CopyActionProcessingStreamAction() { public void processFile(FileCopyDetailsInternal details) { if (!details.isDirectory()) { DuplicatesStrategy strategy = details.getDuplicatesStrategy(); if (!visitedFiles.add(details.getRelativePath())) { if (strategy == DuplicatesStrategy.EXCLUDE) { return; } else if (strategy == DuplicatesStrategy.FAIL) { throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath())); } else if (strategy == DuplicatesStrategy.WARN) { LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath()); } } } action.processFile(details); } }); } }); }
public WarOverlay(String name, War warTask) { this.name = name; this.warTask = warTask; this.warCopySpec = warTask.getRootSpec().addChild(); warCopySpec.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE); exclude("META-INF/maven/**"); exclude("META-INF/MANIFEST.MF"); }
public DuplicatesStrategy getDuplicatesStrategy() { throw new UnsupportedOperationException(); }
/** * Searches the project for the META-INF folder and configures it in the jar task. * Using an Action to run after all build.gradle sourceSets are processed. */ private void configureJarMetaInfCopy(final Project project) { project.getTasks().findByName("jar") .doFirst(new Action<Task>() { @Override public void execute(Task task) { Jar jarTask = (Jar)task; SourceSet mainSourceSet = DependenciesUtil.getMainSourceSet(project); Set<File> files = mainSourceSet.getAllSource().getFiles(); boolean metaInfFound = false; boolean manifestFound = false; for (File file : files) { String path = file.getPath(); if (!metaInfFound && path.contains(META_INF)) { metaInfFound = true; String metaInfPath = getMetaInfFolderInPath(path); jarTask.getMetaInf().from(metaInfPath) //jar creates its own metainf.mf first, so this would be a duplicate .exclude(MANIFEST_MF) .setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE); } else if (!manifestFound && path.contains(MANIFEST_MF)) { manifestFound = true; //tell jar to use our manifest instead of creating one jarTask.getManifest().from(path); } else if (metaInfFound && manifestFound) { break; //we found both. nothing else to do } } } }); }
/** * {@inheritDoc} */ public void setDuplicatesStrategy(DuplicatesStrategy strategy) { getRootSpec().setDuplicatesStrategy(strategy); }
/** * {@inheritDoc} */ @Internal public DuplicatesStrategy getDuplicatesStrategy() { return getRootSpec().getDuplicatesStrategy(); }
public DuplicatesStrategy getDuplicatesStrategy() { return buildResolverRelativeToParent(parentResolver).getDuplicatesStrategy(); }
public void setDuplicatesStrategy(DuplicatesStrategy strategy) { this.duplicatesStrategy = strategy; }
public DuplicatesStrategy getDuplicatesStrategy() { return delegate.getDuplicatesStrategy(); }
public void setDuplicatesStrategy(@Nullable DuplicatesStrategy strategy) { delegate.setDuplicatesStrategy(strategy); }
public DuplicatesStrategy getDuplicatesStrategy() { return buildRootResolver().getDuplicatesStrategy(); }
public DuplicatesStrategy getDuplicatesStrategy() { return getDelegateCopySpec().getDuplicatesStrategy(); }
public void setDuplicatesStrategy(DuplicatesStrategy strategy) { getDelegateCopySpec().setDuplicatesStrategy(strategy); }
public void setDuplicatesStrategy(DuplicatesStrategy strategy) { throw new UnsupportedOperationException(); }
public DuplicatesStrategy getDuplicateClassesStrategy() { return duplicateClassesStrategy; }
public void setDuplicateClassesStrategy(DuplicatesStrategy duplicateClassesStrategy) { this.duplicateClassesStrategy = duplicateClassesStrategy; }