-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4369 from NREL/nuget_test
#4214 Add in automated testing for 32/64 bit nuget package
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Simple command line steps to test the openstudio.nupkg package with a simple C# program. | ||
|
||
1 ) Install nuget.exe | ||
https://www.nuget.org/downloads | ||
|
||
2 ) Install the nupkg using nuget cli | ||
e.g. | ||
nuget.exe add C:\Users\OpenStudio.3.2.0.nupkg -Source C:\Users\Administrator\source\ | ||
# verify package is installed | ||
nuget.exe list -Prerelease -Source C:\Users\Administrator\source\ | ||
|
||
3 ) cd into directory where you want to install the nuget package and install | ||
nuget.exe install OpenStudio -Version 3.2.0 -Source C:\Users\Administrator\source\ | ||
|
||
4 ) compile c# program using nuget package | ||
csc /t:exe /out:test.exe /r:OpenStudio.3.2.0\lib\net35\OpenStudio.dll test_nuget.cs | ||
|
||
5 ) copy all runtime dlls within the nuget package to directory or add it path that contains the compiled exe, in this case test.exe | ||
|
||
6 ) run exec and test output | ||
|
||
|
||
The nuget_setup.bat runs all the above for x64 and x86. You need to set the following before calling the script. | ||
e.g. | ||
set NUGET_PATH=D:\OSN\build&& set NUGET_NAME=OpenStudio&& set NUGET_VERSION=3.2.2-alpha&& set NUGET_SOURCE_DIR=D:\jenkins\nuget_packages&& test_nuget.bat | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
REM Setup the Visual Studio env | ||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" | ||
|
||
echo Testing %NUGET_NAME%.%NUGET_VERSION% with example csharp programs for x86 and x64 builds | ||
|
||
SET ORIG_PATH=%PATH% | ||
|
||
|
||
echo Adding nuget package to local source | ||
echo nuget add %NUGET_PATH%\%NUGET_NAME%.%NUGET_VERSION%.nupkg -Source %NUGET_SOURCE_DIR% | ||
nuget add %NUGET_PATH%\%NUGET_NAME%.%NUGET_VERSION%.nupkg -Source %NUGET_SOURCE_DIR% | ||
|
||
|
||
echo List available nuget packages from local source | ||
echo nuget list -Prerelease -Source %NUGET_SOURCE_DIR% | ||
nuget list -Prerelease -Source %NUGET_SOURCE_DIR% | ||
|
||
echo Install nuget packages from local source | ||
nuget install %NUGET_NAME% -Version %NUGET_VERSION% -Source %NUGET_SOURCE_DIR% | ||
|
||
REM create the dirs to write the compiled output | ||
mkdir x64 | ||
mkdir x86 | ||
|
||
echo Compiling x64 and x86 csharp programs using %NUGET_NAME%.%NUGET_VERSION%.nupkg | ||
REM compile x64 csharp example file | ||
echo csc /t:exe /platform:x64 /out:x64\test.exe /r:%NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll test_nuget.cs | ||
csc /t:exe /platform:x64 /out:x64\test.exe /r:%NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll test_nuget.cs | ||
|
||
REM compile x86 csharp example file | ||
echo csc /t:exe /platform:x86 /out:x86\test.exe /r:%NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll test_nuget.cs | ||
csc /t:exe /platform:x86 /out:x86\test.exe /r:%NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll test_nuget.cs | ||
|
||
REM get the test directory | ||
SET BASE_DIR_NAME=%~d0%~p0 | ||
|
||
REM add x64 dlls to path | ||
REM echo set PATH=%BASE_DIR_NAME%%NUGET_NAME%.%NUGET_VERSION%\build\x64;%PATH% | ||
set PATH=%BASE_DIR_NAME%%NUGET_NAME%.%NUGET_VERSION%\build\x64;%PATH% | ||
REM Copy the dll so test.exe for runtime dependency | ||
echo copy %NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll x64 | ||
copy %NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll x64 | ||
REM run the test.exe | ||
echo "test running x64\test.exe" | ||
echo x64\test.exe | ||
x64\test.exe | ||
|
||
echo "test running x86\test.exe" | ||
REM add x86 dlls to path | ||
set PATH=%ORIG_PATH% | ||
REM add x86 dlls to path | ||
REM echo set PATH=%BASE_DIR_NAME%%NUGET_NAME%.%NUGET_VERSION%\build\x86;%PATH% | ||
set PATH=%BASE_DIR_NAME%%NUGET_NAME%.%NUGET_VERSION%\build\x86;%PATH% | ||
REM Copy the dll so test.exe for runtime dependency | ||
echo copy %NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll x86 | ||
copy %NUGET_NAME%.%NUGET_VERSION%\lib\net35\OpenStudio.dll x86 | ||
REM run the test.exe | ||
echo "test running x64\test.exe" | ||
echo x86\test.exe | ||
x86\test.exe | ||
|
||
|
||
echo Deleting nuget package to local source | ||
echo nuget delete %NUGET_NAME% %NUGET_VERSION% -Source %NUGET_SOURCE_DIR% -NonInteractive | ||
nuget delete %NUGET_NAME% %NUGET_VERSION% -Source %NUGET_SOURCE_DIR% -NonInteractive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace test_nuget | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
var m = new OpenStudio.Model(); | ||
} | ||
} | ||
} |