Skip to content

Commit

Permalink
When doing the sanity build, when the build fails, check if sanity bu…
Browse files Browse the repository at this point in the history
…ild is still needed, or if the build problem is not related to sanity build, as suggested.
  • Loading branch information
lahodaj committed May 14, 2024
1 parent d826509 commit e368f45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.openide.util.RequestProcessor;
import org.openide.util.lookup.Lookups;
import org.netbeans.modules.maven.InternalActionDelegate;
import org.netbeans.modules.maven.problems.SanityBuildAction.SanityBuildNeededChecker;
import org.openide.util.Pair;

/**
Expand All @@ -85,9 +86,10 @@
@ProjectServiceProvider(service = {
ProjectProblemsProvider.class,
InternalActionDelegate.class,
SanityBuildNeededChecker.class,
}, projectType = "org-netbeans-modules-maven"
)
public class MavenModelProblemsProvider implements ProjectProblemsProvider, InternalActionDelegate {
public class MavenModelProblemsProvider implements ProjectProblemsProvider, InternalActionDelegate, SanityBuildNeededChecker {
static final RequestProcessor RP = new RequestProcessor(MavenModelProblemsProvider.class);
private static final Logger LOG = Logger.getLogger(MavenModelProblemsProvider.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.netbeans.modules.maven.execute.BeanRunConfig;
import org.netbeans.modules.maven.execute.MavenProxySupport;
import org.netbeans.modules.maven.execute.MavenProxySupport.ProxyResult;
import org.netbeans.modules.maven.modelcache.MavenProjectCache;
import org.netbeans.modules.maven.options.MavenSettings;
import static org.netbeans.modules.maven.problems.Bundle.*;
import org.netbeans.spi.project.ProjectServiceProvider;
Expand Down Expand Up @@ -173,7 +172,10 @@ public void run() {
if (et != null) {
et.waitFinished();
ProjectProblemsProvider.Result r;
if (result.get() == 0) {
if (result.get() == 0 ||
// if the build failed, the problem may be in user's sources, rather than in
// missing artifacts. Check if sanity build is still needed:
!nbproject.getLookup().lookup(SanityBuildNeededChecker.class).isSanityBuildNeeded()) {
r = ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.RESOLVED, ACT_PrimingComplete());
} else {
r = ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.UNRESOLVED, ACT_PrimingFailed());
Expand Down Expand Up @@ -238,4 +240,7 @@ public void executionResult(RunConfig config, ExecutionContext res, int resultCo
}
}

public interface SanityBuildNeededChecker {
public boolean isSanityBuildNeeded();
}
}

0 comments on commit e368f45

Please sign in to comment.