Files
meteor/scripts/windows/download-dev-bundle.ps1
Jesse Rosenberger 0dac129770 Introduce os.windows.x86_64 architecture for 64-bit Windows.
This commit reverts much of the work @hwillson had put in place for
meteor/meteor#9173, which made it possible for 32-bit and 64-bit
Mongo versions to exist in harmony within the same dev-bundle.  That
hard work was not in vein though as it offered invaluable research.
Ultimately, this showed that a more aggressive approach would be ideal,
even if the proposed option would have worked great in the short-term.

In the wake of the news that Mongo would no longer be supporting 32-bit
versions, these changes are important so 32-bit users of Meteor can
continue to have a functioning Mongo binary in development, while still
allowing Meteor to ship newer Mongo (e.g. 3.4+) binaries for 64-bit
users.  This is particularly relevant for Windows users, who have
previously only had 32-bit Meteor builds and represented a majority of
"32-bit" development, despite the fact most of their hosts supported
64-bit.  During another time in Meteor's life, this made sense.

This commit takes improved functionality to the next level (and makes
the aforementioned changes obsolete) by introducing support for building
and shipping Meteor for Windows in a 64-bit flavor (in addition to
32-bit), which will hopefully solve a number of performance matters on
Windows by using binaries which are pre-compiled for 64-bit, rather than
forcing the Windows kernel to deal with 32-bit binaries.  While Windows
has shown it's quite capable of dealing with such a situation, it seems
more and more clear (given improvements in underlying dependencies) that
performance gains could be had by freeing Windows of its 32-bit work.

This commit also further perpetuates the "archinfo" plot-line with more
story (about Windows) and various spelling corrections.
2017-10-14 13:36:29 -04:00

66 lines
2.5 KiB
PowerShell

Import-Module "$PSScriptRoot\dev-bundle-lib.psm1"
$PLATFORM = Get-MeteorPlatform
$windows_scripts = split-path -parent $MyInvocation.MyCommand.Definition
$scripts_path = split-path -parent $windows_scripts
$CHECKOUT_DIR = split-path -parent $scripts_path
# extract the bundle version from the meteor bash script
$BUNDLE_VERSION = select-string -Path ($CHECKOUT_DIR + "\meteor") -Pattern 'BUNDLE_VERSION=(\S+)' | % { $_.Matches[0].Groups[1].Value } | select-object -First 1
$BUNDLE_VERSION = $BUNDLE_VERSION.Trim()
Write-Host "Will get you a dev_bundle for $PLATFORM version $BUNDLE_VERSION"
$TARBALL="dev_bundle_${PLATFORM}_${BUNDLE_VERSION}.tar.gz"
$ErrorActionPreference = "Stop"
# duplicated in top-level meteor script:
$DEV_BUNDLE_URL_ROOT="https://d3sqy0vbqsdhku.cloudfront.net/"
# If you set $USE_TEST_DEV_BUNDLE_SERVER then we will download
# dev bundles copied by copy-dev-bundle-from-jenkins.sh without --prod.
# It still only does this if the version number has changed
# (setting it won't cause it to automatically delete a prod dev bundle).
if ("$env:USE_TEST_DEV_BUNDLE_SERVER" -ne "") {
$DEV_BUNDLE_URL_ROOT="https://s3.amazonaws.com/com.meteor.static/test/"
}
$devbundle_link = $DEV_BUNDLE_URL_ROOT + $TARBALL
$devbundle_zip = $CHECKOUT_DIR + "\" + $TARBALL
if (Test-Path $devbundle_zip) {
Write-Host "Skipping download and installing kit from $devbundle_zip"
} else {
Write-Host "Going to download the dependency kit from the Internet"
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($devbundle_link, $devbundle_zip)
Write-Host "... downloaded"
}
Write-Host "Extracting $TARBALL to the dev_bundle directory"
cmd /C "7z.exe x $devbundle_zip -so | 7z.exe x -aoa -si -ttar -o$CHECKOUT_DIR\dev_bundle_XXX" | out-null
if ($LASTEXITCODE -ne 0) {
Exit 1
}
$downloaded_tmp = $CHECKOUT_DIR + "\dev_bundle_XXX"
$downloaded_path = $downloaded_tmp + "\dev_bundle_" + $PLATFORM + "_" + $BUNDLE_VERSION
$target_path = $CHECKOUT_DIR + "\dev_bundle"
Move-Item $downloaded_path $target_path
Remove-Item -Recurse -Force $downloaded_tmp
if ("$env:SAVE_DEV_BUNDLE_TARBALL" -ne "") {
Write-Host "Saving the dev_bundle tarball since " -NoNewLine
Write-Host "'SAVE_DEV_BUNDLE_TARBALL' is set in your environment. " -NoNewLine
Write-Host "Remember, these can get quite large!"
} else {
Write-Host "Removing dev_bundle tarball. You can preserve this in " -NoNewLine
Write-Host "the future by setting 'SAVE_DEV_BUNDLE_TARBALL' in " -NoNewLine
Write-Host "your environment."
Remove-Item -Force $devbundle_zip
}