Skip to content

Commit

Permalink
Merge branch 'eclipse-xtext:main' into disable_DirtyStateEditorSuppor…
Browse files Browse the repository at this point in the history
…tIntegrationTest_for_macos
  • Loading branch information
mehmet-karaman authored Dec 8, 2024
2 parents b1c5b57 + dec4226 commit 503c35b
Show file tree
Hide file tree
Showing 47 changed files with 163 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def isTriggeredByUpstream() {
def eclipseVersion() {
def targetPlatform = selectedTargetPlatform()
if (targetPlatform == 'latest') {
return "4.34"
return "4.35"
} else {
def baseDate = java.time.LocalDate.parse("2018-06-01") // 4.8 Photon
def df = java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd")
Expand Down
3 changes: 1 addition & 2 deletions full-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

MVN_ARGS=(\
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dit-archetype-tests-skip=true \
)

# args parsing inspired by https://gist.github.com/jehiah/855086
Expand All @@ -22,7 +21,7 @@ while [ "$1" != "" ]; do
exit
;;
--no-tests)
MVN_ARGS+=(-DskipTests=true)
MVN_ARGS+=(-DskipTests=true -Dit-archetype-tests-skip=true)
;;
--local-repository)
MVN_ARGS+=" -Dmaven.repo.local=$VALUE"
Expand Down
3 changes: 1 addition & 2 deletions org.eclipse.xtend.core.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Require-Bundle: org.eclipse.xtend.core;bundle-version="2.38.0",
org.objectweb.asm;bundle-version="[9.7.1,9.8.0)",
org.eclipse.jdt.core;bundle-version="3.37.0",
org.eclipse.xtext.builder.standalone;bundle-version="2.38.0",
org.eclipse.xtext.java;bundle-version="2.38.0",
org.eclipse.draw2d
org.eclipse.xtext.java;bundle-version="2.38.0"
Import-Package: jakarta.inject;version="2.0.1",
org.apache.log4j;version="1.2.24",
org.apache.log4j.spi;version="1.2.24",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
import org.eclipse.xtend.core.xtend.XtendClass;
import org.eclipse.xtend.core.xtend.XtendInterface;
import org.eclipse.xtext.testing.validation.ValidationTestHelper;
import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.eclipse.xtext.xbase.XbasePackage;
import org.junit.Assume;
import org.junit.Test;

import com.google.inject.Inject;
Expand Down Expand Up @@ -1068,18 +1066,11 @@ public void testClassMustBeAbstract_06() throws Exception {
helper.assertNoWarnings(xtendClass, XTEND_FUNCTION, MISSING_SYNCHRONIZED);
}

/**
* Since there's no record in the JDK and adding a Java source with a record in this
* project would require Java 21 compilation level, I'm using a known record from
* draw2d, which is in our target platform.
*/
@Test public void testOverrideJavaRecord() throws Exception {
Assume.assumeTrue("Active only on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
var javaRecord = "org.eclipse.draw2d.geometry.Interval";
var source = "class Foo extends " + javaRecord + " { }";
var source = "class Foo extends test.SomeRecord { }";
XtendClass xtendClass = clazz(source);
helper.assertError(xtendClass, XTEND_CLASS, OVERRIDDEN_FINAL,
source.indexOf(javaRecord), javaRecord.length(),
source.indexOf("test.SomeRecord"), "test.SomeRecord".length(),
"override", "final");
}

Expand Down
16 changes: 16 additions & 0 deletions org.eclipse.xtend.core.tests/testdata/test/SomeRecord.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*******************************************************************************
* Copyright (c) 2024 Lorenzo Bettini and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package test;

/**
* @author Lorenzo Bettini - Initial contribution and API
*/
public record SomeRecord() {

}
5 changes: 5 additions & 0 deletions org.eclipse.xtend.maven.archetype/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To run the integration tests, the `maven.home` variable must defined, i.e., passed to the Maven build with `-Dmaven.home=...`.

For example, if the Maven executable is `/usr/local/bin/mvn`, you need to pass `-Dmaven.home=/usr/local` (i.e., without the `bin` subdirectory).

The Maven Invoker Plugin's goal `install` is attached to the `pre-integration-test` phase, in order to install the needed Maven artifacts of Xtext/Xtend into the `target/.m2test` folder, which will be then used by the integration test to build the test project generated from the archetype.
41 changes: 36 additions & 5 deletions org.eclipse.xtend.maven.archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

<properties>
<root-dir>${basedir}/..</root-dir>
<it-archetype-tests-skip>true</it-archetype-tests-skip>
<it-archetype-tests-skip>false</it-archetype-tests-skip>
<it-archetype-tests-debug>false</it-archetype-tests-debug>
<!-- The local Maven repository for our IT tests -->
<localMavenRepositoryPath>${project.basedir}/target/.m2test</localMavenRepositoryPath>
</properties>

<build>
Expand Down Expand Up @@ -49,18 +52,46 @@
</plugins>
</pluginManagement>
<plugins>
<!-- install test dependencies, including the xtend-maven-plugin in the local .m2 repository
that will be used by the integration test to build the test project generated with the archetype -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<extraArtifacts>
<!-- our BOM is not a dependency (it's just imported), thus, we must
install it explicitly in the local maven repository -->
<extraArtifact>org.eclipse.xtext:xtext-dev-bom:${project.version}:pom</extraArtifact>
</extraArtifacts>
<localRepositoryPath>${localMavenRepositoryPath}</localRepositoryPath>
</configuration>
<executions>
<execution>
<id>install dependencies in local test repo</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install</goal>
</goals>
<configuration>
<scope>test</scope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<configuration>
<skip>${it-archetype-tests-skip}</skip>
<debug>true</debug>
<debug>${it-archetype-tests-debug}</debug>
<localRepositoryPath>${localMavenRepositoryPath}</localRepositoryPath>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration><debug>true</debug></configuration>
<configuration>
<skip>${it-archetype-tests-skip}</skip>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -84,7 +115,7 @@
</file>
</activation>
<properties>
<it-tests-skip>true</it-tests-skip>
<it-archetype-tests-skip>true</it-archetype-tests-skip>
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<defaultValue>UTF-8</defaultValue>
</requiredProperty>
<requiredProperty key="javaVersion">
<defaultValue>1.8</defaultValue>
<defaultValue>17</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ sourceEncoding=UTF-8
groupId=integrationtest.group
artifactId=integrationtest.artifactId
version=1.0.0-SNAPSHOT
javaVersion=17
package=org.eclipse.xtend.xtend.archetype.integrationtest
packageInPathFormat=org/eclipse/xtend/xtend-archetype/integrationtest
4 changes: 4 additions & 0 deletions org.eclipse.xtend.maven.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.5.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
1 change: 0 additions & 1 deletion org.eclipse.xtend.maven.plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<extraArtifacts>
<!-- our BOM is not a dependency (it's just imported), thus, we must
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package test;

public record JavaRecord(String name) {
public XtendA foo(XtendA test) {
return test;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package test

class XtendA extends JavaB {

def JavaB test2(XtendC s) {
return s.foo.newJavaB
}

def JavaB newJavaB() {
return new JavaB()
}


def JavaRecord newJavaRecord() {
return new JavaRecord("a test")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

import java.io.File;

import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.eclipse.xtext.util.JavaVersion;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -36,8 +34,7 @@ public void setUp() {
}

@Test
public void testCleanBuildAccessingJava21Record() {
Assume.assumeTrue("Active only on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
public void testCleanBuildAccessingJavaRecord() {
initBuilder(new ContentAssistFragmentTestLangConfiguration());
assertTrue(testBuilder.launch());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.eclipse.xtext.testing.util.InMemoryURIHandler;
import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.eclipse.xtext.util.JavaVersion;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -186,8 +184,7 @@ public void testClassShadowing() {
}

@Test
public void testJava21Record() {
Assume.assumeTrue("Active only on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
public void testJavaRecord() {
ImmutableMap<String, String> files = ImmutableMap.<String, String>builder()
.put("example/MyRecord.java",
"package example;\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public void javaLangBiRef() throws Exception {
verifier.verifyFilePresent(verifier.getBasedir() + "/src-gen/XbaseReferToJava.java");
verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/XbaseReferToJava.class");
verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/JavaClazz.class");
verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/JavaRecord.class");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public record JavaRecord(String name) {
public void useXbaseType(XbaseReferToJava xbaseType) throws Throwable {
xbaseType.myMethod();
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
val JavaClazz jc = null
val JavaRecord jr = new JavaRecord("test")
val name = jr.name()
jc.useXbaseType(this)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-12"/>
<repository location="https://download.eclipse.org/releases/2025-03"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
Expand All @@ -29,7 +29,7 @@
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="org.objectweb.asm" version="9.7.1"/>
<unit id="io.github.classgraph.classgraph" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-03"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-12"/>
<repository location="https://download.eclipse.org/releases/2025-03"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
Expand All @@ -29,7 +29,7 @@
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="org.objectweb.asm" version="9.7.1"/>
<unit id="io.github.classgraph.classgraph" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-03"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-12"/>
<repository location="https://download.eclipse.org/releases/2025-03"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
Expand All @@ -29,7 +29,7 @@
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="org.objectweb.asm" version="9.7.1"/>
<unit id="io.github.classgraph.classgraph" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-03"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-12"/>
<repository location="https://download.eclipse.org/releases/2025-03"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
Expand All @@ -29,7 +29,7 @@
<unit id="org.apache.commons.commons-logging" version="0.0.0"/>
<unit id="org.objectweb.asm" version="9.7.1"/>
<unit id="io.github.classgraph.classgraph" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-03"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
<configuration>
<warSourceDirectory>WebRoot</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-12"/>
<repository location="https://download.eclipse.org/releases/2025-03"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
Expand Down Expand Up @@ -41,7 +41,7 @@
<unit id="org.opentest4j" version="0.0.0"/>
<unit id="org.objectweb.asm" version="9.7.1"/>
<unit id="io.github.classgraph.classgraph" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-03"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
<configuration>
<warSourceDirectory>WebRoot</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
Expand Down
Loading

0 comments on commit 503c35b

Please sign in to comment.