Skip to content

Commit

Permalink
Fixed the Deploy.ps1 script
Browse files Browse the repository at this point in the history
I decided to finally stop fighting the VSIX build task.  Getting it to
exclude files it feels are incorrectly referenced is a losing effort.
Instead I will just let it put whatever it wants into the project and
I'll manually remove it afterwards.
  • Loading branch information
jaredpar committed Oct 1, 2013
1 parent 7dbdda0 commit 31d9f20
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 24 deletions.
57 changes: 33 additions & 24 deletions Scripts/Deploy.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
param ([switch]$fast = $false)
[string]$script:rootPath = split-path -parent $MyInvocation.MyCommand.Definition
[string]$script:rootPath = resolve-path (join-path $rootPath "..")
cd $rootPath
pushd $rootPath

$msbuild = join-path ${env:SystemRoot} "microsoft.net\framework\v4.0.30319\msbuild.exe"
if (-not (test-path $msbuild)) {
write-error "Can't find msbuild.exe"
}

$zip = join-path $rootPath "Tools\7za920\7za.exe"

function test-return() {
if ($LASTEXITCODE -ne 0) {
write-error "Command failed with code $LASTEXITCODE"
Expand All @@ -17,26 +19,15 @@ function test-return() {
# Test the contents of the Vsix to make sure it has all of the appropriate
# files
function test-vsixcontents() {
param ([string]$vsixPath = $(throw "Need the path to the VSIX"))
$vsixPath = "Deploy\VsVim.vsix"
if (-not (test-Path $vsixPath)) {
write-error "Vsix doesn't exist"
}

# Make a folder to hold the files
$target = join-path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
mkdir $target | out-null

# Copy the VSIX to a file with a zip extension. This is required for the
# shell to unzip it for us.
$vsixTarget = join-path $target "VsVim.zip"
copy $vsixPath $vsixTarget

# Unzip the file
$shellApp = new-object -com shell.application
$source = $shellApp.NameSpace($vsixTarget)
$dest = $shellApp.NameSpace($target)
$items = $source.Items()
$dest.Copyhere($items, 20)
& $zip x "-o$target" $vsixPath | out-null

$files = gci $target | %{ $_.Name }
if ($files.Count -ne 14) {
Expand Down Expand Up @@ -134,17 +125,34 @@ function build-release() {
Test-Return
}

function publish-vsix() {
# Due to the way we build the VSIX there are many files included that we don't actually
# want to deploy. Here we will clear out those files and rebuild the VSIX without
# them
function clean-vsixcontents() {
param ([string]$vsixPath = $(throw "Need the path to the VSIX"))
if (-not (test-path "Deploy")) {
mkdir "Deploy" | out-null
if (-not (test-Path $vsixPath)) {
write-error "Vsix doesn't exist"
}
$vsixName = split-path -leaf $vsixPath
$target = join-path "Deploy" $vsixName
copy -force $vsixPath $target
ii "Deploy"

write-host "Cleaning VSIX contents"
# Make a folder to hold the files
$target = join-path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
mkdir $target | out-null

& $zip x "-o$target" $vsixPath | out-null
rm "$target\Microsoft.VisualStudio.*"
rm $vsixPath
& $zip a -r $vsixPath $target\*.* | out-null
}

function build-vsix() {
rm Deploy\VsVim*
copy "Src\VsVim\bin\Release\VsVim.vsix" "Deploy\VsVim.orig.vsix"
copy "Deploy\VsVim.orig.vsix" "Deploy\VsVim.vsix"
clean-vsixcontents (resolve-path "Deploy\VsVim.vsix")
copy "Deploy\VsVim.vsix" "Deploy\VsVim.zip"
}

# First step is to clean out all of the projects
if (-not $fast) {
write-host "Cleaning Projects"
Expand All @@ -167,9 +175,10 @@ build-release Test\VsVimSharedTest\VsVimSharedTest.csproj

# Now build the main output project
build-release Src\VsVim\VsVim.csproj
build-vsix

write-host "Verifying the Vsix Contents"
$vsixPath = "Src\VsVim\bin\Release\VsVim.vsix"
test-vsixcontents $vsixPath
test-vsixcontents
test-unittests
publish-vsix $vsixPath

popd
Binary file added Tools/7za920/7-zip.chm
Binary file not shown.
Binary file added Tools/7za920/7za.exe
Binary file not shown.
29 changes: 29 additions & 0 deletions Tools/7za920/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
7-Zip Command line version
~~~~~~~~~~~~~~~~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7-Zip Copyright (C) 1999-2010 Igor Pavlov.

7za.exe is distributed under the GNU LGPL license

Notes:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.


GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
41 changes: 41 additions & 0 deletions Tools/7za920/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
7-Zip Command line version 9.20
-------------------------------

7-Zip is a file archiver with high compression ratio.
7za.exe is a standalone command line version of 7-Zip.

7-Zip Copyright (C) 1999-2010 Igor Pavlov.

Features of 7za.exe:
- High compression ratio in new 7z format
- Supported formats:
- Packing / unpacking: 7z, xz, ZIP, GZIP, BZIP2 and TAR
- Unpacking only: Z, lzma
- Highest compression ratio for ZIP and GZIP formats.
- Fast compression and decompression
- Strong AES-256 encryption in 7z and ZIP formats.

7za.exe is a free software distributed under the GNU LGPL.
Read license.txt for more information.

Source code of 7za.exe and 7-Zip can be found at
http://www.7-zip.org/

7za.exe can work in Windows 95/98/ME/NT/2000/2003/2008/XP/Vista/7.

There is also port of 7za.exe for POSIX systems like Unix (Linux, Solaris, OpenBSD,
FreeBSD, Cygwin, AIX, ...), MacOS X and BeOS:

http://p7zip.sourceforge.net/


This distributive packet contains the following files:

7za.exe - 7-Zip standalone command line version.
readme.txt - This file.
license.txt - License information.
7-zip.chm - User's Manual in HTML Help format.


---
End of document

0 comments on commit 31d9f20

Please sign in to comment.