Skip to content

Commit

Permalink
Add API Baseline checking to the build (eclipse-cdt#265)
Browse files Browse the repository at this point in the history
Add API Baseline checking to the build

- Update compare and replace baseline
- add plugin definition for compare-attached-artifacts-with-release
which defines the goal compare-version-with-baselines
- fix missing tycho-apitools-plugin
- update maven to 3.9.2
- increase version number and tycho to 4.0.6
- add missing since tags
- add since tag to clangd bundle
- add missing year in copyright header

fixes eclipse-cdt#212
---------

Co-authored-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
  • Loading branch information
ghentschke and ruspl-afed committed May 30, 2024
1 parent 87c6142 commit 1828492
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tycho-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
export PATH=$PWD/clangd_15.0.6/bin:$PATH
echo $PATH
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
mvn -B -V -X -e clean verify
mvn -B -V -X -e clean verify -P baseline-compare-and-replace -P api-baseline-check
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pipeline {
clean verify -B -V -e \
-Dmaven.test.failure.ignore=true \
-Dgpg.passphrase="${KEYRING_PASSPHRASE}" \
-P baseline-compare-and-replace \
-P api-baseline-check \
-P production \
-Dmaven.repo.local=/home/jenkins/.m2/repository \
--settings /home/jenkins/.m2/settings.xml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Vendors may implement this interface as OSGi service
* with a service.ranking property > 0 to replace the default
* implementation {@code ClangdConfigurationFileManager}
*
* @since 2.0
*/
public interface ClangdCProjectDescriptionListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import org.eclipse.core.resources.IProject;

/**
* @since 2.0
*/
public interface ClangdCompilationDatabaseSettings {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @see ClangdOptions
* @see IScopeContext
*
* @since 2.0
*/
public interface ClangdConfiguration extends Configuration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* Retrieves data for https://clangd.llvm.org/extensions#compilation-commands
*
* @since 2.0
*/
public interface ClangdFallbackFlags {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* The metadata for options to configure clangd
*
* @see ClangdOptions
*
* @since 2.0
*/
public interface ClangdMetadata {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/**
* Options to configure clangd
*
* @since 2.0
*/
public interface ClangdOptions {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* Interface for providing default options for clangd.
*
* @since 2.0
*/
public interface ClangdOptionsDefaults extends ClangdOptions {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.util.function.Supplier;

/**
* @since 2.0
*/
public final class ClangdQualifier implements Supplier<String> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ProjectScope;

/**
* @since 2.0
*/
public final class ResolveProjectScope implements Function<Object, Optional<ProjectScope>> {

private final ResolveProject project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.preferences.IPreferenceMetadataStore;

/**
* @since 2.0
*/
public interface Configuration {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.osgi.util.NLS;

/**
* @since 2.0
*/
public abstract class ConfigurationAccess {
protected final String qualifier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Access to initial URI used determine the compiler flags
* for the clangd fallback settings on Windows machines
*
* @since 2.0
*/
public interface InitialUri {

Expand Down
104 changes: 92 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2023 Contributors to the Eclipse Foundation.
Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -8,7 +8,9 @@
SPDX-License-Identifier: EPL-2.0
-->
<project>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.cdt.lsp</groupId>
<artifactId>org.eclipse.cdt.lsp.root</artifactId>
Expand All @@ -20,14 +22,27 @@
<cbi-plugins.version>1.4.3</cbi-plugins.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho.scmUrl>scm:git:https://github.com/eclipse-cdt/cdt-lsp</tycho.scmUrl>
<comparator.repo>https://download.eclipse.org/tools/cdt/releases/cdt-lsp-latest/</comparator.repo>
<api-baseline.repo>https://download.eclipse.org/tools/cdt/releases/cdt-lsp-latest/</api-baseline.repo>
<api-baseline.repo.simrel>https://download.eclipse.org/releases/2024-03/</api-baseline.repo.simrel>
<!-- these parameters are to control baseline replace and compare. On a local build you want
to avoid baseline replace and compare, especially if you have different versions of Java than
the baseline was built with. This is the default.
If you have the same version of Java as the build machine you can run baseline comparison and
replace. To do that run with the baseline-compare-and-replace profile.
-->
<compare-version-with-baselines.skip>true</compare-version-with-baselines.skip>
<replace-version-with-baselines.mode>disable</replace-version-with-baselines.mode>
<replace-version-with-baselines.replace>none</replace-version-with-baselines.replace>
</properties>

<pluginRepositories>
<pluginRepository>
<id>cbi</id>
<pluginRepositories>
<pluginRepository>
<id>cbi</id>
<url>https://repo.eclipse.org/content/repositories/cbi-releases/</url>
</pluginRepository>
</pluginRepositories>
</pluginRepository>
</pluginRepositories>

<build>
<pluginManagement>
Expand All @@ -37,7 +52,7 @@
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
<plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-gpg-plugin</artifactId>
<version>${tycho.version}</version>
Expand Down Expand Up @@ -113,15 +128,15 @@
</executions>
</plugin>
</plugins>
</pluginManagement>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
Expand Down Expand Up @@ -188,9 +203,29 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution> <!-- Checks versions are properly bumped from one stream to the other -->
<id>compare-attached-artifacts-with-release</id>
<goals>
<goal>compare-version-with-baselines</goal>
</goals>
<configuration>
<skip>${compare-version-with-baselines.skip}</skip>
<baselines>
<baseline>${comparator.repo}</baseline> <!-- Previous release) -->
</baselines>
<comparator>zip</comparator>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profiles>
<profile>
<id>production</id>
<build>
Expand Down Expand Up @@ -237,7 +272,52 @@
</plugins>
</build>
</profile>
</profiles>
<profile>
<id>baseline-compare-and-replace</id>
<properties>
<compare-version-with-baselines.skip>false</compare-version-with-baselines.skip>
<replace-version-with-baselines.mode>fail</replace-version-with-baselines.mode>
<replace-version-with-baselines.replace>all</replace-version-with-baselines.replace>
</properties>
</profile>
<profile>
<id>api-baseline-check</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-apitools-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<skipIfReplaced>false</skipIfReplaced>
<baselines>
<repository>
<url>${api-baseline.repo}</url>
</repository>
<repository>
<url>${api-baseline.repo.simrel}</url>
</repository>
</baselines>
</configuration>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
<module>bundles</module>
Expand Down

0 comments on commit 1828492

Please sign in to comment.