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

Merge branch 'develop' into stable

parents 7038122a b0baa443
Loading
Loading
Loading
Loading
+23 −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,24 @@ 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 Alfresco Module: " + node.getArtifact().getArtifactId());
			return false;
		} else if (parents != null) {
			for (DependencyNode parent : parents) {
				String parentModuleId = parent.getArtifact().getGroupId() + "." + parent.getArtifact().getArtifactId();
				if (this.moduleIds.contains(parentModuleId)) {
					this.moduleIds.add(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 +75,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;
			}