Skip to content

Commit

Permalink
Upgrade tycho, use toolchains (#260)
Browse files Browse the repository at this point in the history
Bump tycho-version from 1.7.0 to 2.4.0 (closes #253, closes #246)
Bump repository-utils from 1.7.0 to 2.2.0 (closes #244)

* Tycho itself needs Java11, for the actual plugin and tests Java8 is used.
* Oxygen target requires now Java8, since Checkstyle requires at least Java8.
* Note: mars won't work, because spotbugs is not available for mars, only beginning with neon
* Remove orbit, as commons-lang is in the simul release repo anyway.
* Remove m2e repository, this is also included in the simul release repo.
* Add target definition for 2021-09 and fix tests
* Update oomph setup for new eclipse releases
* Enable module pmd test
  • Loading branch information
adangel committed Sep 18, 2021
1 parent b67c335 commit 5edc813
Show file tree
Hide file tree
Showing 29 changed files with 697 additions and 337 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
#java: [ 8, 11, 17-ea ]
java: [ 8 ]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand All @@ -35,13 +33,28 @@ jobs:
ruby-version: 2.7
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Set up JDK
- name: Set up JDK 8
id: java8
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: ${{ matrix.java }}
java-version: '8'

- name: Set up JDK 11
id: java11
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: '11'
cache: 'maven'

- name: Setup maven toolchains.xml
shell: bash
run: |
echo "JAVA8_HOME=${{ steps.java8.outputs.path }}" >> $GITHUB_ENV
echo "JAVA11_HOME=${{ steps.java11.outputs.path }}" >> $GITHUB_ENV
cp tools/toolchains.xml $HOME/.m2/
- name: Prepare release
if: ${{ runner.os == 'Linux' && github.event_name == 'push' && github.repository == 'm2e-code-quality/m2e-code-quality' && startsWith(github.ref, 'refs/tags/') }}
shell: bash
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,26 @@ The latest release can be installed from the Eclipse Update Site at

## Development environment

**Building**

The project uses maven and tycho. You need a Java8 JDK and a Java11 JDK and setup
[Maven Toolchains](https://maven.apache.org/guides/mini/guide-using-toolchains.html) correctly.
You can use the project's [toolchains.xml](tools/toolchains.xml) as a template.

Once setup, you can build the project with `./mvnw clean verify`.

**IDE**

This project uses [Oomph](https://projects.eclipse.org/projects/tools.oomph), and you can set up an Eclipse development environment with the following steps:

1. Make sure your JRE/JDK has the JCE installed (See http://stackoverflow.com/questions/42128981/eclipse-pmd-plug-in-handshake-failure and https://github.com/pmd/pmd-eclipse-plugin/issues/19)
2. Downloading the Eclipse Installer from https://www.eclipse.org/downloads/ and start it.
3. On the initial page, click on the *Switch to advanced mode* button in the top right.
4. On the *Product* page, select *Eclipse for RCP and RAP Developers*.
5. On the *Projects* page, collapse the *Eclipse Projects* to scroll down to the *GitHub Projects* and select *m2e-code-quality*.
6. Make sure to choose the HTTPS anonymous option for the repository.
7. Choose other preferred installation settings on the *Variables* page.
8. Finish the wizard and watch your development environment being assembled.
9. Create an Eclipse run configuration. The target platform will automatically be setup correctly.
1. Downloading the Eclipse Installer from https://www.eclipse.org/downloads/ and start it.
2. On the initial page, click on the *Switch to advanced mode* button in the top right.
3. On the *Product* page, select *Eclipse IDE for RCP and RAP Developers*.
4. On the *Projects* page, collapse the *Eclipse Projects* to scroll down to the *GitHub Projects* and select *m2e-code-quality*.
5. Make sure to choose the HTTPS anonymous option for the Github repository.
6. Choose other preferred installation settings on the *Variables* page.
7. Finish the wizard and watch your development environment being assembled.
8. Create an Eclipse run configuration. The target platform will automatically be setup correctly.

## Release

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*******************************************************************************/
package com.basistech.m2e.code.quality.checkstyle.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -15,6 +19,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.junit.Test;

import com.basistech.m2e.code.quality.shared.test.AbstractMavenProjectConfiguratorTestCase;

Expand All @@ -33,10 +38,12 @@ public class EclipseCheckstyleProjectConfigurationTest extends AbstractMavenProj

private static final String NATURE_ID = CheckstyleNature.NATURE_ID;

@Test
public void testCheckstyleCheck() throws Exception {
importProjectRunBuildAndFindMarkers("projects/checkstyle-check/pom.xml", MARKER_ID, 13);
}

@Test
public void testCheckstylePresent() throws Exception {
final IProject p = importProject("projects/checkstyle-check/pom.xml");
assertTrue(p.exists());
Expand All @@ -46,6 +53,7 @@ public void testCheckstylePresent() throws Exception {
assertTrue(hasBuilder(p, BUILDER_ID));
}

@Test
public void testCheckstyleSkip() throws Exception {
final IProject p = importProjectWithProfiles("projects/checkstyle-check/pom.xml", "skip");
assertTrue(p.exists());
Expand All @@ -55,6 +63,7 @@ public void testCheckstyleSkip() throws Exception {
assertFalse(hasBuilder(p, BUILDER_ID));
}

@Test
public void testCheckstyleReconfigureSkip() throws Exception {
final IProject p = importProject("projects/checkstyle-check/pom.xml");
assertTrue(p.exists());
Expand Down Expand Up @@ -85,6 +94,7 @@ public void testCheckstyleReconfigureSkip() throws Exception {
assertMarkers(p, MARKER_ID, 1);
}

@Test
public void testCheckstyleReconfigureReactivate() throws Exception {
final IProject p = importProject("projects/checkstyle-check/pom.xml");
assertTrue(p.exists());
Expand All @@ -106,6 +116,7 @@ public void testCheckstyleReconfigureReactivate() throws Exception {
assertTrue(hasBuilder(p, BUILDER_ID));
}

@Test
public void testCheckstyleMultipleExecutions() throws Exception {
final IProject p = importProject("projects/checkstyle-multi-check/pom.xml");
assertTrue(p.exists());
Expand All @@ -118,6 +129,7 @@ public void testCheckstyleMultipleExecutions() throws Exception {
assertEquals(2, configuration.getLocalCheckConfigurations().size());
}

@Test
public void testCheckstyleMultipleExecutionsSkipOne() throws Exception {
final IProject p = importProjectWithProfiles("projects/checkstyle-multi-check/pom.xml", "skip-second");
assertTrue(p.exists());
Expand All @@ -131,6 +143,7 @@ public void testCheckstyleMultipleExecutionsSkipOne() throws Exception {
assertEquals(2, configuration.getLocalCheckConfigurations().size());
}

@Test
public void testCheckstyleMultipleExecutionsSkipAll() throws Exception {
final IProject p = importProjectWithProfiles("projects/checkstyle-multi-check/pom.xml", "skip");
assertTrue(p.exists());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
*******************************************************************************/
package com.basistech.m2e.code.quality.findbugs.tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;
import java.util.Map;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.StructuredSelection;
import org.junit.Test;

import com.basistech.m2e.code.quality.shared.test.AbstractMavenProjectConfiguratorTestCase;

Expand All @@ -29,14 +33,17 @@ public class EclipseFindbugsProjectConfigurationTest extends AbstractMavenProjec
private static final String NATURE_ID = FindbugsPlugin.NATURE_ID;
private static final String BUILDER_ID = FindbugsPlugin.BUILDER_ID;

@Test
public void testFindbugsCheck() throws Exception {
importProjectRunBuildAndFindMarkers("projects/findbugs-check/pom.xml", MARKER_ID, 2, new TriggerFindbugsExplicitly());
}

@Test
public void testFindbugsFindbugs() throws Exception {
importProjectRunBuildAndFindMarkers("projects/findbugs-findbugs/pom.xml", MARKER_ID, 2, new TriggerFindbugsExplicitly());
}

@Test
public void testFindbugsPresent() throws Exception {
final IProject p = importProject("projects/findbugs-check/pom.xml");
assertTrue(p.exists());
Expand All @@ -46,6 +53,7 @@ public void testFindbugsPresent() throws Exception {
assertTrue(hasBuilder(p, BUILDER_ID));
}

@Test
public void testFindbugsSkip() throws Exception {
final IProject p = importProjectWithProfiles("projects/findbugs-check/pom.xml", "skip");
assertTrue(p.exists());
Expand All @@ -55,6 +63,7 @@ public void testFindbugsSkip() throws Exception {
assertFalse(hasBuilder(p, BUILDER_ID));
}

@Test
public void testFindbugsReconfigureSkip() throws Exception {
final IProject p = importProject("projects/findbugs-check/pom.xml");
assertTrue(p.exists());
Expand Down Expand Up @@ -85,6 +94,7 @@ public void testFindbugsReconfigureSkip() throws Exception {
assertMarkers(p, MARKER_ID, 1);
}

@Test
public void testFindbugsReconfigureReactivate() throws Exception {
final IProject p = importProject("projects/findbugs-check/pom.xml");
assertTrue(p.exists());
Expand Down
8 changes: 4 additions & 4 deletions com.basistech.m2e.code.quality.pmd.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: M2Eclipse Project Configurator for Eclipse PMD Tests
Bundle-SymbolicName: com.basistech.m2e.code.quality.pmd.test
Bundle-Version: 1.1.0.qualifier
Bundle-Version: 1.1.5.qualifier
Bundle-Vendor: Basis Technology Corp.
Fragment-Host: com.basistech.m2e.code.quality.pmd;bundle-version="[1.1.0,2.0.0)"
Fragment-Host: com.basistech.m2e.code.quality.pmd;bundle-version="[1.1.5,2.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.junit,
org.eclipse.jface,
com.basistech.m2e.code.quality.shared.test;bundle-version="1.1.0",
com.basistech.m2e.code.quality.shared.test;bundle-version="1.1.5",
org.eclipse.m2e.tests.common
Automatic-Module-Name: com.basistech.m2e.code.quality.pmd.test
2 changes: 1 addition & 1 deletion com.basistech.m2e.code.quality.pmd.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.basistech.m2e-code-quality</groupId>
<artifactId>m2e-code-quality-plugins</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.5-SNAPSHOT</version>
</parent>

<artifactId>com.basistech.m2e.code.quality.pmd.test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
*******************************************************************************/
package com.basistech.m2e.code.quality.pmd.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Map;
import java.util.Set;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.junit.Test;

import com.basistech.m2e.code.quality.shared.test.AbstractMavenProjectConfiguratorTestCase;

Expand All @@ -29,10 +34,12 @@ public class EclipsePmdProjectConfigurationTest extends AbstractMavenProjectConf
private static final String NATURE_ID = PMDNature.PMD_NATURE;
private static final String BUILDER_ID = PMDBuilder.PMD_BUILDER;

@Test
public void testPmdCheck() throws Exception {
importProjectRunBuildAndFindMarkers("projects/pmd-check/pom.xml", MARKER_ID, 3);
}

@Test
public void testPmdPresent() throws Exception {
final IProject p = importProject("projects/pmd-check/pom.xml");
assertTrue(p.exists());
Expand All @@ -42,6 +49,7 @@ public void testPmdPresent() throws Exception {
assertTrue(hasBuilder(p, BUILDER_ID));
}

@Test
public void testPmdSkip() throws Exception {
final IProject p = importProjectWithProfiles("projects/pmd-check/pom.xml", "skip");
assertTrue(p.exists());
Expand All @@ -51,6 +59,7 @@ public void testPmdSkip() throws Exception {
assertFalse(hasBuilder(p, BUILDER_ID));
}

@Test
public void testPmdReconfigureSkip() throws Exception {
final IProject p = importProject("projects/pmd-check/pom.xml");
assertTrue(p.exists());
Expand Down Expand Up @@ -80,6 +89,7 @@ public void testPmdReconfigureSkip() throws Exception {
assertMarkers(p, MARKER_ID, 1);
}

@Test
public void testPmdReconfigureReactivate() throws Exception {
final IProject p = importProject("projects/pmd-check/pom.xml");
assertTrue(p.exists());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*******************************************************************************/
package com.basistech.m2e.code.quality.shared.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;

Expand All @@ -33,7 +36,7 @@
public abstract class AbstractMavenProjectConfiguratorTestCase extends AbstractMavenProjectTestCase {

@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
addDefaultJavaVMIfNeeded();
super.setUp();
}
Expand All @@ -42,7 +45,7 @@ protected void setUp() throws Exception {
* Setup a default JVM if none exists yet. This is especially required for mac
* osx on github actions, as there is no default JVM detected automatically.
* This is not done via the following extension, in order to check for the
* existence of openjdk8Path:
* existence of JAVA_HOME:
*
* <pre>
* &lt;extension
Expand All @@ -62,7 +65,15 @@ private void addDefaultJavaVMIfNeeded() {
return;
}

File javaHome = new File(System.getenv("JAVA_HOME"));
String javaHomeEnv = System.getenv("JAVA8_HOME");
if (javaHomeEnv == null) {
javaHomeEnv = System.getenv("JAVA_HOME");
}
if (javaHomeEnv == null) {
System.out.println("WARN: Neither JAVA8_HOME nor JAVA_HOME found!");
return;
}
File javaHome = new File(javaHomeEnv);
if (javaHome.exists()) {
try {
javaHome = javaHome.getCanonicalFile();
Expand Down
5 changes: 1 addition & 4 deletions com.basistech.m2e.code.quality.site/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<plugin>
<groupId>org.jboss.tools.tycho-plugins</groupId>
<artifactId>repository-utils</artifactId>
<version>1.7.0</version>
<version>2.2.0</version>
<executions>
<!-- creates index.html and other artifacts -->
<!-- see https://github.com/jbosstools/jbosstools-maven-plugins/wiki -->
Expand All @@ -40,13 +40,10 @@
</symbols>
<!-- this adds repository references to the update site's content.xml -->
<associateSites>
<site>${updatesite.m2e}</site>
<site>${updatesite.eclipse}</site>
<site>${updatesite.cs}</site>
<site>${updatesite.pmd}</site>
<site>${updatesite.findbugs}</site>
<site>${updatesite.spotbugs}</site>
<site>${updatesite.orbit}</site>
</associateSites>
<!-- to remove the default category created for any uncategorized
features or bundles, set this to true -->
Expand Down

0 comments on commit 5edc813

Please sign in to comment.