Cut all the stuff from ICU's data file that we don't need

This commit is contained in:
Thomas Goyne 2013-02-06 11:05:13 -08:00
parent 48921c35e0
commit bec9483429
2 changed files with 44 additions and 6 deletions

View file

@ -95,6 +95,14 @@ type GitProject() =
this.Log.LogErrorFromException e
false
let downloadArchive (url : String) unpackDest =
use wc = new Net.WebClient()
use downloadStream = wc.OpenRead url
use gzStream = new ICSharpCode.SharpZipLib.GZip.GZipInputStream(downloadStream)
use tarStream = new ICSharpCode.SharpZipLib.Tar.TarInputStream(gzStream)
use tarArchive = ICSharpCode.SharpZipLib.Tar.TarArchive.CreateInputTarArchive tarStream
tarArchive.ExtractContents unpackDest
type TarballProject() =
inherit Task()
@ -111,13 +119,8 @@ type TarballProject() =
try IO.Directory.Delete(directory, true) with | :? IO.IOException -> ()
this.Log.LogMessage ("Downloading {0} {1} from {2}", project.ItemSpec, version, project.GetMetadata "Url")
use wc = new Net.WebClient()
use downloadStream = project.GetMetadata "Url" |> wc.OpenRead
use gzStream = new ICSharpCode.SharpZipLib.GZip.GZipInputStream(downloadStream)
use tarStream = new ICSharpCode.SharpZipLib.Tar.TarInputStream(gzStream)
use tarArchive = ICSharpCode.SharpZipLib.Tar.TarArchive.CreateInputTarArchive tarStream
downloadArchive (project.GetMetadata "Url") (sprintf @"%s\.." directory)
sprintf @"%s\.." directory |> tarArchive.ExtractContents
let dirname = project.GetMetadata "DirName"
if not <| String.IsNullOrWhiteSpace dirname
then IO.Directory.Move(dirname |> sprintf @"%s\..\%s" directory, directory)
@ -138,3 +141,28 @@ type TarballProject() =
with e ->
this.Log.LogErrorFromException e
false
type DownloadTgzFile() =
inherit Task()
member val Url = "" with get, set
member val Destination = "" with get, set
member val OutputFile = "" with get, set
member val Hash = "" with get, set
override this.Execute() =
let needsDownload =
try
use fs = IO.File.OpenRead this.OutputFile
let sha = new Security.Cryptography.SHA1Managed ()
let hash = sha.ComputeHash fs
BitConverter.ToString(hash).Replace("-", "") <> this.Hash
with | :? IO.IOException -> true
try
if needsDownload
then downloadArchive this.Url this.Destination
true
with e ->
this.Log.LogErrorFromException e
false

View file

@ -64,6 +64,7 @@ Aegisub Project http://www.aegisub.org/
<Import Project="$(MSBuildThisFileDirectory)\..\aegisub.props" />
<UsingTask TaskName="GitProject" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
<UsingTask TaskName="TarballProject" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
<UsingTask TaskName="DownloadTgzFile" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
<Target Name="Build">
<GitProject
@ -73,5 +74,14 @@ Aegisub Project http://www.aegisub.org/
/>
<TarballProject Projects="@(TarballProject)" Root="$(MSBuildThisFileDirectory)..\..\..\deps" />
<!-- Generated with http://apps.icu-project.org/datacustom/ -->
<!-- Includes Break Iterator and Collator data only -->
<DownloadTgzFile
Url="http://www.aegisub.org/~plorkyeran/icudt50l.dat.tgz"
Destination="$(MSBuildThisFileDirectory)..\..\..\deps\icu\source\data\in"
OutputFile="$(MSBuildThisFileDirectory)..\..\..\deps\icu\source\data\in\icudt50l.dat"
Hash="593aa12dc0413163b803582d22197c46804048c8"
/>
</Target>
</Project>