From d874b1cc72f30218513001f16024e6765c2c47ed Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 13 Feb 2021 20:57:18 +0100 Subject: [PATCH] Added precompilation of frontend localization --- .../Building/scripts/compile-site-resources | 35 +++++++++++++++++++ BuildFiles/Building/scripts/postbuild-fixes | 8 +++++ BuildFiles/Building/scripts/prebuild-fixes | 3 ++ 3 files changed, 46 insertions(+) create mode 100755 BuildFiles/Building/scripts/compile-site-resources diff --git a/BuildFiles/Building/scripts/compile-site-resources b/BuildFiles/Building/scripts/compile-site-resources new file mode 100755 index 00000000..c8b6a4d1 --- /dev/null +++ b/BuildFiles/Building/scripts/compile-site-resources @@ -0,0 +1,35 @@ +#!/bin/bash + +# This script compiles all localization resources to binary satellite assemblies, +# to avoid sharing violations when just-in-time-compiling under Mono + +cd frontend/App_GlobalResources + +# Compile .resx to .resources + +find . -iname '*.resx' -exec resgen -compile {} \; +find . -iname '*.resx' -delete + +# Compile .resources to .resources.dll + +for F in *; do + if [ -d "$F" ]; then + # $F is a directory + cd $F + find . -iname '*.resources' -exec al -target:lib -culture:$F -embed:{} -out:{}.dll \; + cd .. + elif [[ $F == *.resources ]]; then + al -target:lib -culture:en-US -embed:$F -out:$F.dll + fi +done + +find . -iname '*.resources' -delete + +# Return to build location and copy results to bin folder + +cd .. +rsync -av --remove-source-files App_GlobalResources/ bin/ +rm -r App_GlobalResources/ +cd .. + + diff --git a/BuildFiles/Building/scripts/postbuild-fixes b/BuildFiles/Building/scripts/postbuild-fixes index 780f60cf..b858f176 100755 --- a/BuildFiles/Building/scripts/postbuild-fixes +++ b/BuildFiles/Building/scripts/postbuild-fixes @@ -2,6 +2,14 @@ # This file is to be run in the build directory, after publication of the finished build there. +# =================================================== +# COMPILE LOCALIZATION FILES +# =================================================== + +./compile-site-resources + + + # =================================================== # FRONTEND FIXES # =================================================== diff --git a/BuildFiles/Building/scripts/prebuild-fixes b/BuildFiles/Building/scripts/prebuild-fixes index 37d48bea..1ac08e1a 100755 --- a/BuildFiles/Building/scripts/prebuild-fixes +++ b/BuildFiles/Building/scripts/prebuild-fixes @@ -2,6 +2,9 @@ # Rename resources, but only for the non-compiled web version +# Comment 2021-Feb-13: Does this do anything at all? It operates in Boneyard? Should that even be there? + + cd Boneyard/Site5 find . -iname 'Pages*.resx' -exec rename 's/Pages\.([A-Za-z_\.\-]+)\.resx/Pages_$1\.resx/' {} \;