From d1a15ef4737adbed626b7b5fdc5164ae76641a05 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 7 Jan 2020 06:36:50 -0500 Subject: [PATCH] Bug 558827: Add cleanliness check for features Change-Id: Id25d340506210206dcd8f0ce93f2e01a041d4e1e --- releng/scripts/check_code_cleanliness.sh | 6 ++ releng/scripts/check_features.sh | 63 ++++++++++++++++++ releng/templates/feature/about.ini | 24 +++++++ releng/templates/feature/about.mappings | 9 +++ releng/templates/feature/about.properties | 32 +++++++++ .../templates/feature/about.with_welcome.ini | 27 ++++++++ releng/templates/feature/cdt_logo_icon32.png | Bin 0 -> 1885 bytes 7 files changed, 161 insertions(+) create mode 100755 releng/scripts/check_features.sh create mode 100644 releng/templates/feature/about.ini create mode 100644 releng/templates/feature/about.mappings create mode 100644 releng/templates/feature/about.properties create mode 100644 releng/templates/feature/about.with_welcome.ini create mode 100644 releng/templates/feature/cdt_logo_icon32.png 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 0000000000000000000000000000000000000000..470ca81b327234a519c2a443515e85727409b5f4 GIT binary patch literal 1885 zcmV-j2cr0iP)!H^1ntgMx$mQ^a+I-;$Ws3z8GYqX(iXst@JwrY8nR6N2$5hQdjkl4<{u^qpz z?d$vAABiL5I?h--Z9nP$^PTUU@Ao_B+;hGI{Evg&ZU?&_cApis05Hm7G%X$~QC}(f-LgFHq8$YV5GWUfO@Y&&e z=IeO2a}heb&KSCn2bXwkmWC&EjL}=EpQ_6Fbawo$X!6<%g2er^5|^HZlrrGdhzkH3D^y=pV@;xrv=WnFMDJJ zD2gd2D~gm!W&&?Sl0*9xMZBew*#QY*9F~UdHLg3mXj*3};HgaL$aw714n-B?#r#=; zAGG6#ZPjRfx|e>Q=-Pf(DlRKxYGUe>U8zj)F92XRRNZGY`@XMdZ7T?&SV_u_WcbPV zQ`z9*1UGyrmyexk@UA^Z2xW*QhMtS3ZyYR}FaTIsSpKmG12z+E?J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