This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LLVM 4.01 support along with Appveyor builds for better community contribution support * Major re-rwite of the attribute support, while this break scompatibility it makes things a lot simpler to use and leverages officially supported LLVM-C APIs. AttributeBuilder and AttributeSet are no longer available (The immutability of AttributeSet just made it harder to use) - added analyzer nuget packges and update rulesets for style and analysis validation. - lots of styleCop FxCop/Analyzer clean up * Updated to get TestDebugInfo to generate comparible output with clang (One minor difference in a "distinct" MD node for debug info left to resolve) * Fixed support of DIGlobalVariableExpressions to re-enable debug info on global variables * Removed automatic use of layout to determine alignement. Relying on default implementation can be done with an Alignment value of 0 * major re-work of LLVM libs as NUGET package to support building with AppVeyor and other public servers * Updated to use new CSPROJ format and prepare for netstandard2.0 enabled build * Proper build of LLVM libs and headers into a NUGET package * Updated to use powershell as top level build mechanism * Major update to build infrastructure to better support CSemVer on automated and CI builds while still supporting versioned local builds * Moved TestDebugInfo to samples folder so it can be used to validate the generated NuGet files as part of a post build test. * Added standard analyzers and rule sets to common build props file so they are applied consistently for all projects. * Added tests to the build * Added publishing of packages for CI builds * updated readme.md to correctly show build badges for branches along with adding skip_commits to skip builds of only markdown changes. Large scale re-work of build support to leverage NuGet and msbuild. Including the build versioning task as a nuget package. * removed Nuget packaging and build of LLVM libs (They are now in the detached branch dedicated to the Nuget packages) * Converted test project to new SDK based CSproj format * Updated gitignore to not block the LL file (Test output files should generate to locations outside the build tree) * Removed unnecessary and hardcoded link to LibLLVM dll in test project * Set LibLLVM to use content items instead of "none" for LibLLVM.DLL * Added hopefully more meaningful diagnostic message on exception if LibLLVM.dll cannot be loaded * Removed use of DeploymentItem attribute on tests as it causes the test runner to deploy the binaries but the test runner doesn't know about all the proper nuget binary dependencies and therefore won't run without them. Without those attributes the tests run in place in the build output, which will have everything correctly copied already)
- Loading branch information
Showing
251 changed files
with
16,786 additions
and
13,157 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,58 @@ | ||
#Primary settings apply to all files unless overridden below | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
|
||
# match VS generated formatting for MSBuild project files | ||
[*.*proj,*.props,*.targets] | ||
indent_size = 2 | ||
|
||
# match ISO standard requirement for C/C++ | ||
[*.c,*.h,*.cpp] | ||
insert_final_newline = true | ||
|
||
[*.cs] | ||
csharp_style_conditional_delegate_call = true:warning | ||
csharp_style_expression_bodied_accessors = true:suggestion | ||
csharp_style_expression_bodied_indexers = true:suggestion | ||
csharp_style_expression_bodied_methods = true:suggestion | ||
csharp_style_expression_bodied_operators = true:suggestion | ||
csharp_style_expression_bodied_properties = true:warning | ||
csharp_style_inlined_variable_declaration = true:warning | ||
csharp_style_pattern_matching_over_as_with_null_check = true:warning | ||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning | ||
csharp_style_throw_expression = true:warning | ||
csharp_style_var_for_built_in_types = false:error | ||
csharp_style_var_when_type_is_apparent = true:warning | ||
csharp_style_var_elsewhere = false:none | ||
csharp_new_line_before_catch = true | ||
csharp_new_line_before_else = true | ||
csharp_new_line_before_finally = true | ||
csharp_new_line_before_open_brace = all | ||
csharp_new_line_between_query_expression_clauses = true | ||
dotnet_sort_system_directives_first = true | ||
dotnet_style_coalesce_expression = true:warning | ||
dotnet_style_collection_initializer = true:warning | ||
dotnet_style_explicit_tuple_names = true:warning | ||
dotnet_style_null_propagation = true:warning | ||
dotnet_style_qualification_for_event = false:error | ||
dotnet_style_qualification_for_field = false:error | ||
dotnet_style_qualification_for_property = false:error | ||
csharp_indent_block_contents = true | ||
csharp_indent_case_contents = true | ||
csharp_indent_labels = one_less_than_current | ||
csharp_indent_switch_labels = false | ||
csharp_space_after_cast = false | ||
csharp_space_after_colon_in_inheritance_clause = true | ||
csharp_space_after_comma = true | ||
csharp_space_after_keywords_in_control_flow_statements = false | ||
csharp_space_after_semicolon_in_for_statement = true | ||
csharp_space_around_binary_operators = before_and_after | ||
csharp_space_between_method_call_name_and_opening_parenthesis = false | ||
csharp_space_between_method_declaration_name_and_open_parenthesis = false | ||
csharp_space_around_declaration_statements = ignore | ||
csharp_space_between_method_call_parameter_list_parentheses = true | ||
csharp_space_between_square_brackets = true |
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,181 @@ | ||
# invokes nuget.exe, handles downloading it to the script root if it isn't already on the path | ||
function Invoke-Nuget | ||
{ | ||
#update system search path to include the directory of this script for nuget.exe | ||
$oldPath = $env:Path | ||
$env:Path = "$PSScriptRoot;$env:Path" | ||
try | ||
{ | ||
$nugetPaths = where.exe nuget.exe 2>$null | ||
if( !$nugetPaths ) | ||
{ | ||
# Download it from official nuget release location | ||
Invoke-WebRequest -UseBasicParsing -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "$PSScriptRoot\nuget.exe" | ||
} | ||
Write-Information "nuget $args" | ||
nuget $args | ||
$err = $LASTEXITCODE | ||
if($err -ne 0) | ||
{ | ||
throw "Error running nuget: $err" | ||
} | ||
} | ||
finally | ||
{ | ||
$env:Path = $oldPath | ||
} | ||
} | ||
|
||
function Invoke-msbuild([string]$project, [hashtable]$properties, [string[]]$targets, [string[]]$loggerArgs=@(), [string[]]$additionalArgs=@()) | ||
{ | ||
$msbuildArgs = @($project) + $loggerArgs + $additionalArgs + @("/t:$($targets -join ';')") | ||
if( $properties ) | ||
{ | ||
$msbuildArgs += @( "/p:$(ConvertTo-PropertyList $properties)" ) | ||
} | ||
Write-Information "msbuild $($msbuildArgs -join ' ')" | ||
msbuild $msbuildArgs | ||
if($LASTEXITCODE -ne 0) | ||
{ | ||
throw "Error running msbuild: $LASTEXITCODE" | ||
} | ||
} | ||
|
||
function Normalize-Path([string]$path) | ||
{ | ||
$path = [System.IO.Path]::GetFullPath($path) | ||
if( !$path.EndsWith([System.IO.Path]::DirectorySeparatorChar) ) | ||
{ | ||
$path += [System.IO.Path]::DirectorySeparatorChar | ||
} | ||
return $path | ||
} | ||
|
||
function Get-BuildPaths( [string]$repoRoot) | ||
{ | ||
$buildPaths = @{} | ||
$buildPaths.RepoRoot = $repoRoot | ||
$buildPaths.BuildOutputPath = Normalize-Path (Join-Path $repoRoot 'BuildOutput') | ||
$buildPaths.NugetRepositoryPath = Normalize-Path (Join-Path $buildPaths.BuildOutputPath 'packages') | ||
$buildPaths.NugetOutputPath = Normalize-Path (Join-Path $buildPaths.BuildOutputPath 'Nuget') | ||
$buildPaths.SrcRoot = Normalize-Path (Join-Path $repoRoot 'src') | ||
$buildPaths.LibLLVMSrcRoot = Normalize-Path (Join-Path $buildPaths.SrcRoot 'LibLLVM') | ||
$buildPaths.BuildTaskProjRoot = ([IO.Path]::Combine( $repoRoot, 'BuildExtensions', 'Llvm.NET.BuildTasks') ) | ||
$buildPaths.BuildTaskProj = ([IO.Path]::Combine( $buildPaths.BuildTaskProjRoot, 'Llvm.NET.BuildTasks.csproj') ) | ||
$buildPaths.BuildTaskBin = ([IO.Path]::Combine( $repoRoot, 'BuildOutput', 'bin', 'Release', 'net47', 'Llvm.NET.BuildTasks.dll') ) | ||
return $buildPaths | ||
} | ||
|
||
function Get-BuildInformation($buildPaths) | ||
{ | ||
Write-Information "Computing Build information" | ||
# Run as distinct job to control 32 bit context and to unload the DLL on completion | ||
# this prevents it from remaining loaded in the current session, which would prevent | ||
# rebuild or deletes. | ||
Start-Job -RunAs32 -ScriptBlock { | ||
Write-Information "Computing Build information" | ||
$buildPaths = $args[0] | ||
|
||
Add-Type -Path $buildPaths.BuildTaskBin | ||
$buildVersionData = [Llvm.NET.BuildTasks.BuildVersionData]::Load( (Join-Path $buildPaths.RepoRoot BuildVersion.xml ) ) | ||
$semver = $buildVersionData.CreateSemVer(!!$env:APPVEYOR, !!$env:APPVEYOR_PULL_REQUEST_NUMBER, [DateTime]::UtcNow) | ||
|
||
return @{ | ||
FullBuildNumber = $semVer.ToString($true) | ||
PackageVersion = $semVer.ToString($false) | ||
FileVersionMajor = $semVer.FileVersion.Major | ||
FileVersionMinor = $semVer.FileVersion.Minor | ||
FileVersionBuild = $semVer.FileVersion.Build | ||
FileVersionRevision = $semver.FileVersion.Revision | ||
FileVersion= "$($semVer.FileVersion.Major).$($semVer.FileVersion.Minor).$($semVer.FileVersion.Build).$($semVer.FileVersion.Revision)" | ||
LlvmVersion = "$($buildVersionData.AdditionalProperties['LlvmVersionMajor']).$($buildVersionData.AdditionalProperties['LlvmVersionMinor']).$($buildVersionData.AdditionalProperties['LlvmVersionPatch'])" | ||
} | ||
} -ArgumentList @($buildPaths) | Receive-Job -Wait -AutoRemoveJob | ||
} | ||
|
||
function ConvertTo-PropertyList([hashtable]$table) | ||
{ | ||
(($table.GetEnumerator() | %{ "$($_.Key)=$($_.Value)" }) -join ';') | ||
} | ||
|
||
# Main Script entry point ----------- | ||
|
||
pushd $PSScriptRoot | ||
try | ||
{ | ||
# setup standard MSBuild logging for this build | ||
$msbuildLoggerArgs = @('/clp:Verbosity=Minimal') | ||
|
||
if (Test-Path "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll") | ||
{ | ||
$msbuildLoggerArgs = $msbuildLoggerArgs + @("/logger:`"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll`"") | ||
} | ||
|
||
$buildPaths = Get-BuildPaths $PSScriptRoot | ||
|
||
Write-Information "Build Paths:" | ||
Write-Information ($buildPaths | Format-Table | Out-String) | ||
|
||
if( Test-Path -PathType Container $buildPaths.BuildOutputPath ) | ||
{ | ||
Write-Information "Cleaning output folder from previous builds" | ||
rd -Recurse -Force -Path $buildPaths.BuildOutputPath | ||
} | ||
|
||
md BuildOutput\NuGet\ | Out-Null | ||
|
||
Write-Information "Restoring NUGET for internal build task" | ||
invoke-msbuild -Targets Restore -Project $buildPaths.BuildTaskProj -LoggerArgs $msbuildLoggerArgs | ||
|
||
Write-Information "Building internal build task and NuGetPackage" | ||
Invoke-MSBuild -Targets Build -Properties @{Configuration='Release';} -Project $buildPaths.BuildTaskProj -LoggerArgs $msbuildLoggerArgs | ||
|
||
$BuildInfo = Get-BuildInformation $buildPaths | ||
if($env:APPVEYOR) | ||
{ | ||
Update-AppVeyorBuild -Version $BuildInfo.FullBuildNumber | ||
} | ||
|
||
$packProperties = @{ version=$($BuildInfo.PackageVersion); | ||
llvmversion=$($BuildInfo.LlvmVersion); | ||
buildbinoutput=(normalize-path (Join-path $($buildPaths.BuildOutputPath) 'bin')); | ||
configuration='Release' | ||
} | ||
|
||
$msBuildProperties = @{ Configuration = 'Release'; | ||
FullBuildNumber = $BuildInfo.FullBuildNumber; | ||
PackageVersion = $BuildInfo.PackageVersion; | ||
FileVersionMajor = $BuildInfo.FileVersionMajor; | ||
FileVersionMinor = $BuildInfo.FileVersionMinor; | ||
FileVersionBuild = $BuildInfo.FileVersionBuild; | ||
FileVersionRevision = $BuildInfo.FileVersionRevision; | ||
FileVersion = $BuildInfo.FileVersion; | ||
LlvmVersion = $BuildInfo.LlvmVersion; | ||
} | ||
|
||
Write-Information "Build Parameters:" | ||
Write-Information ($BuildInfo | Format-Table | Out-String) | ||
|
||
# Need to invoke NuGet directly for restore of vcxproj as there is no /t:Restore target support | ||
Write-Information "Restoring Nuget Packages for LibLLVM.vcxproj" | ||
Invoke-NuGet restore src\LibLLVM\LibLLVM.vcxproj -PackagesDirectory $buildPaths.NuGetRepositoryPath | ||
|
||
Write-Information "Building LibLLVM" | ||
Invoke-MSBuild -Targets Build -Project src\LibLLVM\MultiPlatformBuild.vcxproj -Properties $msBuildProperties -LoggerArgs $msbuildLoggerArgs | ||
|
||
Write-Information "Restoring Nuget Packages for Llvm.NET" | ||
Invoke-MSBuild -Targets Restore -Project src\Llvm.NET\Llvm.NET.csproj -Properties $msBuildProperties -LoggerArgs $msbuildLoggerArgs | ||
|
||
Write-Information "Building Llvm.NET" | ||
Invoke-MSBuild -Targets Build -Project src\Llvm.NET\Llvm.NET.csproj -Properties $msBuildProperties -LoggerArgs $msbuildLoggerArgs | ||
|
||
Write-Information "Running Nuget Restore for Llvm.NET Tests" | ||
Invoke-MSBuild -Targets Restore -Project src\Llvm.NETTests\LLVM.NETTests.csproj -Properties $msBuildProperties -LoggerArgs $msbuildLoggerArgs | ||
|
||
Write-Information "Building Llvm.NET Tests" | ||
Invoke-MSBuild -Targets Build -Project src\Llvm.NETTests\LLVM.NETTests.csproj -Properties $msBuildProperties -LoggerArgs $msbuildLoggerArgs | ||
} | ||
finally | ||
{ | ||
popd | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.