1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 558827: Add cleanliness check for features

Change-Id: Id25d340506210206dcd8f0ce93f2e01a041d4e1e
This commit is contained in:
Jonah Graham 2020-01-07 06:36:50 -05:00
parent db974aa2a8
commit d1a15ef473
7 changed files with 161 additions and 0 deletions

View file

@ -2,6 +2,12 @@
set -e
##
# Check the features are all branded
##
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
${DIR}/check_features.sh
##
# The script is shared by all the CDT projects. When running
# local edits, you can, for example, do:

View file

@ -0,0 +1,63 @@
#!/bin/bash
###############################################################################
# Copyright (c) 2020 Kichwa Coders Canada Inc 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 -u # run with unset flag error so that missing parameters cause build failure
set -e # error out on any failed commands
#set -x # echo all commands used for debugging purposes
# Point ourselves to the script's directory (so it can be run "out-of-tree")
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
echo "Normalizing branding content on all features"
find * -name feature.xml -not -path */target/* | while read feature_xml; do
plugin=$(xmllint --xpath 'string(//feature/@plugin)' $feature_xml)
if [ -z "$plugin" ]; then
plugin=$(xmllint --xpath 'string(//feature/@id)' $feature_xml)
fi
feature_dir=$(dirname ${feature_xml})
if [ $(find * -name $plugin -type d -not -path */target/* | wc -l) -ne 1 ]; then
echo "Script failure - did not find unique dir for $plugin part of feature $feature_dir":
echo "This may mean the branding is missing, or not understood by the script.":
find * -name $plugin -type d
exit 1
fi
plugin_dir=$(find * -name $plugin -type d -not -path */target/*)
# echo Working on: $feature_xml 'whose plugin is' $plugin
cp releng/templates/feature/cdt_logo_icon32.png $plugin_dir
cp releng/templates/feature/about.mappings $plugin_dir
if [ -e ${plugin_dir}/welcome.xml ] ; then
cp releng/templates/feature/about.with_welcome.ini ${plugin_dir}/about.ini
else
cp releng/templates/feature/about.ini $plugin_dir
fi
feature_start_year=$(git log --reverse --format='%ad' --date="format:%Y" -- $feature_xml $plugin_dir | head -1)
feature_end_year=$(git log --format='%ad' --date="format:%Y" -- $feature_xml $plugin_dir | head -1)
feature_name=$(grep featureName= $feature_dir/feature.properties | sed '-es,featureName=,,')
export feature_start_year feature_end_year feature_name
envsubst '$feature_start_year $feature_end_year $feature_name' < \
releng/templates/feature/about.properties > \
${plugin_dir}/about.properties
for f in about.ini about.mappings about.properties cdt_logo_icon32.png; do
if ! grep $f ${plugin_dir}/build.properties > /dev/null; then
echo "Missing $f entry in $plugin/build.properties"
# cp ./build/org.eclipse.cdt.autotools.ui/build.properties ${plugin_dir}/build.properties
exit 1
fi
done
done

View file

@ -0,0 +1,24 @@
# about.ini
# contains information about a feature
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# "%key" are externalized strings defined in about.properties
# This file does not need to be translated.
# Property "aboutText" contains blurb for "About" dialog (translated)
aboutText=%blurb
# Property "windowImage" contains path to window icon (16x16)
# needed for primary features only
# Property "featureImage" contains path to feature image (32x32)
featureImage=cdt_logo_icon32.png
# Property "aboutImage" contains path to product image (500x330 or 115x164)
# needed for primary features only
# Property "appName" contains name of the application (translated)
# needed for primary features only
# Property "welcomePerspective" contains the id of the perspective in which the
# welcome page is to be opened.
# optional

View file

@ -0,0 +1,9 @@
# about.mappings
# contains fill-ins for about.properties
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file does not need to be translated.
# The following should contain the build version.
# e.g. "0=20200106-1728"
# This value will be added automatically via the build scripts
0=${buildId}

View file

@ -0,0 +1,32 @@
###############################################################################
# Copyright (c) ${feature_start_year}, ${feature_end_year} Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# 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
###############################################################################
# about.properties
# contains externalized strings for about.ini
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# fill-ins are supplied by about.mappings
# This file should be translated.
# NOTE TO TRANSLATOR: Please do not translate the featureVersion variable.
blurb=${feature_name}\n\
\n\
Version: {featureVersion}\n\
Build id: {0}\n\
\n\
Copyright (c) ${feature_start_year}, ${feature_end_year} Contributors to the Eclipse Foundation
\n\
See the NOTICE file(s) distributed with this work for additional\n\
information regarding copyright ownership.\n\
\n\
Visit http://www.eclipse.org/cdt

View file

@ -0,0 +1,27 @@
# about.ini
# contains information about a feature
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# "%key" are externalized strings defined in about.properties
# This file does not need to be translated.
# Property "aboutText" contains blurb for "About" dialog (translated)
aboutText=%blurb
# Property "windowImage" contains path to window icon (16x16)
# needed for primary features only
# Property "featureImage" contains path to feature image (32x32)
featureImage=cdt_logo_icon32.png
# Property "aboutImage" contains path to product image (500x330 or 115x164)
# needed for primary features only
# Property "appName" contains name of the application (translated)
# needed for primary features only
# Property "welcomePage" contains path to welcome page (special XML-based format)
welcomePage=$nl$/welcome.xml
# Property "welcomePerspective" contains the id of the perspective in which the
# welcome page is to be opened.
# optional

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB