1 package org.apache.maven.lifecycle.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.execution.ProjectDependencyGraph;
23 import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
24 import org.apache.maven.project.MavenProject;
25
26 import java.util.Collection;
27 import java.util.Collections;
28 import java.util.HashSet;
29
30
31
32
33
34
35
36 public class ReactorBuildStatus
37 {
38 private final ProjectDependencyGraph projectDependencyGraph;
39
40 private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<String>() );
41
42 private volatile boolean halted = false;
43
44 public ReactorBuildStatus( ProjectDependencyGraph projectDependencyGraph )
45 {
46 this.projectDependencyGraph = projectDependencyGraph;
47 }
48
49 public boolean isBlackListed( MavenProject project )
50 {
51 return blackListedProjects.contains( BuilderCommon.getKey( project ) );
52 }
53
54 public void blackList( MavenProject project )
55 {
56 if ( blackListedProjects.add( BuilderCommon.getKey( project ) ) && projectDependencyGraph != null )
57 {
58 for ( MavenProject downstreamProject : projectDependencyGraph.getDownstreamProjects( project, true ) )
59 {
60 blackListedProjects.add( BuilderCommon.getKey( downstreamProject ) );
61 }
62 }
63 }
64
65 public void halt()
66 {
67 halted = true;
68 }
69
70 public boolean isHalted()
71 {
72 return halted;
73 }
74
75 public boolean isHaltedOrBlacklisted( MavenProject mavenProject )
76 {
77 return isBlackListed( mavenProject ) || isHalted();
78 }
79
80 }