2019-05-03 00:29:04 +02:00
|
|
|
@echo off
|
|
|
|
|
2019-05-10 19:40:25 +02:00
|
|
|
echo Setting up dev environment...
|
|
|
|
|
2019-05-03 00:29:04 +02:00
|
|
|
rem Open Console build environment setup
|
|
|
|
rem Adds msbuild to your path, and adds the open\tools directory as well
|
|
|
|
rem This recreates what it's like to be an actual windows developer!
|
|
|
|
|
|
|
|
rem skip the setup if we're already ready.
|
|
|
|
if not "%OpenConBuild%" == "" goto :END
|
|
|
|
|
|
|
|
rem Add Opencon build scripts to path
|
|
|
|
set PATH=%PATH%;%~dp0;
|
|
|
|
|
|
|
|
rem add some helper envvars - The Opencon root, and also the processor arch, for output paths
|
|
|
|
set OPENCON_TOOLS=%~dp0
|
|
|
|
rem The opencon root is at ...\open\tools\, without the last 7 chars ('\tools\')
|
|
|
|
set OPENCON=%OPENCON_TOOLS:~0,-7%
|
|
|
|
|
|
|
|
rem Add nuget to PATH
|
|
|
|
set PATH=%PATH%%OPENCON%\dep\nuget;
|
|
|
|
|
2019-05-10 19:40:25 +02:00
|
|
|
rem Run nuget restore so you can use vswhere
|
|
|
|
nuget restore %OPENCON% -Verbosity quiet
|
|
|
|
|
|
|
|
rem Find vswhere
|
|
|
|
rem from https://github.com/microsoft/vs-setup-samples/blob/master/tools/vswhere.cmd
|
|
|
|
for /f "usebackq delims=" %%I in (`dir /b /aD /o-N /s "%~dp0..\packages\vswhere*" 2^>nul`) do (
|
|
|
|
for /f "usebackq delims=" %%J in (`where /r "%%I" vswhere.exe 2^>nul`) do (
|
|
|
|
set VSWHERE=%%J
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
if not defined VSWHERE (
|
|
|
|
echo Could not find vswhere on your machine. Please set the VSWHERE variable to the location of vswhere.exe and run razzle again.
|
|
|
|
goto :EXIT
|
|
|
|
)
|
|
|
|
|
|
|
|
rem Add path to MSBuild Binaries
|
|
|
|
for /f "usebackq tokens=*" %%B in (`%VSWHERE% -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe 2^>nul`) do (
|
|
|
|
set MSBUILD=%%B
|
|
|
|
)
|
|
|
|
|
2019-05-16 05:57:26 +02:00
|
|
|
rem Try to find MSBuild in prerelease versions of MSVS
|
|
|
|
if not defined MSBUILD (
|
|
|
|
for /f "usebackq tokens=*" %%B in (`%VSWHERE% -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe 2^>nul`) do (
|
|
|
|
set MSBUILD=%%B
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2019-05-10 19:40:25 +02:00
|
|
|
if not defined MSBUILD (
|
|
|
|
echo Could not find MsBuild on your machine. Please set the MSBUILD variable to the location of MSBuild.exe and run razzle again.
|
|
|
|
goto :EXIT
|
|
|
|
)
|
|
|
|
|
Allow `tools\razzle & nuget restore` to work with NuGet 5 and later (#1046)
Since version 5.0.2, NuGet has used the PATH environment variable
to find MSBuild.exe before looking in other file paths.
See NuGet change
https://github.com/NuGet/NuGet.Client/commit/21f2b07f2c2e84afd6602c6743d356dae8880c0c
(https://github.com/NuGet/NuGet.Client/pull/2687 ).
Unfortunately, in PR
https://github.com/microsoft/terminal/pull/606 ,
`tools\razzle.cmd` was changed to add the MSBuild.exe folder path
in _quotes_ to the PATH environment variable.
Windows itself is fine with this (you can type `msbuild` and
MSBuild runs), but some tools are not, including NuGet itself,
so you would get errors like this:
```
D:\GitHub\metathinker\console> where nuget
C:\ProgramData\chocolatey\bin\nuget.exe
D:\GitHub\metathinker\console\dep\nuget\nuget.exe
D:\GitHub\metathinker\console> nuget restore OpenConsole.sln
Illegal characters in path.
```
`razzle.cmd` runs NuGet itself, but does so before adding
the MSBuild folder to the PATH, so it was not affected by this
problem.
This change fixes the issue by dequotifying the PATH,
so that if you already had a newer version of NuGet on your PATH
before running `tools\razzle.cmd`, that version will continue
to work should you need to run `nuget restore` again
(such as after a `git clean -dx`).
2019-05-29 19:02:48 +02:00
|
|
|
set PATH=%PATH%%MSBUILD%\..;
|
2019-05-10 19:40:25 +02:00
|
|
|
|
2019-05-03 00:29:04 +02:00
|
|
|
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
|
|
|
|
set ARCH=x64
|
|
|
|
set PLATFORM=x64
|
|
|
|
) else (
|
|
|
|
set ARCH=x86
|
|
|
|
set PLATFORM=Win32
|
|
|
|
)
|
|
|
|
set DEFAULT_CONFIGURATION=Debug
|
|
|
|
|
|
|
|
rem call .razzlerc - for your generic razzle environment stuff
|
|
|
|
if exist "%OPENCON_TOOLS%\.razzlerc.cmd" (
|
|
|
|
call %OPENCON_TOOLS%\.razzlerc.cmd
|
|
|
|
) else (
|
|
|
|
(
|
|
|
|
echo @echo off
|
|
|
|
echo.
|
|
|
|
echo rem This is your razzlerc file. It can be used for default dev environment setup.
|
|
|
|
) > %OPENCON_TOOLS%\.razzlerc.cmd
|
|
|
|
)
|
|
|
|
|
|
|
|
rem if there are args, run them. This can be used for additional env. customization,
|
|
|
|
rem especially on a per shortcut basis.
|
|
|
|
:ARGS_LOOP
|
|
|
|
if (%1) == () goto :POST_ARGS_LOOP
|
|
|
|
if (%1) == (dbg) (
|
|
|
|
set DEFAULT_CONFIGURATION=Debug
|
|
|
|
shift
|
|
|
|
goto :ARGS_LOOP
|
|
|
|
)
|
|
|
|
if (%1) == (rel) (
|
|
|
|
set DEFAULT_CONFIGURATION=Release
|
|
|
|
shift
|
|
|
|
goto :ARGS_LOOP
|
|
|
|
)
|
|
|
|
if (%1) == (x86) (
|
|
|
|
set ARCH=x86
|
|
|
|
set PLATFORM=Win32
|
|
|
|
shift
|
|
|
|
goto :ARGS_LOOP
|
|
|
|
)
|
|
|
|
if exist %1 (
|
|
|
|
call %1
|
|
|
|
) else (
|
|
|
|
echo Could not locate "%1"
|
|
|
|
)
|
|
|
|
shift
|
|
|
|
goto :ARGS_LOOP
|
|
|
|
|
|
|
|
:POST_ARGS_LOOP
|
Fix unittesting our `.xaml` classes (#4105)
## Summary of the Pull Request
New year, new unittests.
This PR introduces a new project, `TestHostApp`. This project is largely taken from the TAEF samples, and allows us to easily construct a helper executable and `resources.pri` for running TerminalApp unittests.
## References
## PR Checklist
* [x] Closes #3986
* [x] I work here
* [x] is Tests
* [n/a] Requires documentation to be updated
* [x] **Waiting for an updated version of TAEF to be available**
## Detailed Description of the Pull Request / Additional comments
Unittesting for the TerminalApp project has been a horrifying process to try getting everything pieced together just right. Dependencies need to get added to manifests, binplaced correctly, and XAML resources need to get compiled together as well. In addition, using a MUX `Application` (as opposed to the Windows.UI.Xaml `Application`) has led to additional problems.
This was always a horrifying house of cards for us. Turns out, the reason this was so horrible is that the test infrastructure for doing what we're doing _literally didn't exist_ when I started doing all that work last year.
So, with help from the TAEF team, I was able to get rid of our entire house of cards, and use a much simpler project to build and run the tests.
Unfortunately, the latest TAEF release has a minor bug in it's build rules, and only publishes the x86 version of a dll we need from them. But, the rest of this PR works for x86, and I'll bump this when that updated version is available. We should be able to review this even in the state it's in.
## Validation Steps Performed
ran the tests yo
2020-01-10 19:55:31 +01:00
|
|
|
set TAEF=%OPENCON%\packages\Taef.Redist.Wlk.10.48.200103003-develop\build\Binaries\%ARCH%\TE.exe
|
2019-05-03 00:29:04 +02:00
|
|
|
rem Set this envvar so setup won't repeat itself
|
|
|
|
set OpenConBuild=true
|
|
|
|
|
|
|
|
:END
|
|
|
|
echo The dev environment is ready to go!
|
|
|
|
|
|
|
|
:EXIT
|