diff --git a/releng/scripts/check_code_cleanliness.sh b/releng/scripts/check_code_cleanliness.sh index c056004d734..58217215cb5 100755 --- a/releng/scripts/check_code_cleanliness.sh +++ b/releng/scripts/check_code_cleanliness.sh @@ -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: diff --git a/releng/scripts/check_features.sh b/releng/scripts/check_features.sh new file mode 100755 index 00000000000..a831ca549bd --- /dev/null +++ b/releng/scripts/check_features.sh @@ -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 + diff --git a/releng/templates/feature/about.ini b/releng/templates/feature/about.ini new file mode 100644 index 00000000000..e07a7bb377e --- /dev/null +++ b/releng/templates/feature/about.ini @@ -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 diff --git a/releng/templates/feature/about.mappings b/releng/templates/feature/about.mappings new file mode 100644 index 00000000000..936a8039c3e --- /dev/null +++ b/releng/templates/feature/about.mappings @@ -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} diff --git a/releng/templates/feature/about.properties b/releng/templates/feature/about.properties new file mode 100644 index 00000000000..a6c2eaa7fcf --- /dev/null +++ b/releng/templates/feature/about.properties @@ -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 diff --git a/releng/templates/feature/about.with_welcome.ini b/releng/templates/feature/about.with_welcome.ini new file mode 100644 index 00000000000..656877d0afa --- /dev/null +++ b/releng/templates/feature/about.with_welcome.ini @@ -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 diff --git a/releng/templates/feature/cdt_logo_icon32.png b/releng/templates/feature/cdt_logo_icon32.png new file mode 100644 index 00000000000..470ca81b327 Binary files /dev/null and b/releng/templates/feature/cdt_logo_icon32.png differ