Skip to content

Commit

Permalink
Add batch file and .py script to make UIforETW releases.
Browse files Browse the repository at this point in the history
package_etw.bat makes a self-contained .zip file that can be used
as a non-source release of UIforETW. It uses make_zip_file.py, and
there are also a few .gitignore exclusions to make it run smoothly.
  • Loading branch information
randomascii committed Jul 10, 2015
1 parent 987004b commit 65cfc3a
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ present.txt

# wpaexporter drops these
*.csv

#Created by package_etw.bat
etwpackage/
etwpackage.zip
24 changes: 24 additions & 0 deletions make_zip_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys
import os
import zipfile

if len(sys.argv) < 3:
print "Usage: %s zipfile directory" % sys.argv[0]
sys.exit(0)

filename = sys.argv[1]
dirToZip = sys.argv[2]

# Change to the specified directory so that relative paths are added instead
# of absolute paths.
os.chdir(dirToZip)
dirToZip = "."

# Request compression
zf = zipfile.ZipFile(filename, "w", zipfile.ZIP_DEFLATED)
for dirname, subdirs, files in os.walk(dirToZip):
zf.write(dirname)
for filename in files:
filePath = os.path.join(dirname, filename)
zf.write(filePath)
zf.close()
60 changes: 60 additions & 0 deletions package_etw.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@setlocal

@echo Creating a package of files for easy use of ETW/WPT.

set UIforETW=%~dp0
set destdir=%~dp0etwpackage

rmdir %destdir% /s/q
@if exist %destdir%\bin\UIforETW.exe goto pleasecloseUIforETW
@if exist %destdir%\bin\ETWProviders.dll goto pleasecloseSomething
mkdir %destdir%\bin
mkdir %destdir%\include
mkdir %destdir%\lib
mkdir %destdir%\third_party

@rem Add VS tools to the path
@call "%vs120comntools%vsvars32.bat"

cd /d %UIforETW%
cd UIforETW
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
rmdir Release /s/q
rmdir x64\Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
devenv /rebuild "release|x64" UIforETWStatic.sln
@rem Clean up after building the static version.
rmdir Release /s/q
rmdir x64\Release /s/q
del UIforETWStatic.vcxproj
del UIforETWStatic.sln

xcopy %UIforETW%\bin %destdir%\bin /s
del %destdir%\bin\*.lastcodeanalysissucceeded
del %destdir%\bin\*.pdb
xcopy %UIforETW%\include %destdir%\include /s
xcopy %UIforETW%\lib %destdir%\lib /s
xcopy %UIforETW%\third_party %destdir%\third_party /s
del %destdir%\bin\.gitignore
del %destdir%\bin\UIforETW*_dev*.*
@rem Get the destinations to exist so that the xcopy proceeds without a question.
echo >%destdir%\bin\UIforETW.exe
echo >%destdir%\bin\UIforETW32.exe
xcopy %UIforETW%\bin\UIforETWStatic_devrel32.exe %destdir%\bin\UIforETW32.exe /y
xcopy %UIforETW%\bin\UIforETWStatic_devrel.exe %destdir%\bin\UIforETW.exe /y

python %UIforETW%make_zip_file.py %UIforETW%etwpackage.zip %destdir%

@echo Now upload the new etwpackage.zip
@exit /b

:pleasecloseUIforETW
@echo UIforETW is running. Please close it and try again.
@exit /b

:pleasecloseSomething
@echo Something is running with ETWProviders.dll loaded. Please close it and try again.
@exit /b

0 comments on commit 65cfc3a

Please sign in to comment.