1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/releng/scripts/do_rebuild_natives.sh
Torbjörn Svensson c5a53bb7fe Bug 568079: Format C/C++ code
Added a new C/C++ formatter profile called "Unmanaged profile 'CDT'"
(name stolen from the Java formatter) that is basically K&R with the
tweak of maxium line width set to 120 (same width as for .java files).

Added enforcement of the formatter during build.

libspawner.so/jnilib have differences because the re-formatting changes
line numbers and therefore the __LINE__ macro expands to a different
value.

Change-Id: Id3a0619cb31640c7817dc684c72139f90cab0fc6
Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
2020-10-24 16:54:40 -04:00

49 lines
1.8 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
##
# Make sure that natives are up to date
##
for p in native/org.eclipse.cdt.native.serial core/org.eclipse.cdt.core.native; do
echo "Rebuilding $p JNI headers to make sure they match source"
logfile=jni-headers-${p//\//-}.log
if ! ${MVN:-mvn} -B -V process-resources -DuseSimrelRepo -P jniheaders -f $p >${logfile} 2>&1; then
echo "Rebuilding of $p JNI headers failed. The log (${logfile}) is part of the artifacts of the build"
exit 1
fi
# Disabled until https://bugs.eclipse.org/bugs/show_bug.cgi?id=568137 is resolved
# # Need to apply format after header files are generated
# tmpws=$(mktemp -d)
# ${ECLIPSE:-~/buildtools/eclipse-cpp-2020-09/eclipse} \
# -consolelog -nosplash -application org.eclipse.cdt.core.CodeFormatter \
# -config $p/.settings/org.eclipse.cdt.core.prefs \
# $p/native_src -verbose -data $tmpws
# rm -rf $tmpws
echo "Rebuilding $p natives to make sure they match source"
logfile=make-natives-${p//\//-}.log
if ! make -C $p/native_src rebuild >${logfile} 2>&1; then
echo "Rebuilding of $p natives failed. The log (${logfile}) is part of the artifacts of the build"
exit 1
fi
done
##
# Mark Windows binaries as executable
##
echo "Marking Windows binaries as executable"
git ls-files -- \*.exe \*.dll | while read line; do
chmod +x "$line"
done