2018-02-09 22:32:32 +00:00
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
#-------------------------
# Script: icu\packaging\distrelease.ps1
# Author: Steven R. Loomis
# Date: 2017-04-14
#-------------------------
#
2019-02-05 19:12:18 +00:00
# This builds a zipfile containing the 64-bit (x64) and/or 32-bit (x86) Windows binaries.
2018-02-16 03:37:13 +00:00
# (Note: The zipfile does not include the UWP binaries.)
2018-02-09 22:32:32 +00:00
#
# Usage: (after building ICU using MSVC)
# (bring up Powershell ISE)
# cd C:\icu\icu4c\
2018-02-16 03:37:13 +00:00
# Set-ExecutionPolicy -Scope Process Unrestricted
2019-03-28 21:57:08 +00:00
# .\packaging\distrelease.ps1 -arch "x64 or x86"
2018-02-09 22:32:32 +00:00
#
# Will emit: c:\icu4c\icu\source\dist\icu-windows.zip
#
#
# You will get warnings from the execution policy and the script itself.
2018-02-16 03:37:13 +00:00
# see https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1&viewFallbackFrom=powershell-Microsoft.PowerShell.Core
2018-02-09 22:32:32 +00:00
# for more about execution policies.
2019-03-28 21:57:08 +00:00
Param (
[ string ] $arch = " x64 " # use x64 as default
)
2018-02-09 22:32:32 +00:00
$icuDir = Split-Path -Path $MyInvocation . MyCommand . Definition -Parent
$icuDir = Resolve-Path -Path '$icuDir\..'
echo $icuDir
# ok, create some work areas
New-Item -Path " $icuDir \source\dist " -ErrorAction SilentlyContinue -ItemType " directory "
$source = " $icuDir \source\dist\icu "
Get-ChildItem -Path $source -ErrorAction SilentlyContinue | Remove-Item -Recurse
New-Item -Path $source -ItemType " directory " -ErrorAction SilentlyContinue
# copy required stuff
2019-03-28 21:57:08 +00:00
if ( $arch -eq " x64 " )
{
Copy-Item -Path " $icuDir \lib64 " -Destination $source -Recurse
Copy-Item -Path " $icuDir \bin64 " -Destination $source -Recurse
}
elseif ( $arch -eq " x86 " )
{
Copy-Item -Path " $icuDir \lib " -Destination $source -Recurse
Copy-Item -Path " $icuDir \bin " -Destination $source -Recurse
}
else
{
$filename = $MyInvocation . MyCommand . Name ;
echo " Invalid architecture. "
echo " Usage: $filename -arch `" x64 or x86 `" "
exit
}
2018-02-09 22:32:32 +00:00
Copy-Item -Path " $icuDir \include " -Destination $source -Recurse
Copy-Item -Path " $icuDir \APIChangeReport.html " -Destination $source -Recurse
Copy-Item -Path " $icuDir \icu4c.css " -Destination $source -Recurse
Copy-Item -Path " $icuDir \LICENSE " -Destination $source -Recurse
Copy-Item -Path " $icuDir \readme.html " -Destination $source -Recurse
$destination = " $icuDir \source\dist\icu-windows.zip "
Remove-Item -Path $destination -ErrorAction Continue
Echo $source
Echo $destination
2019-05-11 01:19:14 +00:00
# Use 7Zip to build zip file to avoid backslash path separator errors when unzipping on CygWin
if ( -not ( Get-Module -ListAvailable -Name 7Zip4PowerShell ) )
{
Install-Module 7Zip4PowerShell -Force -Verbose
}
Compress - 7Zip $source -ArchiveFileName $destination -Format Zip
2018-02-09 22:32:32 +00:00
2017-10-11 20:47:18 +00:00
echo $destination