mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00

This commit runs GitHub actions for code cleanliness. Because this includes compare and replace build, this verifies that the commit is buildable and clean. The natives are not rebuilt here (yet) because the GitHub actions runner does not have the cross compiler tools installed. Part of migration to GitHub - Issue #32
104 lines
4.5 KiB
Bash
Executable file
104 lines
4.5 KiB
Bash
Executable file
#!/bin/bash
|
|
###############################################################################
|
|
# Copyright (c) 2018, 2020 Kichwa Coders Ltd and others.
|
|
#
|
|
# This program and the accompanying materials
|
|
# are made available under the terms of the Eclipse Public License 2.0
|
|
# which accompanies this distribution, and is available at
|
|
# https://www.eclipse.org/legal/epl-2.0/
|
|
#
|
|
# SPDX-License-Identifier: EPL-2.0
|
|
###############################################################################
|
|
|
|
set -e
|
|
|
|
##
|
|
# Check the features are all branded and all content has proper licenses
|
|
##
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
${DIR}/check_features.sh
|
|
${DIR}/check_license.sh
|
|
|
|
##
|
|
# The next set of scripts automatically apply formatting and other rules
|
|
# to CDT. At the end of this, git repo is checked for no diffs.
|
|
##
|
|
${DIR}/do_all_code_cleanups.sh
|
|
|
|
##
|
|
# Check that none of the above caused any changes
|
|
##
|
|
if test -z "$(git status -s)"; then
|
|
echo "Tree looks clean!"
|
|
else
|
|
echo "Tree is dirty - something needs to be cleaned up in your commit (more info below)"
|
|
echo "Result of git status"
|
|
git status
|
|
echo "Result of git diff"
|
|
git diff
|
|
echo "Tree is dirty - something needs to be cleaned up in your commit (see above for git status/diff). The 'something'"
|
|
echo "is likely a misformatted file, extra whitespace at end of line, or something similar. The diff above"
|
|
echo "shows what changes you need to apply to your patch to get it past the code cleanliness check."
|
|
exit 1
|
|
fi
|
|
|
|
##
|
|
# Error out if there are dependencies that are not allowed in the dlls, exes, sos
|
|
##
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
echo "Checking dependencies of all .dll, .exe and .so files in CDT to make"
|
|
echo "sure no dependencies on unexpected or newer libraries are accidentally"
|
|
echo "introduced."
|
|
${DIR}/check_dll_dependencies.sh
|
|
${DIR}/check_glibc_dependencies.sh
|
|
|
|
|
|
##
|
|
# Make sure all versions have been bumped appropriately compared to the baseline
|
|
##
|
|
logfile=baseline-compare-and-replace.log
|
|
echo "Running 'mvn verify -P baseline-compare-and-replace' to make sure all versions"
|
|
echo "have been appropriately incremented. The check output is very verbose, so it is"
|
|
echo "redirected to ${logfile} which is archived as part of the build artifacts."
|
|
if ${MVN:-mvn} \
|
|
clean verify -B -V --fail-at-end \
|
|
-DskipDoc=true \
|
|
-DskipTests=true \
|
|
-P baseline-compare-and-replace >${logfile} 2>&1; then
|
|
echo "Maven check all versions have been bumped appropriately appears to have completed successfully"
|
|
else
|
|
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 "The following bundles are missing a service segment version bump:"
|
|
for bundle in $bundles_only_qualifier_changed; do
|
|
echo " - $bundle"
|
|
done
|
|
echo "Please bump service segment by 100 if on master branch"
|
|
echo "The log of this build is part of the artifacts"
|
|
echo "See: https://wiki.eclipse.org/Version_Numbering#When_to_change_the_service_segment"
|
|
echo
|
|
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 "The following bundles have same version as baseline, but different contents:"
|
|
for bundle in $bundles_same_version_different_content; do
|
|
echo " - $bundle"
|
|
done
|
|
echo "This can happen for a variety of reasons:"
|
|
echo " - The comparison filters in the root pom.xml are not working"
|
|
echo " - Different versions of Java are being used to compile compared to the baseline"
|
|
echo " - A dependency has changed causing the generated classes to be different"
|
|
echo "The log of this build is part of the artifacts"
|
|
echo "Please bump service segment by 100 if on master branch"
|
|
echo "See: https://wiki.eclipse.org/Version_Numbering#When_to_change_the_service_segment"
|
|
echo
|
|
fi
|
|
|
|
if [ -z "$bundles_only_qualifier_changed" ] && [ -z "$bundles_same_version_different_content" ]; then
|
|
echo "Maven 'check all versions have been bumped appropriately' failed! Please see the"
|
|
echo "log of the failed maven run which is available as part of the artifacts in a"
|
|
echo "file called baseline-compare-and-replace.log"
|
|
fi
|
|
exit 1
|
|
fi
|