Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-03-19 20:54:23 +0000
committerTill Brychcy2018-03-19 20:54:45 +0000
commite45436815d92043eff8111041fd0e5f1534397bd (patch)
tree6491fea738bc353adde7ab0b859b407cd1d8f1f0
parentb0d5cef603611351a5ed3d1235fd5e43e7e387f7 (diff)
downloadeclipse.jdt.core-e45436815d92043eff8111041fd0e5f1534397bd.tar.gz
eclipse.jdt.core-e45436815d92043eff8111041fd0e5f1534397bd.tar.xz
eclipse.jdt.core-e45436815d92043eff8111041fd0e5f1534397bd.zip
Bug 532586 - [testsources] incremental builds are not working inI20180320-2000I20180319-2000
projects with just test sources Change-Id: I17e39dc6223d2d877e52e63564975db1bf24328b
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java51
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java5
2 files changed, 53 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java
index 53fd906d72..652d50871a 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 Till Brychcy and others.
+ * Copyright (c) 2017, 2018 Till Brychcy and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,10 @@ import org.eclipse.jdt.core.tests.util.Util;
import junit.framework.Test;
public class TestAttributeBuilderTests extends BuilderTests {
+ static {
+ // TESTS_NAMES = new String[] { "testIncrementalBuildTestOnlyProject" };
+ }
+
public TestAttributeBuilderTests(String name) {
super(name);
@@ -572,6 +576,51 @@ public class TestAttributeBuilderTests extends BuilderTests {
"/Project2/tests/p2/T2Class.java", "/Project2/tests/p2/Test2.java" });
}
+ public void testIncrementalBuildTestOnlyProject() throws JavaModelException {
+ IPath project1Path = env.addProject("Project1");
+ env.removePackageFragmentRoot(project1Path, "");
+ IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests");
+ env.addExternalJars(project1Path, Util.getJavaClassLibs());
+
+ env.addClass(tests1, "p1", "T1Class",
+ "package p1;\n" +
+ "\n" +
+ "public class T1Class {\n"+
+ "}\n"
+ );
+ env.addClass(tests1, "p1", "Test1",
+ "package p1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " void test1() {\n" +
+ " new T1Class();" +
+ " }\n" +
+ "}\n" +
+ ""
+ );
+
+ fullBuild();
+ expectingNoProblems();
+
+ IPath test1 = env.addClass(tests1, "p1", "Test1",
+ "package p1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " void test1() {\n" +
+ " new X1Class();" +
+ " }\n" +
+ "}\n" +
+ ""
+ );
+ incrementalBuild();
+ expectingProblemsFor(
+ test1,
+ "Problem : X1Class cannot be resolved to a type [ resource : </Project1/tests/p1/Test1.java> range : <56,63> category : <40> severity : <2>]"
+ );
+ expectingCompiledClasses(new String[] { "p1.Test1" });
+ expectingCompilingOrder(new String[] { "/Project1/tests/p1/Test1.java"});
+ }
+
public void testClasspathEntryTestAttributeChanges() throws JavaModelException {
IPath project1Path = env.addProject("Project1");
env.removePackageFragmentRoot(project1Path, "");
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
index 47c8cf601a..6e64186f79 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -186,7 +186,7 @@ protected IProject[] build(int kind, Map ignored, IProgressMonitor monitor) thro
if (DEBUG)
System.out.println("JavaBuilder: Performing full build since classpath has changed"); //$NON-NLS-1$
buildAll();
- } else if (this.nameEnvironment.sourceLocations.length > 0) {
+ } else if (this.nameEnvironment.sourceLocations.length > 0 || this.testNameEnvironment.sourceLocations.length > 0) {
// if there is no source to compile & no classpath changes then we are done
SimpleLookupTable deltas = findDeltas();
if (deltas == null) {
@@ -340,6 +340,7 @@ private void createInconsistentBuildMarker(CoreException coreException) throws C
private void cleanup() {
this.participants = null;
this.nameEnvironment = null;
+ this.testNameEnvironment = null;
this.binaryLocationsPerProject = null;
this.lastState = null;
this.notifier = null;

Back to the top