-
Notifications
You must be signed in to change notification settings - Fork 0
Building packages
If you have just created your first project, and followed the default conventions, you’ll can create a package with a grand total of one-line.
C:\src\wraps\Castle.Services.Transaction> o build-wrap -quiet
# OpenWrap v1.0.0.0 ['C:\src\wraps\Castle.Services.Transaction\wraps\_cache\openwrap-1.0.0.19333731\bin-net35\OpenWrap.dll']
Copying: bin-net35 - C:\src\wraps\Castle.Services.Transaction\src\Castle.Services.Transaction\obj\Debug\Castle.Services.Transaction.dll
Copying: bin-net35 - C:\src\wraps\Castle.Services.Transaction\src\Castle.Services.Transaction\bin\Debug\Castle.Services.Transaction.XML
Package built at 'C:\src\wraps\Castle.Services.Transaction\Castle.Services.Transaction-2.1.0.19335506.wrap'.
By convention, OpenWrap tries and compile any file that ends with .*proj.
You may want to build your package in a different way. In your descriptor file (the one with the .wrapdesc extension) you can override a lot of the defaults, and the build is one of those.
Not specifying a build instruction is the equivalent of specifying the following line.
build: msbuild
To customize which projects get used, you can add a build instruction in your descriptor, and add a project parameter.
build: msbuild;project=src\Castle.Services.Transaction\Castle.Services.Transaction-vs2010.csproj
This line states that msbuilld is how you want to build your package, and provides the path to the msbuild project you want to build, relative to your package descriptor. In this example, only that project will be built.
Of course, you can add more projects by simply adding a new project
parameter, they're all separated by a semi-column.
In some projects, you may end up wanting to build your project once per version you support. The typical example would be to build it once for the Microsoft CLR, and a second time specifically for mono. We support that too.
build: msbuild;profile=net20;profile=net35
By adding those parameters to the msbuild instruction, OpenWrap will call every project to be compiled with a different value for the OpenWrap-TargetProfile parameter. Each of the builds will impact what assemblies get included (by selecting the correct version of an assembly in each of the folders of all referenced packages), and will set the OpenWrap-TargetProfile msbuild property with the version that was provided.
The default build also sets a bunch of compile constants you may find useful when conditionally compiling code for different profiles and platforms.
The current profile is defined in OW_PROFILE_ID where ID is net20, net30, net30cp etc.
The current platform is defined in OW_PLATFORM_ID where ID is AnyCPU, x86 or x64.
OpenWrap tries to play dumb when it comes to parsing the result of your build. The only thing it’s looking for are instructions you output in your build.
Each of those instructions should follow a simple template.
[built(targetFolder, “pathToFile”)]
Whenever such an instruction is encountered in the output of your msbuild file, OpenWrap will package the file at pathToFile in a folder named targetFolder. pathToFile is relative to the descriptor file.
If you wanted to add a custom file in your bin-net20 folder that is situated as /lib/native.dll, you'd add the following in your MSBuild file in the AfterBuild
target:
<Target Name="AfterBuild">
<Message Text='[built(bin-net20, "lib\native.dll")]' />
</Target>