-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preliminary script for building 32-bit Nuget package (#1015)
- Loading branch information
Showing
7 changed files
with
551 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
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,23 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
{ | ||
"name": "Cake: Debug Script (CoreCLR)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/tools/Cake.CoreCLR/Cake.dll", | ||
"args": [ | ||
"${workspaceRoot}/build.cake", | ||
"--debug", | ||
"--verbosity=diagnostic" | ||
], | ||
"cwd": "${workspaceRoot}", | ||
"stopAtEntry": true, | ||
"externalConsole": false | ||
} | ||
] | ||
} |
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,17 @@ | ||
Notes and TODOs | ||
|
||
- Microsoft.VisualStudio.Setup.Configuration.Interop has been added to nuspec, | ||
but for some reason it never copies itself to output, it has to be done manually. | ||
Additionally, the 64-bit nuget package does not need that (TODO Confirm this). | ||
|
||
- Baseclass.Contrib.Nuget.Output is problematic, whenever you update it, | ||
Visual Studio complains and says it must restart, over and over. | ||
|
||
- Nuget package warnings should be fixed/suppressed. | ||
|
||
- Should there be two packages : x86 and x64 ? | ||
|
||
- Only Visual Studio 2017 32-bit solution is supported, once a 64-bit solution | ||
is available, build.cake should be enhanced. | ||
|
||
- Whatever else I've missed ... |
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,125 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// ARGUMENTS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
var target = Argument("target", "Default"); | ||
var configuration = Argument("configuration", "Release"); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// SETUP / TEARDOWN | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Setup(ctx => | ||
{ | ||
// Executed BEFORE the first task. | ||
Information("Running tasks..."); | ||
}); | ||
|
||
Teardown(ctx => | ||
{ | ||
// Executed AFTER the last task. | ||
Information("Finished running tasks."); | ||
}); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// TASKS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Task("Build") | ||
.Does(() => { | ||
if (!IsRunningOnWindows()) | ||
throw new NotImplementedException("TODO Implement other platforms"); | ||
// TODO update this when there's a 64-bit solution | ||
var settings = new MSBuildSettings(); | ||
settings.SetConfiguration("Release"); | ||
settings.SetPlatformTarget(PlatformTarget.x86); | ||
MSBuild("../vs2017/CppSharp.sln", settings); | ||
}); | ||
|
||
Task("Package") | ||
.Does(() => { | ||
var scratchDir = new DirectoryPath("temp"); | ||
// clear previous session | ||
if (DirectoryExists(scratchDir)) | ||
DeleteDirectory(scratchDir, true); | ||
var files = new Dictionary<string,string>() | ||
{ | ||
{ "CppSharp.dll", "lib" }, | ||
{ "CppSharp.AST.dll", "lib" }, | ||
{ "CppSharp.Generator.dll", "lib" }, | ||
{ "CppSharp.Parser.dll", "lib" }, | ||
{ "CppSharp.Parser.CLI.dll", "lib" }, | ||
{ "CppSharp.Runtime.dll", "lib" }, | ||
{ "CppSharp.CLI.exe", "tools"}, | ||
{ "CppSharp.CppParser.dll", "output"}, | ||
{ "clang", "output/lib/clang"}, | ||
}; | ||
var path = new DirectoryPath("../vs2017/lib/Release_x86/"); | ||
CreateDirectory(scratchDir); | ||
foreach (var file in files) | ||
{ | ||
var tgt = scratchDir.Combine(file.Value); | ||
CreateDirectory(tgt); | ||
var isDirPath = path.Combine(file.Key); | ||
var isDir = DirectoryExists(isDirPath); | ||
if (isDir) | ||
{ | ||
var src = path.Combine(file.Key); | ||
CopyDirectory(src, tgt); | ||
} | ||
else | ||
{ | ||
var src = path.CombineWithFilePath(file.Key); | ||
CopyFileToDirectory(src, tgt); | ||
} | ||
} | ||
var nuspec = "cppsharp.nuspec"; | ||
var settings = new NuGetPackSettings() | ||
{ | ||
OutputDirectory = ".", | ||
BasePath = scratchDir, | ||
NoPackageAnalysis = false, | ||
}; | ||
NuGetPack(nuspec, settings); | ||
// clear current session | ||
DeleteDirectory(scratchDir, true); | ||
}); | ||
|
||
Task("CppSharpBuildAndPackage") | ||
.IsDependentOn("Build") | ||
.IsDependentOn("Package") | ||
.Does(() => { | ||
}); | ||
|
||
Task("CppSharpPackageOnly") | ||
.IsDependentOn("Package") | ||
.Does(() => { | ||
}); | ||
|
||
Task("Default") | ||
.IsDependentOn("CppSharpPackageOnly") | ||
.Does(() => { | ||
}); | ||
|
||
|
||
RunTarget(target); |
Oops, something went wrong.