diff --git a/CONFIG.toml b/CONFIG.toml index d481829..99b2e6a 100644 --- a/CONFIG.toml +++ b/CONFIG.toml @@ -859,14 +859,6 @@ PROJECT_RELEASE_ARCHIVE = 'enabled' PROJECT_RELEASE_IPK = 'enabled' -# PROJECT_RELEASE_MSI -# The flag to package msi pipeline. -# -# To enable : fill in some string (e.g. 'enabled') -# To disable: leave it empty ('') -PROJECT_RELEASE_IPK = 'enabled' - - ############################# @@ -1381,6 +1373,292 @@ PROJECT_HOMEBREW_REPO_BRANCH = 'main' +########################### +# DISTRIBUTION - MSI # +########################### +# PROJECT_MSI_INSTALL_DIRECTORY +# Defines the primary directory installation value for installer execute +# sequences ('InstallExecuteSequence'). +# +# This field also acts as the flag for enabling or disabling the homebrew +# pipeline. +# +# To enable it: set the value as 'INSTALLDIR' +# To disable it: set it empty. +# +# Default is: 'INSTALLDIR' (enabled) +PROJECT_MSI_INSTALL_DIRECTORY = 'INSTALLDIR' + + +# PROJECT_MSI_ARP_INSTALL_LOCATION +# Defines the CustomAction's ID for installer execute sequences +# ('InstallExecuteSequence'). Unless absolute required, this value is best +# leave it as 'ARPINSTALLLOCATION' unchanged. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'ARPINSTALLLOCATION' +PROJECT_MSI_ARP_INSTALL_LOCATION = 'ARPINSTALLLOCATION' + + +# PROJECT_MSI_COMPRESSED_MODE +# Defines the compress mode for the installer. It STRICTLY accepts lowercase +# 'yes' or 'no' only. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'yes' +PROJECT_MSI_COMPRESSED_MODE = 'yes' + + +# PROJECT_MSI_INSTALLER_VERSION_UNIX +# Defines the MSI installer version for unix workspace (where WiX is not used). +# +# This field CANNOT BE LEFT EMPTY and is only for unix packagers. +# +# Default is: '400' (Windows Installer 4.0 - included in Vista) +PROJECT_MSI_INSTALLER_VERSION_UNIX = '400' + + +# PROJECT_MSI_INSTALLER_VERSION_WINDOWS +# Defines the MSI installer version for windows workspace (where WiX is used). +# +# This field CANNOT BE LEFT EMPTY and is only for windows packagers. +# +# Default is: '500' (WiX4) +PROJECT_MSI_INSTALLER_VERSION_WINDOWS = '500' + + +# PROJECT_MSI_CODEPAGE +# Defines the charset of the installer. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: '65001' (UTF-8) +PROJECT_MSI_CODEPAGE = '65001' + + +# PROJECT_MSI_INSTALLER_SCOPE +# Defines the installer scope. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'perMachine' +PROJECT_MSI_INSTALLER_SCOPE = 'perMachine' + + +# PROJECT_MSI_REGISTRY_NAME +# Defines the name of the registry. Unless aboslute needed, it's best to leave +# this as it is. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'InstallLocation' +PROJECT_MSI_REGISTRY_NAME = 'InstallLocation' + + +# PROJECT_MSI_REGISTRY_KEY +# Defines the location of the registry. +# +# This field is shared for both unix and windows packagers. +# +# If this field is left empty, AutomataCI shall generate a default version +# using the following pattern: +# 'Software\${PROJECT_SCOPE}\InstalledProducts\${PROJECT_SKU_TITLECASE}' +# +# Default is: '' (leave it automated) +PROJECT_MSI_REGISTRY_KEY = '' + + +# PROJECT_MSI_FEATURES_ID +# The ID for the entire installer's feature list. This the the root of the list +# consisting of main feature list, optional features list, and etc. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesAll' +PROJECT_MSI_FEATURES_ID = 'FeaturesAll' + + +# PROJECT_MSI_MAIN_FEATURE_ID +# The ID for the compulsory features list. This consists of all the MUST HAVE +# components to be installed at the client side. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesMain' +PROJECT_MSI_MAIN_FEATURE_ID = 'FeaturesMain' + + +# PROJECT_MSI_REGISTRIES_ID +# The ID for the compulsory main registries component. This handles the main +# registeries internal implementations. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'RegValInstallLocation_comp' +PROJECT_MSI_REGISTRIES_ID = 'RegValInstallLocation_comp' + + +# PROJECT_MSI_REGISTRIES_GUID +# The unique GUID for the compulsory main registries component. Its value is +# similar to a UUID type. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# When in doubt, use asterisk instead ('*'). +# +# Default is: '*' +PROJECT_MSI_REGISTRIES_GUID = '*' + + +# PROJECT_MSI_BIN_FEATURE_ID +# The ID for the executables features list. When available, the executables will +# be in this component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesBin' +PROJECT_MSI_BIN_FEATURE_ID = 'FeaturesBin' + + +# PROJECT_MSI_BIN_COMPONENT_ID +# The ID for the executables component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'ComponentBin' +PROJECT_MSI_BIN_COMPONENT_ID = 'ComponentBin' + + +# PROJECT_MSI_BIN_COMPONENT_GUID +# The unique GUID for the executables component. Its value is similar to an UUID +# type. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# When in doubt, use asterisk instead ('*'). +# +# Default is: '*' +PROJECT_MSI_BIN_COMPONENT_GUID = '*' + + +# PROJECT_MSI_CONFIG_FEATURE_ID +# The ID for the config files features list. When available, the config files +# will be in this component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesBin' +PROJECT_MSI_CONFIG_FEATURE_ID = 'FeaturesConfig' + + +# PROJECT_MSI_CONFIG_COMPONENT_ID +# The ID for the config files component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'ComponentConfig' +PROJECT_MSI_CONFIG_COMPONENT_ID = 'ComponentConfig' + + +# PROJECT_MSI_CONFIG_COMPONENT_GUID +# The unique GUID for the config files component. Its value is similar to +# an UUID type. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# When in doubt, use asterisk instead ('*'). +# +# Default is: '*' +PROJECT_MSI_CONFIG_COMPONENT_GUID = '*' + + +# PROJECT_MSI_LIB_FEATURE_ID +# The ID for the libraries features list. When available, the libraries will +# be in this component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesLib' +PROJECT_MSI_LIB_FEATURE_ID = 'FeaturesLib' + + +# PROJECT_MSI_LIB_COMPONENT_ID +# The ID for the libraries component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'ComponentLib' +PROJECT_MSI_LIB_COMPONENT_ID = 'ComponentLib' + + +# PROJECT_MSI_LIB_COMPONENT_GUID +# The unique GUID for the libraries component. Its value is similar to an UUID +# type. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# When in doubt, use asterisk instead ('*') +# +# Default is: '*' +PROJECT_MSI_LIB_COMPONENT_GUID = '*' + + +# PROJECT_MSI_DOCS_FEATURE_ID +# The ID for the documenations features list. When available, the documents will +# be in this component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'FeaturesDocs' +PROJECT_MSI_DOCS_FEATURE_ID = 'FeaturesDocs' + + +# PROJECT_MSI_DOCS_COMPONENT_ID +# The ID for the documentations component. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# Default is: 'ComponentDocs' +PROJECT_MSI_DOCS_COMPONENT_ID = 'ComponentDocs' + + +# PROJECT_MSI_DOCS_COMPONENT_GUID +# The unique GUID for the documentations component. Its value is similar to an +# UUID type. +# +# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows +# packagers. +# +# When in doubt, use asterisk instead ('*'). +# +# Default is: '*' +PROJECT_MSI_LIB_COMPONENT_GUID = '*' + + + + ########################## # DISTRIBUTION - RPM # ########################## diff --git a/automataCI/_package-msi_unix-any.sh b/automataCI/_package-msi_unix-any.sh index f6b4363..f10633f 100644 --- a/automataCI/_package-msi_unix-any.sh +++ b/automataCI/_package-msi_unix-any.sh @@ -12,9 +12,12 @@ # the License. . "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/sync.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/checksum/shasum.sh" . "${LIBS_AUTOMATACI}/services/compilers/msi.sh" +. "${LIBS_AUTOMATACI}/services/hestiaLOCALE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaI18N/Vanilla.sh.ps1" @@ -28,48 +31,556 @@ fi -SUBROUTINE_Package_MSI() { - # parse input - __line="$1" +PACKAGE_Seal_MSI() { + __workspace="$1" + __output_directory="$2" - __target="${__line%%|*}" - __line="${__line#*|}" - - __dest="${__line%%|*}" - __line="${__line#*|}" - __log="${__line%%|*}" - - __subject="${__log##*/}" - __subject="${__subject%.*}" - __subject="${__subject#*msi-wxs_}" - - __arch="${__subject##*windows-}" - __arch="${__arch%%_*}" + # obtain buildable target architecture + _target_arch="$(FS_Get_File "$__workspace")" + I18N_Check "MSI: '$_target_arch'" + case "$_target_arch" in + amd64) + ;; + *) + I18N_Check_Incompatible_Skipped + return 0 # wixl does not support other arch aside amd64 + ;; + esac - # execute - I18N_Package "$__subject" - MSI_Compile "$__target" "$__arch" &> "$__log" + # validate icon.ico available + __icon_filepath="${__workspace}/icon.ico" + I18N_Check "$__icon_filepath" + FS_Is_File "$__icon_filepath" if [ $? -ne 0 ]; then - I18N_Package_Failed + I18N_Check_Failed return 1 fi - __target="$(FS_Extension_Replace "$__target" ".wxs" ".msi")" - I18N_Export "$__subject" - if [ ! -f "$__target" ]; then - I18N_Export_Missing "$__subject" + + # validate msi-banner.jpg is available + __banner_filepath="${__workspace}/msi-banner.jpg" + I18N_Check "$__banner_filepath" + FS_Is_File "$__banner_filepath" + if [ $? -ne 0 ]; then + I18N_Check_Failed return 1 fi - FS_Copy_File "$__target" "${__dest}/${__target##*/}" &> "$__log" + + # validate msi-dialog.jpg is available + __dialog_filepath="${__workspace}/msi-dialog.jpg" + I18N_Check "$__dialog_filepath" + FS_Is_File "$__dialog_filepath" if [ $? -ne 0 ]; then - I18N_Export_Failed "$__subject" + I18N_Check_Failed return 1 fi + # create wxs scripts by languages + __old_IFS="$IFS" + while IFS="" read -r __language || [ -n "$__language" ]; do + # formulate destination path + __dest="${__workspace}/${PROJECT_SKU}_${__language}_windows-${_target_arch}.wxs" + I18N_Check_Availability "$__dest" + FS_Is_File "$__dest" + if [ $? -eq 0 ]; then + I18N_Check_Available_Skipped + continue ## user supplied - skipping + fi + + + # creating wxs headers + I18N_Create "$__dest" + FS_Write_File "$__dest" "\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CMDLINE_${PROJECT_MSI_INSTALL_DIRECTORY} + + + + CMDLINE_${PROJECT_MSI_INSTALL_DIRECTORY} + + + + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + __source="${__workspace}/bin" + FS_Is_Directory_Empty "$__source" + if [ $? -ne 0 ]; then + ## write the opener + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + ## loop through each file and create the following + for __file in "${__source}/"*; do + FS_Is_File "$__file" + if [ $? -ne 0 ]; then + continue + fi + + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + done + + ## write the closure + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + fi + + __source="${__workspace}/config" + FS_Is_Directory_Empty "$__source" + if [ $? -ne 0 ]; then + ## write the opener + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + ## loop through each file and create the following + for __file in "${__source}/"*; do + FS_Is_File "$__file" + if [ $? -ne 0 ]; then + continue + fi + + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + done + + ## write the closure + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + fi + + __source="${__workspace}/lib" + FS_Is_Directory_Empty "$__source" + if [ $? -ne 0 ]; then + ## write the opener + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + ## loop through each file and create the following + for __file in "${__source}/"*; do + FS_Is_File "$__file" + if [ $? -ne 0 ]; then + continue + fi + + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + done + + ## write the closure + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + fi + + __source="${__workspace}/docs" + FS_Is_Directory_Empty "$__source" + if [ $? -ne 0 ]; then + ## write the opener + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + ## loop through each file and create the following + for __file in "${__source}/"*; do + FS_Is_File "$__file" + if [ $? -ne 0 ]; then + continue + fi + + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + done + + ## write the closure + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + fi + + + # close directory section + FS_Append_File "$__dest" "\ + + + + + + + + + + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # define all feature components + FS_Append_File "$__dest" "\ + + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # write bin feature list + FS_Is_Directory_Empty "${__workspace}/bin" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + + # write config feature list + FS_Is_Directory_Empty "${__workspace}/config" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + + # write lib feature list + FS_Is_Directory_Empty "${__workspace}/lib" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + + # write docs feature list + FS_Is_Directory_Empty "${__workspace}/docs" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + + # close feature list + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # conclude the wxs write-up + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + done < "${__log}" + # validate msi-dialog.jpg is available + $__dialog_filepath = "${__workspace}\msi-banner.jpg" + $null = I18N-Check "${__dialog_filepath}" + $___process = FS-Is-File "${__dialog_filepath}" if ($___process -ne 0) { - $null = I18N-Package-Failed + $null = I18N-Check-Failed return 1 } - $__target = FS-Extension-Replace "${__target}" ".wxs" ".msi" - $null = I18N-Export "${__target}" - if (-not (Test-Path "${__target}")) { - $null = I18N-Export-Missing "${__subject}" - return 1 + + # create wxs scripts by languages + foreach ($__language in $(hestiaI18N-Get-Languages-List)) { + # validate LICENSE_[LANG}.rtf is available + $__license_filepath = "${__workspace}\docs\LICENSE_${__language}.rtf" + $null = I18N-Check "${__license_filepath}" + $___process = FS-Is-File "${__license_filepath}" + if ($___process -ne 0) { + $null = I18N-Check-Failed + + ## look for generic one as last resort + $__license_filepath = "${__workspace}\docs\LICENSE.rtf" + $null = I18N-Check "${__license_filepath}" + $___process = FS-Is-File "${__license_filepath}" + if ($___process -ne 0) { + $null = I18N-Check-Failed-Skipped + continue ## no license file - skipping + } + } + + + # formulate destination path + $__dest = "${env:PROJECT_SKU}_${__language}_windows-${_target_arch}.wxs" + $__dest = "${__workspace}\${__dest}" + $null = I18N-Check-Availability "${__dest}" + $___process = FS-Is-File "${__dest}" + if ($___process -ne 0) { + $null = I18N-Check-Available-Skipped + continue ## user supplied - skipping + } + + + # creating wxs headers + $null = I18N-Create "${__dest}" + $___process = FS-Write-File "${__dest}" @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + $__source = "${__workspace}\bin" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + $__source = "${__workspace}\config" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + $__source = "${__workspace}\lib" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # Close directory tree definitions + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + ## begin assemble bin/* files + $__source = "${__workspace}\bin" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + ## write the opener + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + ## loop through each file and create the following + foreach ($__file in (Get-ChildItem "${__source}" -File)) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + } + + ## write the closure + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + ## begin assemble config/* files + $__source = "${__workspace}\config" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + ## write the opener + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + ## loop through each file and create the following + foreach ($__file in (Get-ChildItem "${__source}" -File)) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + } + + ## write the closure + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + ## begin assemble lib/* files + $__source = "${__workspace}\lib" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + ## write the opener + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + ## loop through each file and create the following + foreach ($__file in (Get-ChildItem "${__source}" -File)) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + } + + ## write the closure + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + ## begin assemble docs/* files + $__source = "${__workspace}\docs" + $___process = FS-Is-Directory-Empty "${__source}" + if ($___process -ne 0) { + ## write the opener + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + ## loop through each file and create the following + foreach ($__file in (Get-ChildItem "${__source}" -File)) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + } + + ## write the closure + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # create registry key + $___process = FS-Append-File "${__dest}" @" + + + + + + + + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # Define all feature components + $___process = FS-Append-File "${__dest}" @" + + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # write bin feature list + $___process = FS-Is-Directory-Empty "${__workspace}\bin" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # write config feature list + $___process = FS-Is-Directory-Empty "${__workspace}\config" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # write lib feature list + $___process = FS-Is-Directory-Empty "${__workspace}\lib" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # write docs feature list + $___process = FS-Is-Directory-Empty "${__workspace}\docs" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + + # close feature list + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # Add standard UI support + $___process = FS-Append-File "${__dest}" @" + + + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # conclude the wxs write-up + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } } - $___process = FS-Copy-File ` - "${__target}" ` - "${__dest}\$(Split-Path -Leaf -Path "${__target}")" - if ($___process -ne 0) { - $null = I18N-Export-Failed "${__subject}" - return 1 + + # begin packages compilation + Get-ChildItem -Path "${__workspace}" -File ` + | Where-Object { ($_.Name -like "*.wxs") } ` + | ForEach-Object { $__line = $_.FullName + $null = I18N-Package "${__line}" + $___process = MSI-Compile "${__line}" "${_target_arch}" + if ($___process -ne 0) { + $null = I18N-Package-Failed + return 1 + } + } + + + # begin export packages + Get-ChildItem -Path "${__workspace}" -File ` + | Where-Object { ($_.Name -like "*.msi") } ` + | ForEach-Object { $__line = $_.FullName + $__dest = "${__output_directory}\$(FS-Get-File "${__line}")" + + $null = I18N-Export "${__dest}" + $___process = MSI-Compile "${__line}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 + } } @@ -100,6 +701,7 @@ function PACKAGE-Run-MSI { $_target_filename = $__list[2] $_target_os = $__list[3] $_target_arch = $__list[4] + $_src = $__list[5] # validate input @@ -113,25 +715,11 @@ function PACKAGE-Run-MSI { # prepare workspace and required values $null = I18N-Create-Package "MSI" - $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-msi-${_src}" - $null = I18N-Remake "${_src}" - $___process = FS-Remake-Directory "${_src}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - $__control_directory = "${_src}\.automataCI" - $null = I18N-Remake "${__control_directory}" - $___process = FS-Remake-Directory "${__control_directory}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - $__parallel_control = "${__control_directory}\control-parallel.txt" - $null = FS-Remove-Silently "${__parallel_control}" + $_src = "${_src}\${_target_arch}" + $null = FS-Make-Directory "${_src}\bin" + $null = FS-Make-Directory "${_src}\lib" + $null = FS-Make-Directory "${_src}\config" + $null = FS-Make-Directory "${_src}\docs" # copy all complimentary files to the workspace @@ -162,54 +750,6 @@ function PACKAGE-Run-MSI { }} - # archive the assembled payload - foreach ($__recipe in (Get-ChildItem -Path "${_src}" -Filter *.wxs)) { - $___process = FS-Is-File "${__recipe}" - if ($___process -ne 0) { - continue - } - - - # register for packaging in parallel - $null = I18N-Sync-Register "${__recipe}" - $__log = Split-Path -Leaf -Path "${__recipe}" - $__log = FS-Extension-Remove "${__log}" "*" - $__log = "${__control_directory}\msi-wxs_${__log}.log" - $___process = FS-Append-File "${__parallel_control}" @" -${__recipe}|${_dest}|${__log} -"@ - if ($___process -ne 0) { - return 1 - } - } - - $null = I18N-Sync-Run - $___process = FS-Is-File "${__parallel_control}" - if ($___process -eq 0) { - $___process = SYNC-Exec-Parallel ` - ${function:SUBROUTINE-Package-MSI}.ToString() ` - "${__parallel_control}" ` - "${__control_directory}" ` - "$([System.Environment]::ProcessorCount)" - } else { - $null = I18N-Sync-Run-Skipped - $___process = 0 - } - - foreach ($__log in (Get-ChildItem -Path "${__control_directory}" -Filter *.log)) { - $null = I18N-Sync-Report-Log "${__log}" - foreach ($__line in (Get-Content "${__log}")) { - $null = I18N-Status-Print plain "${__line}" - } - $null = I18N-Newline - } - - # report status - if ($___process -ne 0) { - $null = I18N-Sync-Failed - return 1 - } - return 0 } diff --git a/automataCI/ci.ps1 b/automataCI/ci.ps1 index 5f06254..ec6f0e4 100644 --- a/automataCI/ci.ps1 +++ b/automataCI/ci.ps1 @@ -70,6 +70,7 @@ if (Test-Path ".\ci.ps1") { } ${env:LIBS_AUTOMATACI} = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_AUTOMATA}" +${env:LIBS_HESTIA} = "${env:LIBS_AUTOMATACI}\services" diff --git a/automataCI/ci.sh b/automataCI/ci.sh index 7e68f21..0f2bfec 100644 --- a/automataCI/ci.sh +++ b/automataCI/ci.sh @@ -63,6 +63,7 @@ else fi export LIBS_AUTOMATACI="${PROJECT_PATH_ROOT}/${PROJECT_PATH_AUTOMATA}" +export LIBS_HESTIA="${LIBS_AUTOMATACI}/services" diff --git a/automataCI/package_unix-any.sh b/automataCI/package_unix-any.sh index 7e7a7c6..b383a95 100644 --- a/automataCI/package_unix-any.sh +++ b/automataCI/package_unix-any.sh @@ -67,7 +67,7 @@ if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne 0 ]; then HOMEBREW_WORKSPACE="packagers-homebrew-${PROJECT_SKU}" I18N_Setup "$HOMEBREW_WORKSPACE" HOMEBREW_WORKSPACE="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${HOMEBREW_WORKSPACE}" - FS_Remake_Directory "${HOMEBREW_WORKSPACE}" + FS_Remake_Directory "$HOMEBREW_WORKSPACE" if [ $? -ne 0 ]; then I18N_Setup_Failed return 1 @@ -75,6 +75,23 @@ if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne 0 ]; then fi +if [ "$(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY")" -ne 0 ]; then + MSI_WORKSPACE="packagers-msi-${PROJECT_SKU}" + I18N_Setup "$MSI_WORKSPACE" + MSI_WORKSPACE="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${MSI_WORKSPACE}" + FS_Remake_Directory "$MSI_WORKSPACE" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_MSI_REGISTRY_KEY") -eq 0 ]; then + PROJECT_MSI_REGISTRY_KEY="\ +Software\\\\${PROJECT_SCOPE}\\\\InstalledProducts\\\\${PROJECT_SKU_TITLECASE}" + fi +fi + + if [ "$(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL")" -ne 0 ]; then FLATPAK_REPO="flatpak-repo" I18N_Setup "$FLATPAK_REPO" @@ -373,13 +390,13 @@ ${__common}|${__log}|PACKAGE_Run_LIB fi # NOTE: MSI only works in windows - if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_MSI") -ne 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY") -ne 0 ]; then case "$TARGET_OS" in any|windows) __log="msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" __log="${__log_directory}/${__log}" - FS_Append_File "$__serial_control" "\ -${__common}|${__log}|PACKAGE_Run_MSI + FS_Append_File "$__parallel_control" "\ +${__common}|${MSI_WORKSPACE}|${__log}|PACKAGE_Run_MSI " if [ $? -ne 0 ]; then return 1 @@ -467,6 +484,26 @@ if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -ne 0 ]; then fi +if [ "$(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY")" -ne 0 ]; then + I18N_Newline + I18N_Newline + + # seal all MSI packages + for _candidate in "${MSI_WORKSPACE}/"*; do + FS_Is_Directory "$_candidate" + if [ $? -ne 0 ]; then + continue + fi + + I18N_Newline + PACKAGE_Seal_MSI "$_candidate" "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" + if [ $? -ne 0 ];then + return 1 + fi + done +fi + + I18N_Sync_Run_Series FS_Is_File "$__serial_control" if [ $? -eq 0 ]; then diff --git a/automataCI/package_windows-any.ps1 b/automataCI/package_windows-any.ps1 index 05abb63..eb3fed7 100644 --- a/automataCI/package_windows-any.ps1 +++ b/automataCI/package_windows-any.ps1 @@ -55,6 +55,25 @@ if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { } +if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { + $MSI_WORKSPACE = "packagers-msi-${env:PROJECT_SKU}" + $null = I18N-Setup "${MSI_WORKSPACE}" + $MSI_WORKSPACE = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${MSI_WORKSPACE}" + $___process = FS-Remake-Directory "${MSI_WORKSPACE}" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + + if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_REGISTRY_KEY}") -eq 0) { + ${env:PROJECT_MSI_REGISTRY_KEY} = @" +Software\${env:PROJECT_SCOPE}\InstalledProducts\${env:PROJECT_SKU_TITLECASE} +"@ + } +} + + if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0) { $FLATPAK_REPO = "flatpak-repo" $null = I18N-Setup "${FLATPAK_REPO}" @@ -165,7 +184,7 @@ function SUBROUTINE-Package { $null = . "${env:LIBS_AUTOMATACI}\_package-ipk_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-lib_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-msi_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-pdf_windows-any.ps1" + $null = . "${env:LIBS_AUTOMATACI}\_package-pypi_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-rpm_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-sourcing_windows-any.ps1" @@ -388,13 +407,13 @@ ${__common}|${__log}|PACKAGE-Run-LIB } # NOTE: MSI only works in windows - if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_MSI}") -ne 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { switch ("${TARGET_OS}") { { $_ -in "any", "windows" } { $__log = "msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__serial_control}" @" -${__common}|${__log}|PACKAGE-Run-MSI + $___process = FS-Append-File "${__parallel_control}" @" +${__common}|${MSI_WORKSPACE}|${__log}|PACKAGE-Run-MSI "@ if ($___process -ne 0) { @@ -484,6 +503,24 @@ if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { } +if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { + $null = I18N-Newline + $null = I18N-Newline + + + # seal all MSI packages + Get-ChildItem -Path "${MSI_WORKSPACE}" -Directory ` + | ForEach-Object { $_candidate = $_.FullName + $null = I18N-Newline + $___process = Package-Seal-MSI "${_candidate}" ` + "${env:PROJEC_PATH_ROOT}\${env:PROJECT_PATH_PKG}" + if ($___process -ne 0) { + return 1 + } + } +} + + $null = I18N-Sync-Run-Series $___process = FS-Is-File "${__serial_control}" if ($___process -eq 0) { diff --git a/automataCI/services/compilers/msi.ps1 b/automataCI/services/compilers/msi.ps1 index 4b032a3..78abfee 100644 --- a/automataCI/services/compilers/msi.ps1 +++ b/automataCI/services/compilers/msi.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -21,8 +21,7 @@ function MSI-Compile { param ( [string]$___target, - [string]$___arch, - [string]$___lang + [string]$___arch ) @@ -46,15 +45,10 @@ function MSI-Compile { return 1 } - if ($(STRINGS-Is-Empty "${___lang}") -eq 0) { - return 1 - } - # execute $___arguments = "build " ` + "-arch ${___arch} " ` - + "-culture ${___lang} " ` + "-out `"" + $(FS-Extension-Replace "${___target}" ".wxs" ".msi") + "`" " $___extensions = $(Split-Path -Parent -Path "${___target}") + "\ext" @@ -67,6 +61,7 @@ function MSI-Compile { $___arguments += "`"${___target}`" " $___process = OS-Exec "wix" "${___arguments}" + $null = Write-Host "DEBUG: cmd |wix ${___argments}" if ($___process -ne 0) { return 1 } @@ -79,6 +74,26 @@ function MSI-Compile { +function MSI-Get-Directory-Program-Files { + param( + [string]$___arch + ) + + + # execute + switch ("${___arch}") { + { $_ -in "amd64", "arm64" } { + return "ProgramFiles64Folder" + } { $_ -in "i386", "arm" } { + return "ProgramFilesFolder" + } default { + return "ProgramFiles6432Folder" + }} +} + + + + function MSI-Install-Silent() { param( [string]$___installer diff --git a/automataCI/services/compilers/msi.sh b/automataCI/services/compilers/msi.sh index b361a8d..bee865d 100644 --- a/automataCI/services/compilers/msi.sh +++ b/automataCI/services/compilers/msi.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -58,6 +58,31 @@ MSI_Compile() { +MSI_Get_Directory_Program_Files() { + #___arch="$1" + + + # execute + case "$1" in + amd64|arm64) + printf -- "ProgramFiles64Folder" + ;; + i386|arm) + printf -- "ProgramFilesFolder" + ;; + *) + printf -- "" + ;; + esac + + + # report status + return 0 +} + + + + MSI_Install_Silent() { #___installer="$1" diff --git a/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 b/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 new file mode 100755 index 0000000..054add3 --- /dev/null +++ b/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 @@ -0,0 +1,64 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Get-Languages-List { + return @( + "en", + "zh-hans" + ) +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Get_Languages_List() { + printf -- "%s" "\ +en +zh-hans +" +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 new file mode 100755 index 0000000..47f41d2 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-All-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "包装里的所有元件。" + } default { + # fallback to default english + return "All components in this package." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_All_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "包装里的所有元件。" + ;; + *) + # fallback to default english + printf -- "%b" "All components in this package." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 new file mode 100755 index 0000000..6f5a520 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-All-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有元件" + } default { + # fallback to default english + return "All Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_All_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有元件" + ;; + *) + # fallback to default english + printf -- "%b" "All Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 new file mode 100755 index 0000000..a69b790 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 @@ -0,0 +1,91 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Already-Latest-Version() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" + } default { + # fallback to default english + return "You have the same/latest version. No further action is required." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Already_Latest_Version() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" + ;; + *) + # fallback to default english + printf -- "%b" "You have the same/latest version. No further action is required." + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 new file mode 100755 index 0000000..d170f5f --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Bin-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有可启动的软件产品。" + } default { + # fallback to default english + return "All executable software products." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Bin_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有可启动的软件产品。" + ;; + *) + # fallback to default english + printf -- "%b" "All executable software products." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 new file mode 100755 index 0000000..cc9bac9 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Bin-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "软件元件" + } default { + # fallback to default english + return "Executables Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Bin_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "软件元件" + ;; + *) + # fallback to default english + printf -- "%b" "Executables Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 new file mode 100755 index 0000000..2820d6a --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Config-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有设定的文件。" + } default { + # fallback to default english + return "All configuration files." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Config_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有设定的文件。" + ;; + *) + # fallback to default english + printf -- "%b" "All configuration files." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 new file mode 100755 index 0000000..ce0214c --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Config-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "设定元件" + } default { + # fallback to default english + return "Configurations Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Config_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "设定元件" + ;; + *) + # fallback to default english + printf -- "%b" "Configurations Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 new file mode 100755 index 0000000..cfdd493 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Docs-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有笔记书写文稿。" + } default { + # fallback to default english + return "All articles and documentations." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Docs_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有笔记书写文稿。" + ;; + *) + # fallback to default english + printf -- "%b" "All articles and documentations." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 new file mode 100755 index 0000000..f6133dd --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Docs-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "书写笔记元件" + } default { + # fallback to default english + return "Documentations Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Docs_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "书写笔记元件" + ;; + *) + # fallback to default english + printf -- "%b" "Documentations Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 new file mode 100755 index 0000000..8f480f3 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Lib-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有可开发的码库类产品。" + } default { + # fallback to default english + return "All importable libraries products." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Lib_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有可开发的码库类产品。" + ;; + *) + # fallback to default english + printf -- "%b" "All importable libraries products." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 new file mode 100755 index 0000000..b438df2 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Lib-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "代码库类型元件" + } default { + # fallback to default english + return "Libraries Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Lib_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "代码库类型元件" + ;; + *) + # fallback to default english + printf -- "%b" "Libraries Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 new file mode 100755 index 0000000..644af0c --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Main-Components-Description() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "所有第一重要无法缺乏的产品。" + } default { + # fallback to default english + return "All critical and core products." + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Main_Components_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "所有第一重要无法缺乏的产品。" + ;; + *) + # fallback to default english + printf -- "%b" "All critical and core products." + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 new file mode 100755 index 0000000..5eabc9d --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Main-Components-Title() { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "zh-hans" { + # 简体中文 + return "主要元件" + } default { + # fallback to default english + return "Main Components" + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Main_Components_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + printf -- "%b" "主要元件" + ;; + *) + # fallback to default english + printf -- "%b" "Main Components" + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 b/automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 new file mode 100755 index 0000000..6a90b68 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 @@ -0,0 +1,209 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Only-Install-On-Windows() { + param( + [string]$___locale, + [string]$___arch + ) + + + # execute + switch (${___locale}) { + "zh-hans" { + # 简体中文 + switch ("${___arch}") { + "32" { + $null = I18N-Status-Print info @" +真遗憾。您只能在32位微软Windows操作系统里安装。 +"@ + } "64" { + $null = I18N-Status-Print info @" +真遗憾。您只能在64位微软Windows操作系统里安装。 +"@ + } "amd64" { + $null = I18N-Status-Print info @" +真遗憾。您只能在amd64型芯片的微软Windows操作系统里安装。 +"@ + } "arm64" { + $null = I18N-Status-Print info @" +真遗憾。您只能在arm64型芯片的微软Windows操作系统里安装。 +"@ + } "i386" { + $null = I18N-Status-Print info @" +真遗憾。您只能在i386型芯片的微软Windows操作系统里安装。 +"@ + } "arm" { + $null = I18N-Status-Print info @" +真遗憾。您只能在arm型芯片的微软Windows操作系统里安装。 +"@ + } default { + $null = I18N-Status-Print info @" +真遗憾。您只能在微软Windows操作系统里安装。 +"@ + }} + } default { + # fallback to default english + switch ("${___arch}") { + "32" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in a 32-bits Microsoft Windows operating system. +"@ + } "64" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in a 64-bits Microsoft Windows operating system. +"@ + } "amd64" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in an amd64 Microsoft Windows operating system. +"@ + } "arm64" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in an arm64 Microsoft Windows operating system. +"@ + } "i386" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in an i386 Microsoft Windows operating system. +"@ + } "arm" { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in an arm Microsoft Windows operating system. +"@ + } default { + $null = I18N-Status-Print info @" +Unfortunately, you can only install this in a Microsoft Windows operating system. +"@ + }} + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Only_Install_On_Windows() { + #___locale="$1" + #___arch="$2" + + + # execute + case "$1" in + zh-hans) + # 简体中文 + case "$2" in + 32) + printf -- "%b" "\ +真遗憾。您只能在32位微软Windows操作系统里安装。" + ;; + 64) + printf -- "%b" "\ +真遗憾。您只能在64位微软Windows操作系统里安装。" + ;; + amd64) + printf -- "%b" "\ +真遗憾。您只能在amd64型芯片的微软Windows操作系统里安装。" + ;; + arm64) + printf -- "%b" "\ +真遗憾。您只能在arm64型芯片的微软Windows操作系统里安装。" + ;; + i386) + printf -- "%b" "\ +真遗憾。您只能在i386型芯片的微软Windows操作系统里安装。" + ;; + arm) + printf -- "%b" "\ +真遗憾。您只能在arm型芯片的微软Windows操作系统里安装。" + ;; + *) + printf -- "%b" "\ +真遗憾。您只能在微软Windows操作系统里安装。" + ;; + esac + ;; + *) + # fallback to default english + case "$2" in + 32) + printf -- "%b" "\ +Unfortunately, you can only install this in a 32-bits Microsoft Windows operating system." + ;; + 64) + printf -- "%b" "\ +Unfortunately, you can only install this in a 64-bits Microsoft Windows operating system." + ;; + amd64) + printf -- "%b" "\ +Unfortunately, you can only install this in an amd64 Microsoft Windows operating system." + ;; + arm64) + printf -- "%b" "\ +Unfortunately, you can only install this in an arm64 Microsoft Windows operating system." + ;; + i386) + printf -- "%b" "\ +Unfortunately, you can only install this in an i386 Microsoft Windows operating system." + ;; + arm) + printf -- "%b" "\ +Unfortunately, you can only install this in an arm Microsoft Windows operating system." + ;; + *) + printf -- "%b" "\ +Unfortunately, you can only install this in a Microsoft Windows operating system." + ;; + esac + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Vanilla.sh.ps1 b/automataCI/services/hestiaI18N/Vanilla.sh.ps1 new file mode 100755 index 0000000..2dc2478 --- /dev/null +++ b/automataCI/services/hestiaI18N/Vanilla.sh.ps1 @@ -0,0 +1,82 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaI18N\Get_Languages_List.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Already-Latest-Version.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-All-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-All-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Bin-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Bin-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Docs-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Docs-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Config-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Config-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Lib-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Lib-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Main-Components-Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Main-Components-Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Only-Install-On-Windows.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaI18N/Get_Languages_List.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Already-Latest-Version.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-All-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-All-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Bin-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Bin-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Docs-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Docs-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Config-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Config-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Lib-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Lib-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Main-Components-Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Main-Components-Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 b/automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 new file mode 100755 index 0000000..72d2291 --- /dev/null +++ b/automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 @@ -0,0 +1,113 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +## More Info: +## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f +function hestiaLOCALE-Get-LCID { + param( + [string]$___locale + ) + + + # execute + switch ("${___locale}") { + "en" { + return 9 + } { $_ -in "en-US", "en-us" } { + return 1033 + } "zh" { + return 30724 + } { $_ -in "zh-CN", "zh-cn" } { + return 2052 + } { $_ -in "zh-Hans", "zh-hans" } { + return 4 + } default { + return + }} + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +## More Info: +## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f +hestiaLOCALE_Get_LCID() { + #___locale="$1" + + + # execute + case "$1" in + en) + printf -- "9" + ;; + en-US|en-us) + printf -- "1033" + ;; + zh) + printf -- "30724" + ;; + zh-CN|zh-cn) + printf -- "2052" + ;; + zh-Hans|zh-hans) + printf -- "4" + ;; + *) + printf -- "" + return 1 + ;; + esac + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 b/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 new file mode 100755 index 0000000..eda087c --- /dev/null +++ b/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 @@ -0,0 +1,54 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get-LCID.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaLOCALE/Get-LCID.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/i18n/_check-available-skipped.ps1 b/automataCI/services/i18n/_check-available-skipped.ps1 new file mode 100644 index 0000000..84eb740 --- /dev/null +++ b/automataCI/services/i18n/_check-available-skipped.ps1 @@ -0,0 +1,28 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\i18n\__printer.ps1" + + + + +function I18N-Check-Available-Skipped { + # execute + switch (${env:AUTOMATACI_LANG}) { + default { + # fallback to default english + $null = I18N-Status-Print warning "It's available. Skipping...`n`n" + }} + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/_check-available-skipped.sh b/automataCI/services/i18n/_check-available-skipped.sh new file mode 100644 index 0000000..0f5d528 --- /dev/null +++ b/automataCI/services/i18n/_check-available-skipped.sh @@ -0,0 +1,29 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${LIBS_AUTOMATACI}/services/i18n/__printer.sh" + + + + +I18N_Check_Available_Skipped() { + # execute + case "$AUTOMATACI_LANG" in + *) + # fallback to default english + I18N_Status_Print warning "It's available. Skipping...\n\n" + ;; + esac + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/translations.ps1 b/automataCI/services/i18n/translations.ps1 index 69584ce..06e2723 100644 --- a/automataCI/services/i18n/translations.ps1 +++ b/automataCI/services/i18n/translations.ps1 @@ -25,6 +25,7 @@ . "${env:LIBS_AUTOMATACI}\services\i18n\_build-failed-parallel.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-availability.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\_check-available-skipped.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-disabled-skipped.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-failed.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-failed-skipped.ps1" diff --git a/automataCI/services/i18n/translations.sh b/automataCI/services/i18n/translations.sh index 075a698..279c9ba 100644 --- a/automataCI/services/i18n/translations.sh +++ b/automataCI/services/i18n/translations.sh @@ -25,6 +25,7 @@ . "${LIBS_AUTOMATACI}/services/i18n/_build-failed-parallel.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-availability.sh" +. "${LIBS_AUTOMATACI}/services/i18n/_check-available-skipped.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-disabled-skipped.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-failed.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-failed-skipped.sh" diff --git a/src/.ci/_package-chocolatey_unix-any.sh b/src/.ci/_package-chocolatey_unix-any.sh index 5bafcd8..c8523df 100644 --- a/src/.ci/_package-chocolatey_unix-any.sh +++ b/src/.ci/_package-chocolatey_unix-any.sh @@ -81,6 +81,7 @@ PACKAGE_Assemble_CHOCOLATEY_Content() { fi else # copy library file + __dest="${__dest}/$(FS_Get_File "$_target")" I18N_Assemble "$_target" "$__dest" FS_Make_Directory "$__dest" FS_Copy_File "$_target" "$__dest" diff --git a/src/.ci/_package-chocolatey_windows-any.ps1 b/src/.ci/_package-chocolatey_windows-any.ps1 index 2bb2a8b..0bd8bd8 100644 --- a/src/.ci/_package-chocolatey_windows-any.ps1 +++ b/src/.ci/_package-chocolatey_windows-any.ps1 @@ -81,6 +81,7 @@ function PACKAGE-Assemble-CHOCOLATEY-Content { } } else { # copy library file + $__dest = "${__dest}\$(FS-Get-File "${_target}")" $null = I18N-Assemble "${_target}" "${__dest}" $null = FS-Make-Directory "${__dest}" $___process = FS-Copy-File "${_target}" "${__dest}" diff --git a/src/.ci/_package-deb_unix-any.sh b/src/.ci/_package-deb_unix-any.sh index da5a640..8cb012c 100644 --- a/src/.ci/_package-deb_unix-any.sh +++ b/src/.ci/_package-deb_unix-any.sh @@ -112,6 +112,7 @@ PACKAGE_Assemble_DEB_Content() { fi else # copy library file + __dest="${__dest}/$(FS_Get_File "$_target")" I18N_Assemble "$_target" "$__dest" FS_Make_Directory "$__dest" FS_Copy_File "$_target" "$__dest" diff --git a/src/.ci/_package-deb_windows-any.ps1 b/src/.ci/_package-deb_windows-any.ps1 index c21b825..9ff15d6 100644 --- a/src/.ci/_package-deb_windows-any.ps1 +++ b/src/.ci/_package-deb_windows-any.ps1 @@ -110,6 +110,7 @@ function PACKAGE-Assemble-DEB-Content { } } else { # copy library file + $__dest = "${__dest}\$(FS-Get-File "${_target}")" $null = I18N-Assemble "${_target}" "${__dest}" $null = FS-Make-Directory "${__dest}" $___process = FS-Copy-File "${_target}" "${__dest}" diff --git a/src/.ci/_package-homebrew_unix-any.sh b/src/.ci/_package-homebrew_unix-any.sh index d38a0f3..8e39131 100644 --- a/src/.ci/_package-homebrew_unix-any.sh +++ b/src/.ci/_package-homebrew_unix-any.sh @@ -88,6 +88,7 @@ PACKAGE_Assemble_HOMEBREW_Content() { fi else # copy library file + __dest="${__dest}/$(FS_Get_File "$_target")" I18N_Assemble "$_target" "$__dest" FS_Make_Directory "$__dest" FS_Copy_File "$_target" "$__dest" diff --git a/src/.ci/_package-homebrew_windows-any.ps1 b/src/.ci/_package-homebrew_windows-any.ps1 index 02957af..de198b0 100644 --- a/src/.ci/_package-homebrew_windows-any.ps1 +++ b/src/.ci/_package-homebrew_windows-any.ps1 @@ -86,6 +86,7 @@ function PACKAGE-Assemble-HOMEBREW-Content { } } else { # copy library file + $__dest = "${__dest}\$(FS-Get-File "${_target}")" $null = I18N-Assemble "${_target}" "${__dest}" $null = FS-Make-Directory "${__dest}" $___process = FS-Copy-File "${_target}" "${__dest}" diff --git a/src/.ci/_package-msi_unix-any.sh b/src/.ci/_package-msi_unix-any.sh index 610ab17..3921724 100644 --- a/src/.ci/_package-msi_unix-any.sh +++ b/src/.ci/_package-msi_unix-any.sh @@ -15,15 +15,13 @@ # initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then +if [ "$PROJECT_PATH_ROOT" == "" ]; then >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" return 1 fi . "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/crypto/random.sh" @@ -36,593 +34,200 @@ PACKAGE_Assemble_MSI_Content() { _target_arch="$5" - # package based on target's nature - if [ $(FS_Is_Target_A_MSI "$_target") -ne 0 ]; then - return 10 # not applicable - fi - + # validate input + case "$_target_os" in + any|windows) + ;; + *) + return 10 # not supported + ;; + esac - # validate critical inputs - if [ -z "$PRODUCT_APP_UUID" ]; then - return 1 - fi + case "$_target_arch" in + amd64|arm64|i386|arm) + ;; + *) + return 10 # not supported + ;; + esac - # Assemble all files across all languages. Checking is not required - # since it will be checked during the scripting phase. - __build_path="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}" - __source_path="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}" - __files="\ -${__build_path}/${PROJECT_SKU}_windows-amd64.exe|none -${__build_path}/${PROJECT_SKU}_windows-arm64.exe|none -${__build_path}/${PROJECT_SKU}_windows-i386.exe|none -${__build_path}/${PROJECT_SKU}_windows-arm.exe|none -${__source_path}/licenses/LICENSE_en.rtf|LICENSE_en.rtf -${__source_path}/licenses/LICENSE_en.rtf|LICENSE_zh-hans.rtf -${__source_path}/licenses/LICENSE_en.pdf|LICENSE_en.pdf -${__source_path}/licenses/LICENSE_en.pdf|LICENSE_zh-hans.pdf -${__source_path}/docs/USER-GUIDES_en.pdf|USER-GUIDES_en.pdf -${__source_path}/docs/USER-GUIDES_en.pdf|USER-GUIDES_zh-hans.pdf -${__source_path}/icons/icon.ico|none -${__source_path}/icons/msi-banner_en.jpg|none -${__source_path}/icons/msi-banner_zh-hans.jpg|none -${__source_path}/icons/msi-dialog_en.jpg|none -${__source_path}/icons/msi-dialog_zh-hans.jpg|none -" - __selections="\ -amd64|en -amd64|zh-hans -arm64|en -arm64|zh-hans -i386|en -i386|zh-hans -arm|en -arm|zh-hans -" - - - # Assemble all files across all languages. Checking is not required - # since it will be checked during the scripting phase. - old_IFS="$IFS" - printf -- '%s' "$__files" | while IFS="" read -r __line || [ -n "$__line" ]; do - ## parse line - __target="${__line%%|*}" - __dest="${__line##*|}" - - ## validate inputs - if [ ! -z "$_dest" ] && [ ! "$__dest" = "none" ]; then - __dest="${_directory}/${__dest}" + # execute + if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then + # unpack to the designated lib/ directory + __dest="${_directory}/lib" + + if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi else - __dest="$_directory" - fi - - ## execute - I18N_Assemble "$__target" "$__dest" - if [ -e "$__target" ]; then - FS_Copy_File "$__target" "$__dest" &> /dev/null + # copy library file + __dest="${__dest}/$(FS_Get_File "${_target}")" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi fi - done - IFS="$__old_IFS" && unset __old_IFS - - - # generate all arch & i18n independent variables and tags - __tag_ICON='Icon.exe' - __const_ICON_SOURCE="${_directory}/icon.ico" - - __tag_DIR_INSTALL='INSTALLDIR' - __tag_ARP_INSTALL_LOCATION='ARPINSTALLLOCATION' - __const_INSTALLER_VERSION='400' # Windows Installer 4.0 (included in Vista) - __const_INSTALLER_COMPRESSED_MODE='yes' # 'yes'|'no' only - __const_INSTALLER_INSTALL_SCOPE='perMachine' - __const_INSTALLER_REGISTRY_KEY="\ -Software\\\\${PROJECT_CONTACT_NAME}\\\\InstalledProducts\\\\${PROJECT_NAME}" - __const_INSTALLER_REGISTRY_NAME='InstallLocation' - - __tag_COMPONENT_BIN='ComponentBin' - __uuid_COMPONENT_BIN="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_BIN_OPTIONAL='ComponentBinOptional' - __uuid_COMPONENT_BIN_OPTIONAL="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_CONFIG='ComponentConfig' - __uuid_COMPONENT_CONFIG="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_CONFIG_OPTIONAL='ComponentConfigOptional' - __uuid_COMPONENT_CONFIG_OPTIONAL="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_LIB='ComponentLib' - __uuid_COMPONENT_LIB="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_LIB_OPTIONAL='ComponentLibOptional' - __uuid_COMPONENT_LIB_OPTIONAL="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_DOCS='ComponentDocs' - __uuid_COMPONENT_DOCS="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_DOCS_OPTIONAL='ComponentDocsOptional' - __uuid_COMPONENT_DOCS_OPTIONAL="$(RANDOM_Create_UUID)" # replace with persistent one - - __tag_COMPONENT_INSTALLER='INSTALLDIR_comp' - __uuid_COMPONENT_INSTALLER="$(RANDOM_Create_UUID)" # replace with persistent one - __tag_COMPONENT_REGISTRIES='RegValInstallLocation_comp' - __uuid_COMPONENT_REGISTRIES="$(RANDOM_Create_UUID)" # replace with persistent one - - __tag_FEATURE_ID='FeaturesAll' - __tag_FEATURE_MAIN_ID='FeaturesMain' - __tag_FEATURE_BIN_ID='FeaturesBin' - __tag_FEATURE_CONFIG_ID='FeaturesConfig' - __tag_FEATURE_LIB_ID='FeaturesLib' - __tag_FEATURE_DOCS_ID='FeaturesDocs' - - - # script the .wxs XML file (MSItools version) - old_IFS="$IFS" - printf -- '%s' "$__selections" | while IFS="" read -r __line || [ -n "$__line" ]; do - # parse line - __arch="$(STRINGS_To_Lowercase "${__line%%|*}")" - __line="${__line#*|}" - - __i18n="$(STRINGS_To_Lowercase "${__line%%|*}")" - __line="${__line#*|}" - - - # generate all arch-specific variables and validate readiness for compilation - case "$__arch" in - amd64) - __var_DIR_PROGRAM_FILES="ProgramFiles64Folder" - __var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE="\ -Unfortunately, you can only install this package on a 64-bit Windows." - __var_INSTALLER_REQUIRED_VERSION_CONDITION="" - ;; - arm64) - __var_DIR_PROGRAM_FILES="ProgramFiles64Folder" - __var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE="\ -Unfortunately, you can only install this package on a 64-bit Windows." - __var_INSTALLER_REQUIRED_VERSION_CONDITION="" - ;; - i386) - __var_DIR_PROGRAM_FILES="ProgramFilesFolder" - __var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE="\ -Unfortunately, you can only install this package on a 32-bit Windows." - __var_INSTALLER_REQUIRED_VERSION_CONDITION="" - ;; - arm) - __var_DIR_PROGRAM_FILES="ProgramFilesFolder" - __var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE="\ -Unfortunately, you can only install this package on a 32-bit Windows." - __var_INSTALLER_REQUIRED_VERSION_CONDITION="" - ;; - *) - return 1 - ;; - esac - + elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then + return 10 # not applicable + else + # copy main program to the designated bin/ directory + __dest="${_directory}/bin/${PROJECT_SKU}.exe" - # check required executables for packaging - __var_MAIN_EXE_SOURCE="${_directory}/${PROJECT_SKU}_windows-${__arch}.exe" - I18N_Check "${__var_MAIN_EXE_SOURCE}" - FS_Is_File "$__var_MAIN_EXE_SOURCE" + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then - I18N_Check_Failed_Skipped - continue + I18N_Assemble_Failed + return 1 fi + fi - # generate all i18n variables and validate readiness for compilation - _wxs="${PROJECT_SKU}_${PROJECT_VERSION}" - case "$__i18n" in - zh-hans) - ## Simplified Chinese (International) - __i18n="zh-hans" - - ## NOTE: MSFT uses LCID instead of ISO indicator. Refer: - ## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f - __var_LANGUAGE_ID='2052' - - ## NOTE: DO NOT change the format. AutomataCI relies on - ## it to parse wix4 culture settings. - ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization - _wxs="${_wxs}_zh-CN" - - __var_INSTALLER_DESCRIPTION="\ -${PROJECT_NAME} (${PROJECT_VERSION}) 安装包" - __var_INSTALLER_COMMENTS="(C) ${PROJECT_CONTACT_NAME}" - - __var_INSTALLER_BANNER_SOURCE="${_directory}/msi-banner_${__i18n}.jpg" - __var_INSTALLER_DIALOG_SOURCE="${_directory}/msi-dialog_${__i18n}.jpg" - - __var_INSTALLER_DOWNGRADE_COMMENT="\ -您的${PROJECT_NAME}已经是同样|更新版本。如此就不需要任何步骤了。谢谢。 -" - - __var_MAIN_LICENSE_SOURCE="${_directory}/LICENSE_zh-hans.pdf" - - __var_USER_GUIDE_ID='DocsUserGuideZHHANS' - __var_USER_GUIDE_SOURCE="${_directory}/USER-GUIDES_zh-hans.pdf" - - __var_FEATURE_TITLE="${PROJECT_NAME}" - __var_FEATURE_DESCRIPTION='完整全部包装。' - - __var_FEATURE_MAIN_TITLE='主要元件配套' - __var_FEATURE_MAIN_DESCRIPTION='所有第一重要无法缺乏的元件。' - - __var_FEATURE_BIN_TITLE='软件类元件配套' - __var_FEATURE_BIN_DESCRIPTION='所有可有可无的可多加软件类元件。' - - __var_FEATURE_CONFIG_TITLE='配置类元件配套' - __var_FEATURE_CONFIG_DESCRIPTION='所有可有可无的可多加配置类元件。' - - __var_FEATURE_LIB_TITLE='代码库类元件配套' - __var_FEATURE_LIB_DESCRIPTION='所有可有可无的可多加代码库类元件。' - - __var_FEATURE_DOCS_TITLE='文件类元件配套' - __var_FEATURE_DOCS_DESCRIPTION='所有可有可无的可多加文件类元件。' - ;; - *) - # default to English (International) - __i18n="en" - - ## NOTE: MSFT uses LCID instead of ISO indicator. Refer: - ## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f - __var_LANGUAGE_ID='1033' - - ## NOTE: DO NOT change the format. AutomataCI relies on - ## it to parse wix4 culture settings. - ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization - _wxs="${_wxs}_en-US" - - __var_INSTALLER_DESCRIPTION="\ -${PROJECT_NAME} (${PROJECT_VERSION}) Installer" - __var_INSTALLER_COMMENTS="(C) ${PROJECT_CONTACT_NAME}" - - __var_INSTALLER_BANNER_SOURCE="${_directory}/msi-banner_${__i18n}.jpg" - __var_INSTALLER_DIALOG_SOURCE="${_directory}/msi-dialog_${__i18n}.jpg" - - __var_INSTALLER_DOWNGRADE_COMMENT="\ -Your ${PROJECT_NAME} is the same/later version. No further action is required. Thank you. -" - - __var_MAIN_LICENSE_SOURCE="${_directory}/LICENSE_en.pdf" - - __var_USER_GUIDE_ID='DocsUserGuideEN' - __var_USER_GUIDE_SOURCE="${_directory}/USER-GUIDES_en.pdf" - - __var_FEATURE_TITLE="${PROJECT_NAME}" - __var_FEATURE_DESCRIPTION='The complete package.' - - __var_FEATURE_MAIN_TITLE='Main Components' - __var_FEATURE_MAIN_DESCRIPTION='All core and critical components.' - - __var_FEATURE_BIN_TITLE='Additional Components' - __var_FEATURE_BIN_DESCRIPTION='All optional addition components.' - - __var_FEATURE_CONFIG_TITLE='Additional Configurations Components' - __var_FEATURE_CONFIG_DESCRIPTION='All optional configurations components.' - - __var_FEATURE_LIB_TITLE='Additional Libraries Components' - __var_FEATURE_LIB_DESCRIPTION='All optional libraries components.' - - __var_FEATURE_DOCS_TITLE='Documentation Components' - __var_FEATURE_DOCS_DESCRIPTION='All documentations components.' - ;; - esac - _wxs="${_directory}/${_wxs}_windows-${__arch}.wxs" + # copy README.md into the designated docs/ directory + __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" + __dest="${_directory}/docs/${PROJECT_README}" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi - # check required files for packaging - I18N_Check "$__var_MAIN_LICENSE_SOURCE" - FS_Is_File "$__var_MAIN_LICENSE_SOURCE" + # copy user guide files to the designated docs/ directory + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do + FS_Is_Target_Exist "$__source" if [ $? -ne 0 ]; then - I18N_Check_Failed_Skipped continue fi - I18N_Check "$__var_USER_GUIDE_SOURCE" - FS_Is_File "$__var_USER_GUIDE_SOURCE" + __dest="${_directory}/docs/$(FS_Get_File "$__source")" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then - I18N_Check_Failed_Skipped - continue - fi - - I18N_Check "$_wxs" - FS_Is_File "$_wxs" - if [ $? -eq 0 ]; then - I18N_Check_Failed + I18N_Copy_Failed return 1 fi + done - # creating wxs recipe - I18N_Create "$_wxs" - FS_Write_File "$_wxs" "\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CMDLINE_${__tag_DIR_INSTALL} - - - - - - CMDLINE_${__tag_DIR_INSTALL} - - - - - - - -" + # copy PDF license files to the designated docs/ directory + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do + FS_Is_Target_Exist "$__source" if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 + continue fi - - # Assemble Components - FS_Append_File "$_wxs" "\ - - -" + __dest="${_directory}/docs/$(FS_Get_File "$__source")" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then - I18N_Create_Failed + I18N_Copy_Failed return 1 fi - - if [ "$__packager_type" = "full" ]; then - FS_Append_File "$_wxs" "\ - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi + done - FS_Append_File "$_wxs" "\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" + # copy RTF license files to the designated docs/ directory + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.rtf; do + FS_Is_Target_Exist "$__source" if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 + continue fi - FS_Append_File "$_wxs" "\ - -" + __dest="${_directory}/docs/$(FS_Get_File "$__source")" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then - I18N_Create_Failed + I18N_Copy_Failed return 1 fi + done - FS_Append_File "$_wxs" "\ - - - - - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi + # copy icon ico file to the designated base directory + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon.ico" + __dest="${_directory}/icon.ico" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi - # Define all feature components - FS_Append_File "$_wxs" "\ - - - - - - - - - - - - - - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi + # copy MSI banner jpg file to the designated base directory + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-banner.jpg" + __dest="${_directory}/msi-banner.jpg" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Copy_Failed + return 1 + fi - # conclude the wxs write-up - FS_Append_File "$_wxs" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - done - __exit=$? - IFS="$__old_IFS" && unset __old_IFS - case "$__exit" in - 0) - ;; - *) - return $__exit - ;; - esac + # copy MSI dialog jpg file to the designated base directory + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-dialog.jpg" + __dest="${_directory}/msi-dialog.jpg" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Copy_Failed + return 1 + fi + + + ## OPTIONAL - create a '[LANG].wxs' recipe if you wish to override one + ## and place it inside the designated base directory. + ## Otherwise, AutomataCI shall create one for you using its + ## packaging structure. # report status diff --git a/src/.ci/_package-msi_windows-any.ps1 b/src/.ci/_package-msi_windows-any.ps1 index d71aa42..2429012 100644 --- a/src/.ci/_package-msi_windows-any.ps1 +++ b/src/.ci/_package-msi_windows-any.ps1 @@ -1,15 +1,14 @@ -#!/bin/sh # Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. +# License for the specific language governing permissions and limitations +# under the License. @@ -21,10 +20,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { } . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\crypto\random.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\dotnet.ps1" @@ -39,44 +35,20 @@ function PACKAGE-Assemble-MSI-Content { ) - # package based on target's nature - if ($(FS-Is-Target-A-MSI "${_target}") -ne 0) { - return 10 # not applicable - } - - - # validate critical inputs - if ($(STRINGS-Is-Empty "${env:PRODUCT_APP_UUID}") -eq 0) { - return 1 - } + # validate project + switch ("${_target_os}") { + { $_ -in "any", "windows" } { + # accepted + } default { + return 10 # not supported + }} - - # configure packaging settings - $__build_path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}" - $__source_path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}" - $__files = @( - "${__build_path}\${env:PROJECT_SKU}_windows-amd64.exe|none" - "${__build_path}\${env:PROJECT_SKU}_windows-arm64.exe|none" - "${__build_path}\${env:PROJECT_SKU}_windows-i386.exe|none" - "${__build_path}\${env:PROJECT_SKU}_windows-arm.exe|none" - "${__source_path}\licenses\LICENSE_en.rtf|LICENSE_en.rtf" - "${__source_path}\licenses\LICENSE_en.rtf|LICENSE_zh-hans.rtf" - "${__source_path}\licenses\LICENSE_en.pdf|LICENSE_en.pdf" - "${__source_path}\licenses\LICENSE_en.pdf|LICENSE_zh-hans.pdf" - "${__source_path}\docs\USER-GUIDES_en.pdf|USER-GUIDES_en.pdf" - "${__source_path}\docs\USER-GUIDES_en.pdf|USER-GUIDES_zh-hans.pdf" - "${__source_path}\icons\icon.ico|none" - "${__source_path}\icons\msi-banner_en.jpg|none" - "${__source_path}\icons\msi-banner_zh-hans.jpg|none" - "${__source_path}\icons\msi-dialog_en.jpg|none" - "${__source_path}\icons\msi-dialog_zh-hans.jpg|none" - ) - $__selections = @( - "amd64|en" - "amd64|zh-hans" - "arm64|en" - "arm64|zh-hans" - ) + switch (${_target_arch}) { + { $_ -in "any", "amd64", "arm64", "i386", "arm" } { + # accepted + } default { + return 10 # not supported + }} # download required UI extensions @@ -91,619 +63,173 @@ function PACKAGE-Assemble-MSI-Content { } - # Assemble all files across all languages. Checking is not required - # since it will be checked during the scripting phase. - foreach ($__line in $__files) { - ## parse line - $__list = $__line -split "\|" - $__target = $__list[0] - $__dest = $__list[1] - - ## validate inputs - if (($(STRINGS-Is-Empty "${__dest}") -ne 0) -and ("${__dest}" -ne "none")) { - $__dest = "${_directory}\${__dest}" + # processing target + if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { + # unpack to the designated lib/ directory + $__dest = "${_directory}\lib" + + if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } } else { - $__dest = "${_directory}" + # copy library file + $__dest = "${__dest}\$(FS-Get-File "${_target}")" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } } + } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { + return 10 # not applicable + } else { + # copy main program to the designated bin/ directory + $__dest = "${_directory}\bin\${env:PROJECT_SKU}.exe" - ## execute - $null = I18N-Assemble "${__target}" "${__dest}" - if (Test-Path "${__target}") { - $null = FS-Copy-File "${__target}" "${__dest}" ` - -ErrorAction SilentlyContinue - } - } - - - # generate all arch & i18n independent variables and tags - $__tag_ICON = 'Icon.exe' - $__const_ICON_SOURCE = "${_directory}\icon.ico" - - $__tag_DIR_INSTALL = 'INSTALLDIR' - $__tag_ARP_INSTALL_LOCATION = 'ARPINSTALLLOCATION' - $__const_INSTALLER_VERSION = '500' - $__const_INSTALLER_COMPRESSED_MODE = 'yes' # 'yes'|'no' only - $__const_INSTALLER_CODEPAGE = '65001' # UTF-8 - $__const_INSTALLER_INSTALL_SCOPE = 'perMachine' - $__const_INSTALLER_REGISTRY_KEY = @" -Software\\\\${env:PROJECT_CONTACT_NAME}\\\\InstalledProducts\\\\${env:PROJECT_NAME} -"@ - $__const_INSTALLER_REGISTRY_NAME = 'InstallLocation' - - $__tag_COMPONENT_BIN = 'ComponentBin' - $__uuid_COMPONENT_BIN = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_BIN_OPTIONAL = 'ComponentBinOptional' - $__uuid_COMPONENT_BIN_OPTIONAL = Random-Create-UUID # replace with persistent one - $__tag_COMPONENT_CONFIG = 'ComponentConfig' - $__uuid_COMPONENT_CONFIG = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_CONFIG_OPTIONAL = 'ComponentConfigOptional' - $__uuid_COMPONENT_CONFIG_OPTIONAL = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_LIB = 'ComponentLib' - $__uuid_COMPONENT_LIB = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_LIB_OPTIONAL = 'ComponentLibOptional' - $__uuid_COMPONENT_LIB_OPTIONAL = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_DOCS = 'ComponentDocs' - $__uuid_COMPONENT_DOCS = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_DOCS_OPTIONAL = 'ComponentDocsOptional' - $__uuid_COMPONENT_DOCS_OPTIONAL = RANDOM-Create-UUID # replace with persistent one - - $__tag_COMPONENT_INSTALLER = 'INSTALLDIR_comp' - $__uuid_COMPONENT_INSTALLER = RANDOM-Create-UUID # replace with persistent one - $__tag_COMPONENT_REGISTRIES = 'ComponentRegistries' - $__uuid_COMPONENT_REGISTRIES = RANDOM-Create-UUID # replace with persistent one - - $__tag_FEATURE_ID = 'FeaturesAll' - $__tag_FEATURE_MAIN_ID = 'FeaturesMain' - $__tag_FEATURE_BIN_ID = 'FeaturesBin' - $__tag_FEATURE_CONFIG_ID = 'FeaturesConfig' - $__tag_FEATURE_LIB_ID = 'FeaturesLib' - $__tag_FEATURE_DOCS_ID = 'FeaturesDocs' - - $__const_OPTIONALITY = " AllowAbsent='yes'" - $__const_DIR_PROGRAM_FILES = "ProgramFiles6432Folder" - - - # script the .wxs XML file - foreach ($__line in $__selections) { - # parse line - $__list = $__line -split "\|" - $__arch = STRINGS-To-Lowercase $__list[0] - $__i18n = STRINGS-To-Lowercase $__list[1] - - - # generate all arch-specific variables and validate readiness for compilation - switch ($__arch) { - amd64 { - $__var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE = @" -Unfortunately, you can only install this package on a 64-bit Windows. -"@ - $__var_INSTALLER_REQUIRED_VERSION_CONDITION = "VersionNT64" - } arm64 { - $__var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE = @" -Unfortunately, you can only install this package on a 64-bit Windows. -"@ - $__var_INSTALLER_REQUIRED_VERSION_CONDITION = "VersionNT64" - } i386 { - $__var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE = @" -Unfortunately, you can only install this package on a 32-bit Windows. -"@ - $__var_INSTALLER_REQUIRED_VERSION_CONDITION = "Not VersionNT64" - } arm { - $__var_INSTALLER_REQUIRED_VERSION_ERROR_MESSAGE = @" -Unfortunately, you can only install this package on a 32-bit Windows. -"@ - $__var_INSTALLER_REQUIRED_VERSION_CONDITION = "Not VersionNT64" - } default { - return 1 - }} - - - # check required executables for packaging - $__var_MAIN_EXE_SOURCE = "${_directory}\${env:PROJECT_SKU}_windows-${__arch}.exe" - $null = I18N-Check "${__var_MAIN_EXE_SOURCE}" - $___process = FS-Is-File "${__var_MAIN_EXE_SOURCE}" - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - continue - } - - - # generate all i18n variables and validate readiness for compilation - $_wxs = "${env:PROJECT_SKU}_${env:PROJECT_VERSION}" - switch ($__i18n) { - zh-hans { - ## Simplified Chinese (International) - $__i18n = "zh-hans" - - ## NOTE: MSFT uses LCID instead of ISO indicator. Refer: - ## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f - $__var_LANGUAGE_ID = '2052' - - ## NOTE: DO NOT change the format. AutomataCI relies on - ## it to parse wix4 culture settings. - ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization - $_wxs = "${_wxs}_zh-cn" - - $__var_INSTALLER_DESCRIPTION = @" -${env:PROJECT_NAME} (${env:PROJECT_VERSION}) 安装包 -"@ - $__var_INSTALLER_COMMENTS = "(C) ${env:PROJECT_CONTACT_NAME}" - $__var_INSTALLER_BANNER_SOURCE = "${_directory}\msi-banner_${__i18n}.jpg" - $__var_INSTALLER_DIALOG_SOURCE = "${_directory}\msi-dialog_${__i18n}.jpg" - $__var_INSTALLER_DOWNGRADE_COMMENT = @" -您的${env:PROJECT_NAME}已经是同样|更新版本。如此就不需要任何步骤了。谢谢。 -"@ - $__var_MAIN_LICENSE_SOURCE = "${_directory}\LICENSE_zh-hans.pdf" - - $__var_USER_GUIDE_ID = 'DocsUserGuideZHHANS' - $__var_USER_GUIDE_SOURCE = "${_directory}\USER-GUIDES_zh-hans.pdf" - - $__var_FEATURE_TITLE = "${env:PROJECT_NAME}" - $__var_FEATURE_DESCRIPTION = '完整全部包装。' - - $__var_FEATURE_MAIN_TITLE = '主要元件配套' - $__var_FEATURE_MAIN_DESCRIPTION = '所有第一重要无法缺乏的元件。' - - $__var_FEATURE_BIN_TITLE = '软件类元件配套' - $__var_FEATURE_BIN_DESCRIPTION = '所有可有可无的可多加软件类元件。' - - $__var_FEATURE_CONFIG_TITLE = '配置类元件配套' - $__var_FEATURE_CONFIG_DESCRIPTION = '所有可有可无的可多加配置类元件。' - - $__var_FEATURE_LIB_TITLE = '代码库类元件配套' - $__var_FEATURE_LIB_DESCRIPTION = '所有可有可无的可多加代码库类元件。' - - $__var_FEATURE_DOCS_TITLE = '文件类元件配套' - $__var_FEATURE_DOCS_DESCRIPTION = '所有可有可无的可多加文件类元件。' - } default { - ## default to English (International) - $__i18n = "en" - - ## NOTE: MSFT uses LCID instead of ISO indicator. Refer: - ## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f - $__var_LANGUAGE_ID = '1033' - - ## NOTE: DO NOT change the format. AutomataCI relies on - ## it to parse wix4 culture settings. Refer: - ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization - $_wxs = "${_wxs}_en-us" - - $__var_INSTALLER_DESCRIPTION=@" -${env:PROJECT_NAME} (${env:PROJECT_VERSION}) Installer -"@ - $__var_INSTALLER_COMMENTS = "(C) ${env:PROJECT_CONTACT_NAME}" - - $__var_INSTALLER_BANNER_SOURCE = "${_directory}\msi-banner_${__i18n}.jpg" - $__var_INSTALLER_DIALOG_SOURCE = "${_directory}\msi-dialog_${__i18n}.jpg" - - $__var_INSTALLER_DOWNGRADE_COMMENT = @" -Your ${env:PROJECT_NAME} is the same/later version. No further action is required. Thank you. -"@ - - $__var_MAIN_LICENSE_SOURCE = "${_directory}\LICENSE_en.pdf" - - $__var_USER_GUIDE_ID = 'DocsUserGuideEN' - $__var_USER_GUIDE_SOURCE = "${_directory}\USER-GUIDES_en.pdf" - - $__var_FEATURE_TITLE = "${env:PROJECT_NAME}" - $__var_FEATURE_DESCRIPTION = 'The complete package.' - - $__var_FEATURE_MAIN_TITLE = 'Main Components' - $__var_FEATURE_MAIN_DESCRIPTION = 'All core and critical components.' - - $__var_FEATURE_BIN_TITLE = 'Additional Components' - $__var_FEATURE_BIN_DESCRIPTION = 'All optional addition components.' - - $__var_FEATURE_CONFIG_TITLE = 'Additional Configurations Components' - $__var_FEATURE_CONFIG_DESCRIPTION = 'All optional configurations components.' - - $__var_FEATURE_LIB_TITLE = 'Additional Libraries Components' - $__var_FEATURE_LIB_DESCRIPTION = 'All optional libraries components.' - - $__var_FEATURE_DOCS_TITLE = 'Documentation Components' - $__var_FEATURE_DOCS_DESCRIPTION = 'All documentations components.' - }} - $__var_UI_LICENSE_SOURCE = "${_directory}\LICENSE_${__i18n}.rtf" - $_wxs = "${_directory}\${_wxs}_windows-${__arch}.wxs" - - - # check required files for packaging - $null = I18N-Check "${__var_MAIN_LICENSE_SOURCE}" - $___process = FS-Is-File "${__var_MAIN_LICENSE_SOURCE}" - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - continue - } - - $null = I18N-Check "${__var_USER_GUIDE_SOURCE}" - $___process = FS-Is-File "${__var_USER_GUIDE_SOURCE}" - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - continue - } - - $null = I18N-Check "${__var_UI_LICENSE_SOURCE}" - $___process = FS-Is-File "${__var_UI_LICENSE_SOURCE}" - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - continue - } - - $null = I18N-Check "${_wxs}" - if (Test-Path "${_wxs}") { - $null = I18N-Check-Failed - return 1 - } - - - # creating wxs recipe - $null = I18N-Create "${_wxs}" - $___process = FS-Write-File "${_wxs}" @" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"@ + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Assemble-Failed return 1 } + } - # Define filesystem - $___process = FS-Append-File "${_wxs}" @" - - - - - - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } + # copy README.md into the designated docs/ directory + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" + $__dest = "${_directory}\docs\${env:PROJECT_README}" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } - ## BEGIN - Assemble components - $___process = FS-Append-File "${_wxs}" @" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"@ + # copy user guide files to the designated docs/ directory + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` + | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_workspace}\docs\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Assemble-Failed return 1 } + } - # create registry key - $___process = FS-Append-File "${_wxs}" @" - - - - - - - - - - -"@ + # copy PDF license files to the designated docs/ directory + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_workspace}\docs\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Assemble-Failed return 1 } + } - # Define all feature components - $___process = FS-Append-File "${_wxs}" @" - - - - - - - - - - - - - - - - - - - - - - - -"@ + # copy RTF license files to the designated docs/ directory + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + | Where-Object { ($_.Name -like "LICENSE*.rtf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_workspace}\docs\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Assemble-Failed return 1 } + } - # Add standard UI support - $___process = FS-Append-File "${_wxs}" @" - - - - - + # copy icon.ico file to the designated base directory + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon.ico" + $__dest = "${_directory}\icon.ico" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } + # copy MSI banner jpg file to the designated base directory + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-banner.jpg" + $__dest = "${_directory}\msi-banner.jpg" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } - # conclude the wxs write-up - $___process = FS-Append-File "${_wxs}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } + # copy MSI dialog jpg file to the designated base directory + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-dialog.jpg" + $__dest = "${_directory}\msi-dialog.jpg" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 } + ## OPTIONAL - create a '[LANG].wxs' recipe if you wish to override one + ## and place it inside the designated base directory. + ## Otherwise, AutomataCI shall create one for you using its + ## packaging structure. + # report status return 0 diff --git a/src/.ci/_x-package-msi_windows-any.ps1 b/src/.ci/_x-package-msi_windows-any.ps1 new file mode 100644 index 0000000..99e462b --- /dev/null +++ b/src/.ci/_x-package-msi_windows-any.ps1 @@ -0,0 +1,12 @@ + switch ($__i18n) { + zh-hans { + ## NOTE: DO NOT change the format. AutomataCI relies on + ## it to parse wix4 culture settings. + ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization + $_wxs = "${_wxs}_zh-cn" + } default { + ## NOTE: DO NOT change the format. AutomataCI relies on + ## it to parse wix4 culture settings. Refer: + ## https://wixtoolset.org/docs/tools/wixext/wixui/#localization + $_wxs = "${_wxs}_en-us" + }} diff --git a/src/icons/msi-banner_en.jpg b/src/icons/msi-banner.jpg similarity index 100% rename from src/icons/msi-banner_en.jpg rename to src/icons/msi-banner.jpg diff --git a/src/icons/msi-banner_zh-hans.jpg b/src/icons/msi-banner_zh-hans.jpg deleted file mode 100644 index 03238ef..0000000 Binary files a/src/icons/msi-banner_zh-hans.jpg and /dev/null differ diff --git a/src/icons/msi-dialog_en.jpg b/src/icons/msi-dialog.jpg similarity index 100% rename from src/icons/msi-dialog_en.jpg rename to src/icons/msi-dialog.jpg diff --git a/src/icons/msi-dialog_zh-hans.jpg b/src/icons/msi-dialog_zh-hans.jpg deleted file mode 100644 index fab36fb..0000000 Binary files a/src/icons/msi-dialog_zh-hans.jpg and /dev/null differ