Skip to content

Commit

Permalink
Add API Baseline checking to the build
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgraham committed Aug 17, 2023
1 parent 2c3aaf8 commit fe2d38e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ replace. To do that run with the `baseline-compare-and-replace` profile.

Requires verify phase of maven to run, i.e. will not run with `mvn package` even if profile is specified.

#### api-baseline-check

`api-baseline-check` checks the API of CDT matches the [API policy](https://github.com/eclipse-cdt/cdt/blob/main/POLICY.md#api)

#### production

Runs the production steps of the build. This profile can only be run on the CDT CI machines
Expand Down
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pipeline {
-Dmaven.test.failure.ignore=true \
-DexcludedGroups=flakyTest,slowTest \
-P baseline-compare-and-replace \
-P api-baseline-check \
-Ddsf.gdb.tests.timeout.multiplier=50 \
-Dindexer.timeout=300 \
-P production \
Expand Down
37 changes: 37 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
<!-- Some old tests, like CDescriptorOldTests, fail due to reflection access. Therefore we add-opens to make that pass -->
<base.test.vmargs>-Xms256m -Xmx512m -ea --add-opens=java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED</base.test.vmargs>
<comparator.repo>https://download.eclipse.org/tools/cdt/releases/11.2/cdt-11.2.0/</comparator.repo>
<api-baseline.repo>https://download.eclipse.org/tools/cdt/releases/latest/</api-baseline.repo>
<api-baseline.repo.simrel>https://download.eclipse.org/releases/latest/</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.
Expand Down Expand Up @@ -549,6 +551,41 @@
<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>
<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>
<profile>
<id>production</id>
<build>
Expand Down
1 change: 1 addition & 0 deletions releng/scripts/check_bundle_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ${MVN:-mvn} \
-DskipDoc=true \
-DskipTests=true \
-P baseline-compare-and-replace \
-P api-baseline-check \
2>&1 | tee ${logfile}

if [ $? -eq 0 ]; then
Expand Down
17 changes: 17 additions & 0 deletions releng/scripts/check_bundle_versions_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fi
logfile=baseline-compare-and-replace.log
bundles_only_qualifier_changed=$(grep "Only qualifier changed" ${logfile} | sed -e 's/^.*Only qualifier changed for .//' -e 's@/.*@@' | sort)
if [ -n "$bundles_only_qualifier_changed" ]; then
echo
echo "The following bundles are missing a service segment version bump:"
for bundle in $bundles_only_qualifier_changed; do
echo " - $bundle"
Expand All @@ -35,6 +36,7 @@ fi

bundles_same_version_different_content=$(grep "baseline and build artifacts have same version but different contents" ${logfile} | sed -e 's/^.* on project //' -e 's@: baseline.*@@' | sort)
if [ -n "$bundles_same_version_different_content" ]; then
echo
echo "The following bundles have same version as baseline, but different contents:"
for bundle in $bundles_same_version_different_content; do
echo " - $bundle"
Expand All @@ -49,6 +51,21 @@ if [ -n "$bundles_same_version_different_content" ]; then
echo
fi

api_errors=$(grep "API ERROR" ${logfile} | grep -v "0 API ERRORS" || true)
if [ -n "$api_errors" ]; then
echo
echo "API Errors were detected when running the build:"
grep "API ERROR" ${logfile} | grep -v "0 API ERRORS" || true
major_version=$(grep "The major version should be incremented" ${logfile})
if [ -n "$major_version" ]; then
echo "WARNING: some of the API errors report as 'major version should be incremented'. Incrementing the"
echo "major version is only allowed on major new versions of CDT. This error indicates that API has been"
echo "broken in some incompatible way. An project committer can help explain what to do if the (lengthy)"
echo "documentation below needs interpreting for this use case.".
fi
echo "See https://github.com/eclipse-cdt/cdt/blob/main/POLICY.md#api for details"
fi

success=$(grep "SUCCESS - Maven check all versions have been bumped appropriately appears to have completed successfully" ${logfile})
if [ -n "$success" ]; then
echo "Maven check all versions have been bumped appropriately appears to have completed successfully"
Expand Down

0 comments on commit fe2d38e

Please sign in to comment.