Commit ceef88aa authored by Brian Long's avatar Brian Long
Browse files

added module cache to exclude dependencies of modules

parent dec44cf6
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
@@ -27,6 +29,7 @@ public class AmpDependencyFilter implements DependencyFilter {
	private final Log log;
	private final Charset charset;
	private final ArtifactResolutionCallback callback;
	private Set<String> moduleIds = new HashSet<String>();
	
	public AmpDependencyFilter(Log log, String charsetName, ArtifactResolutionCallback callback) {
		this.log = log;
@@ -39,6 +42,14 @@ public class AmpDependencyFilter implements DependencyFilter {
		Artifact artifact = node.getArtifact();
		if (this.log.isDebugEnabled())
			this.log.debug("Checking dependency: " + artifact.getArtifactId());
		
		String moduleId = artifact.getGroupId() + "." + artifact.getArtifactId();
		if (this.moduleIds.contains(moduleId)) {
			if (this.log.isDebugEnabled())
				this.log.debug("Not packaging library; detected as dependency to other Alfresco Module: " + node.getArtifact().getArtifactId());
			return false;
		}
		
		File file = artifact.getFile();
		try {
			if (file == null) {
@@ -54,8 +65,9 @@ public class AmpDependencyFilter implements DependencyFilter {
				this.log.debug("Checking dependency file: " + file);
			
			if (this.isAlfrescoModule(file)) {
				this.moduleIds.add(moduleId);
				if (this.log.isInfoEnabled())
					this.log.info("Not packaging JAR; detected as Alfresco JAR Module: " + node.getArtifact().getArtifactId());
					this.log.info("Not packaging library; detected as Alfresco Module: " + node.getArtifact().getArtifactId());
				return false;
			}