Initial Cut of files brought over from CLI.
This commit is contained in:
Родитель
9f104045cf
Коммит
4ec4cad531
|
@ -0,0 +1,52 @@
|
|||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
|
||||
*.jpg binary
|
||||
*.png binary
|
||||
*.gif binary
|
||||
|
||||
*.sh eol=lf
|
||||
|
||||
*.cs text=auto diff=csharp
|
||||
*.vb text=auto
|
||||
*.resx text=auto
|
||||
*.c text=auto
|
||||
*.cpp text=auto
|
||||
*.cxx text=auto
|
||||
*.h text=auto
|
||||
*.hxx text=auto
|
||||
*.py text=auto
|
||||
*.rb text=auto
|
||||
*.java text=auto
|
||||
*.html text=auto
|
||||
*.htm text=auto
|
||||
*.css text=auto
|
||||
*.scss text=auto
|
||||
*.sass text=auto
|
||||
*.less text=auto
|
||||
*.js text=auto
|
||||
*.lisp text=auto
|
||||
*.clj text=auto
|
||||
*.sql text=auto
|
||||
*.php text=auto
|
||||
*.lua text=auto
|
||||
*.m text=auto
|
||||
*.asm text=auto
|
||||
*.erl text=auto
|
||||
*.fs text=auto
|
||||
*.fsx text=auto
|
||||
*.hs text=auto
|
||||
|
||||
*.csproj text=auto
|
||||
*.vbproj text=auto
|
||||
*.fsproj text=auto
|
||||
*.dbproj text=auto
|
||||
*.sln text=auto eol=crlf
|
|
@ -0,0 +1,293 @@
|
|||
### Repo-specific things ###
|
||||
|
||||
# Test results
|
||||
*-testResults.xml
|
||||
|
||||
# Multicore JIT Optimization profiles
|
||||
**/optimizationdata/dotnet
|
||||
|
||||
# NuGet keeps dropping
|
||||
Library/
|
||||
|
||||
# NuGet v3 restore drops these even though we don't use MSBuild :(
|
||||
*.nuget.targets
|
||||
*.nuget.props
|
||||
|
||||
# Debian and python stuff
|
||||
*.dsc
|
||||
*.tar.gz
|
||||
*.build
|
||||
*.changes
|
||||
*.deb
|
||||
*.pyc
|
||||
*.pyo
|
||||
|
||||
# OSX Packaging temp files
|
||||
*.pkg
|
||||
|
||||
# OS X Device Services Store
|
||||
.DS_Store
|
||||
|
||||
# CMake generated files
|
||||
cmake/
|
||||
|
||||
# stage0 install directory
|
||||
.dotnet_stage0
|
||||
|
||||
# `dotnet new` project.json.template files are generated by a pre-build step.
|
||||
# ignore these files
|
||||
/src/dotnet/commands/dotnet-new/**/project.json.template
|
||||
|
||||
### VisualStudio.gitignore from https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore ###
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
|
||||
# Visual Studio Code cache/options directory
|
||||
.vscode/
|
||||
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# Exceptions
|
||||
# Build Scripts
|
||||
!scripts/build/
|
||||
test/PackagedCommands/Consumers/*/project.json
|
||||
|
||||
# Vim swp files
|
||||
*.swp
|
||||
*.*~
|
||||
|
||||
# VS generated files
|
||||
launchSettings.json
|
|
@ -0,0 +1,4 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
See [Contributing](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/contributing.md) for information about coding styles, source structure, making pull requests, and more.
|
|
@ -0,0 +1,17 @@
|
|||
## Steps to reproduce
|
||||
|
||||
|
||||
## Expected behavior
|
||||
|
||||
|
||||
## Actual behavior
|
||||
|
||||
|
||||
## Environment data
|
||||
`dotnet --info` output:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 .NET Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5A29E8E3-A0FC-4C57-81DD-297B56D1A119}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
global.json = global.json
|
||||
NuGet.Config = NuGet.Config
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0722D325-24C8-4E83-B5AF-0A083E7F0749}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_projects", "build_projects", "{88278B81-7649-45DC-8A6A-D3A645C5AFC3}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Build.Framework", "build_projects\Microsoft.DotNet.Cli.Build.Framework\Microsoft.DotNet.Cli.Build.Framework.xproj", "{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "shared-build-targets-utils", "build_projects\shared-build-targets-utils\shared-build-targets-utils.xproj", "{B768BD29-12BF-4C7C-B093-03193FE244D1}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-host-build", "build_projects\dotnet-host-build\dotnet-host-build.xproj", "{1DBB7542-0345-4F4B-A84B-3B00B185D416}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RuntimeGraphGenerator", "tools\independent\RuntimeGraphGenerator\RuntimeGraphGenerator.xproj", "{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
MinSizeRel|Any CPU = MinSizeRel|Any CPU
|
||||
MinSizeRel|x64 = MinSizeRel|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU
|
||||
RelWithDebInfo|x64 = RelWithDebInfo|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{1DBB7542-0345-4F4B-A84B-3B00B185D416} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -0,0 +1,3 @@
|
|||
- If this PR should not run tests please add text "skip[REMOVE_THIS]ci[REMOVE_THIS]please" (remove the marked text, no quotes).
|
||||
- Please add description for changes you are making.
|
||||
- If there is an issue related to this PR, please add the reference.
|
|
@ -0,0 +1,41 @@
|
|||
.NET Core uses third-party libraries or other resources that may be
|
||||
distributed under licenses different than the .NET Core software.
|
||||
|
||||
Attributions and licence notices for test cases originally authored by
|
||||
third parties can be found in the respective test directories.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us:
|
||||
|
||||
dotnet@microsoft.com
|
||||
|
||||
The attached notices are provided for information only.
|
||||
|
||||
License notice for RFC 3492
|
||||
---------------------------
|
||||
|
||||
Copyright (C) The Internet Society (2003). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
@ -0,0 +1,8 @@
|
|||
# This is a file containing environment variables specific to this branch
|
||||
# Any line that is not blank and does not start with '#' is interpreted as a variable to set
|
||||
# Each line is expected to be in the format "[Name]=[Value]".
|
||||
MAJOR_VERSION=1
|
||||
MINOR_VERSION=0
|
||||
PATCH_VERSION=0
|
||||
RELEASE_SUFFIX=rc3
|
||||
CHANNEL=rc3
|
|
@ -0,0 +1,7 @@
|
|||
@echo off
|
||||
|
||||
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
powershell -NoProfile -NoLogo -Command "%~dp0build_projects\dotnet-host-build\build.ps1 %*; exit $LastExitCode;"
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
# Set OFFLINE environment variable to build offline
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
# Some things depend on HOME and it may not be set. We should fix those things, but until then, we just patch a value in
|
||||
if [ -z "$HOME" ]; then
|
||||
export HOME=$DIR/artifacts/home
|
||||
|
||||
[ ! -d "$HOME" ] || rm -Rf $HOME
|
||||
mkdir -p $HOME
|
||||
fi
|
||||
|
||||
args=( "$@" )
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||
case $lowerI in
|
||||
--docker)
|
||||
export BUILD_IN_DOCKER=1
|
||||
export DOCKER_IMAGENAME=$2
|
||||
# remove docker args
|
||||
args=( "${args[@]/$1}" )
|
||||
args=( "${args[@]/$2}" )
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# $args array may have empty elements in it.
|
||||
# The easiest way to remove them is to cast to string and back to array.
|
||||
temp="${args[@]}"
|
||||
args=($temp)
|
||||
|
||||
dockerbuild()
|
||||
{
|
||||
BUILD_COMMAND=/opt/code/build_projects/dotnet-host-build/build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
|
||||
}
|
||||
|
||||
# Check if we need to build in docker
|
||||
if [ ! -z "$BUILD_IN_DOCKER" ]; then
|
||||
dockerbuild "${args[@]}"
|
||||
else
|
||||
$DIR/build_projects/dotnet-host-build/build.sh "${args[@]}"
|
||||
fi
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class AnsiColorExtensions
|
||||
{
|
||||
public static string Black(this string text)
|
||||
{
|
||||
return "\x1B[30m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Red(this string text)
|
||||
{
|
||||
return "\x1B[31m" + text + "\x1B[39m";
|
||||
}
|
||||
public static string Green(this string text)
|
||||
{
|
||||
return "\x1B[32m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Yellow(this string text)
|
||||
{
|
||||
return "\x1B[33m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Blue(this string text)
|
||||
{
|
||||
return "\x1B[34m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Magenta(this string text)
|
||||
{
|
||||
return "\x1B[35m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Cyan(this string text)
|
||||
{
|
||||
return "\x1B[36m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string White(this string text)
|
||||
{
|
||||
return "\x1B[37m" + text + "\x1B[39m";
|
||||
}
|
||||
|
||||
public static string Bold(this string text)
|
||||
{
|
||||
return "\x1B[1m" + text + "\x1B[22m";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class AnsiConsole
|
||||
{
|
||||
private AnsiConsole(TextWriter writer)
|
||||
{
|
||||
Writer = writer;
|
||||
|
||||
OriginalForegroundColor = Console.ForegroundColor;
|
||||
}
|
||||
|
||||
private int _boldRecursion;
|
||||
|
||||
public static AnsiConsole GetOutput()
|
||||
{
|
||||
return new AnsiConsole(Console.Out);
|
||||
}
|
||||
|
||||
public static AnsiConsole GetError()
|
||||
{
|
||||
return new AnsiConsole(Console.Error);
|
||||
}
|
||||
|
||||
public TextWriter Writer { get; }
|
||||
|
||||
public ConsoleColor OriginalForegroundColor { get; }
|
||||
|
||||
private void SetColor(ConsoleColor color)
|
||||
{
|
||||
const int Light = 0x08;
|
||||
int c = (int)color;
|
||||
|
||||
Console.ForegroundColor =
|
||||
c < 0 ? color : // unknown, just use it
|
||||
_boldRecursion > 0 ? (ConsoleColor)(c | Light) : // ensure color is light
|
||||
(ConsoleColor)(c & ~Light); // ensure color is dark
|
||||
}
|
||||
|
||||
private void SetBold(bool bold)
|
||||
{
|
||||
_boldRecursion += bold ? 1 : -1;
|
||||
if (_boldRecursion > 1 || (_boldRecursion == 1 && !bold))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// switches on _boldRecursion to handle boldness
|
||||
SetColor(Console.ForegroundColor);
|
||||
}
|
||||
|
||||
public void WriteLine(string message)
|
||||
{
|
||||
Write(message);
|
||||
Writer.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
public void Write(string message)
|
||||
{
|
||||
var escapeScan = 0;
|
||||
for (;;)
|
||||
{
|
||||
var escapeIndex = message.IndexOf("\x1b[", escapeScan);
|
||||
if (escapeIndex == -1)
|
||||
{
|
||||
var text = message.Substring(escapeScan);
|
||||
Writer.Write(text);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var startIndex = escapeIndex + 2;
|
||||
var endIndex = startIndex;
|
||||
while (endIndex != message.Length &&
|
||||
message[endIndex] >= 0x20 &&
|
||||
message[endIndex] <= 0x3f)
|
||||
{
|
||||
endIndex += 1;
|
||||
}
|
||||
|
||||
var text = message.Substring(escapeScan, escapeIndex - escapeScan);
|
||||
Writer.Write(text);
|
||||
if (endIndex == message.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
switch (message[endIndex])
|
||||
{
|
||||
case 'm':
|
||||
int value;
|
||||
if (int.TryParse(message.Substring(startIndex, endIndex - startIndex), out value))
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 1:
|
||||
SetBold(true);
|
||||
break;
|
||||
case 22:
|
||||
SetBold(false);
|
||||
break;
|
||||
case 30:
|
||||
SetColor(ConsoleColor.Black);
|
||||
break;
|
||||
case 31:
|
||||
SetColor(ConsoleColor.Red);
|
||||
break;
|
||||
case 32:
|
||||
SetColor(ConsoleColor.Green);
|
||||
break;
|
||||
case 33:
|
||||
SetColor(ConsoleColor.Yellow);
|
||||
break;
|
||||
case 34:
|
||||
SetColor(ConsoleColor.Blue);
|
||||
break;
|
||||
case 35:
|
||||
SetColor(ConsoleColor.Magenta);
|
||||
break;
|
||||
case 36:
|
||||
SetColor(ConsoleColor.Cyan);
|
||||
break;
|
||||
case 37:
|
||||
SetColor(ConsoleColor.Gray);
|
||||
break;
|
||||
case 39:
|
||||
Console.ForegroundColor = OriginalForegroundColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
escapeScan = endIndex + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class ArgumentEscaper
|
||||
{
|
||||
/// <summary>
|
||||
/// Undo the processing which took place to create string[] args in Main,
|
||||
/// so that the next process will receive the same string[] args
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string EscapeAndConcatenateArgArrayForProcessStart(IEnumerable<string> args)
|
||||
{
|
||||
return string.Join(" ", EscapeArgArray(args));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Undo the processing which took place to create string[] args in Main,
|
||||
/// so that the next process will receive the same string[] args
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string EscapeAndConcatenateArgArrayForCmdProcessStart(IEnumerable<string> args)
|
||||
{
|
||||
return string.Join(" ", EscapeArgArrayForCmd(args));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Undo the processing which took place to create string[] args in Main,
|
||||
/// so that the next process will receive the same string[] args
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<string> EscapeArgArray(IEnumerable<string> args)
|
||||
{
|
||||
var escapedArgs = new List<string>();
|
||||
|
||||
foreach (var arg in args)
|
||||
{
|
||||
escapedArgs.Add(EscapeArg(arg));
|
||||
}
|
||||
|
||||
return escapedArgs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This prefixes every character with the '^' character to force cmd to
|
||||
/// interpret the argument string literally. An alternative option would
|
||||
/// be to do this only for cmd metacharacters.
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<string> EscapeArgArrayForCmd(IEnumerable<string> arguments)
|
||||
{
|
||||
var escapedArgs = new List<string>();
|
||||
|
||||
foreach (var arg in arguments)
|
||||
{
|
||||
escapedArgs.Add(EscapeArgForCmd(arg));
|
||||
}
|
||||
|
||||
return escapedArgs;
|
||||
}
|
||||
|
||||
private static string EscapeArg(string arg)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var quoted = ShouldSurroundWithQuotes(arg);
|
||||
if (quoted) sb.Append("\"");
|
||||
|
||||
for (int i = 0; i < arg.Length; ++i)
|
||||
{
|
||||
var backslashCount = 0;
|
||||
|
||||
// Consume All Backslashes
|
||||
while (i < arg.Length && arg[i] == '\\')
|
||||
{
|
||||
backslashCount++;
|
||||
i++;
|
||||
}
|
||||
|
||||
// Escape any backslashes at the end of the arg
|
||||
// This ensures the outside quote is interpreted as
|
||||
// an argument delimiter
|
||||
if (i == arg.Length)
|
||||
{
|
||||
sb.Append('\\', 2 * backslashCount);
|
||||
}
|
||||
|
||||
// Escape any preceding backslashes and the quote
|
||||
else if (arg[i] == '"')
|
||||
{
|
||||
sb.Append('\\', (2 * backslashCount) + 1);
|
||||
sb.Append('"');
|
||||
}
|
||||
|
||||
// Output any consumed backslashes and the character
|
||||
else
|
||||
{
|
||||
sb.Append('\\', backslashCount);
|
||||
sb.Append(arg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (quoted) sb.Append("\"");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepare as single argument to
|
||||
/// roundtrip properly through cmd.
|
||||
///
|
||||
/// This prefixes every character with the '^' character to force cmd to
|
||||
/// interpret the argument string literally. An alternative option would
|
||||
/// be to do this only for cmd metacharacters.
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
private static string EscapeArgForCmd(string argument)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var quoted = ShouldSurroundWithQuotes(argument);
|
||||
|
||||
if (quoted) sb.Append("^\"");
|
||||
|
||||
foreach (var character in argument)
|
||||
{
|
||||
|
||||
if (character == '"')
|
||||
{
|
||||
|
||||
sb.Append('^');
|
||||
sb.Append('"');
|
||||
sb.Append('^');
|
||||
sb.Append(character);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("^");
|
||||
sb.Append(character);
|
||||
}
|
||||
}
|
||||
|
||||
if (quoted) sb.Append("^\"");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepare as single argument to
|
||||
/// roundtrip properly through cmd.
|
||||
///
|
||||
/// This prefixes every character with the '^' character to force cmd to
|
||||
/// interpret the argument string literally. An alternative option would
|
||||
/// be to do this only for cmd metacharacters.
|
||||
///
|
||||
/// See here for more info:
|
||||
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool ShouldSurroundWithQuotes(string argument)
|
||||
{
|
||||
// Don't quote already quoted strings
|
||||
if (argument.StartsWith("\"", StringComparison.Ordinal) &&
|
||||
argument.EndsWith("\"", StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only quote if whitespace exists in the string
|
||||
if (argument.Contains(" ") || argument.Contains("\t") || argument.Contains("\n"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildContext
|
||||
{
|
||||
private IDictionary<string, BuildTargetResult> _completedTargets = new Dictionary<string, BuildTargetResult>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static readonly string DefaultTarget = "Default";
|
||||
|
||||
private int _maxTargetLen;
|
||||
private Stack<string> _targetStack = new Stack<string>();
|
||||
|
||||
public IDictionary<string, BuildTarget> Targets { get; }
|
||||
|
||||
public IDictionary<string, object> Properties = new Dictionary<string, object>();
|
||||
|
||||
public string BuildDirectory { get; }
|
||||
|
||||
public object this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Properties.ContainsKey(name))
|
||||
{
|
||||
return Properties[name];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new KeyNotFoundException("No property with key " + name + " was found.");
|
||||
}
|
||||
}
|
||||
set { Properties[name] = value; }
|
||||
}
|
||||
|
||||
public BuildContext(IDictionary<string, BuildTarget> targets, string buildDirectory)
|
||||
{
|
||||
Targets = targets;
|
||||
BuildDirectory = buildDirectory;
|
||||
_maxTargetLen = targets.Values.Select(t => t.Name.Length).Max();
|
||||
}
|
||||
|
||||
public T Get<T>(string name) => (T)this[name];
|
||||
|
||||
public BuildTargetResult RunTarget(string name) => RunTarget(name, force: false);
|
||||
|
||||
public BuildTargetResult RunTarget(string name, bool force)
|
||||
{
|
||||
BuildTarget target;
|
||||
if (!Targets.TryGetValue(name, out target))
|
||||
{
|
||||
throw new UndefinedTargetException($"Undefined target: {name}");
|
||||
}
|
||||
|
||||
if (!EvaluateTargetConditions(target))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"Skipping, Target Conditions not met: {target.Name}");
|
||||
return new BuildTargetResult(target, success: true);
|
||||
}
|
||||
|
||||
// Check if it's been completed
|
||||
BuildTargetResult result;
|
||||
if (!force && _completedTargets.TryGetValue(name, out result))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"Skipping completed target: {target.Name}");
|
||||
return result;
|
||||
}
|
||||
|
||||
// It hasn't, or we're forcing, so run it
|
||||
result = ExecTarget(target);
|
||||
_completedTargets[target.Name] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Verbose(string message)
|
||||
{
|
||||
Reporter.Output.WriteLine("trace".White() + $": {message}");
|
||||
}
|
||||
|
||||
public void Info(string message)
|
||||
{
|
||||
Reporter.Output.WriteLine("info ".Green() + $": {message}");
|
||||
}
|
||||
|
||||
public void Warn(string message)
|
||||
{
|
||||
Reporter.Output.WriteLine("warn ".Yellow() + $": {message}");
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
Reporter.Error.WriteLine("error".Red().Bold() + $": {message}");
|
||||
}
|
||||
|
||||
private bool EvaluateTargetConditions(BuildTarget target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(target));
|
||||
}
|
||||
|
||||
if (target.Conditions == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var condition in target.Conditions)
|
||||
{
|
||||
if (!condition())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private BuildTargetResult ExecTarget(BuildTarget target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(target));
|
||||
}
|
||||
|
||||
var sectionName = $"{target.Name.PadRight(_maxTargetLen + 2).Yellow()} ({target.Source.White()})";
|
||||
BuildReporter.BeginSection("TARGET", sectionName);
|
||||
|
||||
BuildTargetResult result;
|
||||
|
||||
// Run the dependencies
|
||||
var dependencyResults = new Dictionary<string, BuildTargetResult>();
|
||||
var failedDependencyResult = RunDependencies(target, dependencyResults);
|
||||
if (failedDependencyResult != null)
|
||||
{
|
||||
result = failedDependencyResult;
|
||||
}
|
||||
else if (target.Body != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
result = target.Body(new BuildTargetContext(this, target, dependencyResults));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = new BuildTargetResult(target, success: false, exception: ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new BuildTargetResult(target, success: true);
|
||||
}
|
||||
BuildReporter.EndSection("TARGET", sectionName, result.Success);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private BuildTargetResult RunDependencies(BuildTarget target, Dictionary<string, BuildTargetResult> dependencyResults)
|
||||
{
|
||||
BuildTargetResult result = null;
|
||||
foreach (var dependency in target.Dependencies)
|
||||
{
|
||||
result = RunTarget(dependency);
|
||||
dependencyResults[dependency] = result;
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildFailureException : Exception
|
||||
{
|
||||
public BuildTarget Target { get; }
|
||||
|
||||
public BuildFailureException()
|
||||
{
|
||||
}
|
||||
|
||||
public BuildFailureException(BuildTarget target) : base($"The '{target.Name}' target failed")
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public BuildFailureException(BuildTarget target, Exception innerException) : base($"The '{target.Name}' target failed", innerException)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public BuildFailureException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildFailureException(string message, BuildTarget target) : base(message)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public BuildFailureException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildFailureException(string message, Exception innerException, BuildTarget target) : base(message, innerException)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class BuildHelpers
|
||||
{
|
||||
public static int ExecInSilent(string workingDirectory, string command, params string[] args) => ExecInSilent(workingDirectory, command, (IEnumerable<string>)args);
|
||||
public static int ExecInSilent(string workingDirectory, string command, IEnumerable<string> args) => ExecCore(command, args, workingDirectory, silent: true, env: null);
|
||||
|
||||
public static int ExecIn(string workingDirectory, string command, params string[] args) => ExecIn(workingDirectory, command, (IEnumerable<string>)args);
|
||||
public static int ExecIn(string workingDirectory, string command, IEnumerable<string> args) => ExecCore(command, args, workingDirectory, silent: false, env: null);
|
||||
|
||||
public static int ExecSilent(string command, params string[] args) => ExecSilent(command, (IEnumerable<string>)args);
|
||||
public static int ExecSilent(string command, IEnumerable<string> args) => ExecSilent(command, args, env: null);
|
||||
public static int ExecSilent(string command, IEnumerable<string> args, IDictionary<string, string> env) => ExecCore(command, args, workingDirectory: null, silent: true, env: null);
|
||||
|
||||
public static int Exec(string command, params string[] args) => Exec(command, (IEnumerable<string>)args);
|
||||
public static int Exec(string command, IEnumerable<string> args) => ExecCore(command, args, workingDirectory: null, silent: false, env: null);
|
||||
|
||||
public static Command Cmd(string command, params string[] args) => Cmd(command, (IEnumerable<string>)args);
|
||||
public static Command Cmd(string command, IEnumerable<string> args)
|
||||
{
|
||||
return Command.Create(command, args);
|
||||
}
|
||||
|
||||
internal static int ExecCore(string command, IEnumerable<string> args, string workingDirectory, bool silent, IDictionary<string, string> env)
|
||||
{
|
||||
var cmd = Cmd(command, args);
|
||||
if (!string.IsNullOrEmpty(workingDirectory))
|
||||
{
|
||||
cmd.WorkingDirectory(workingDirectory);
|
||||
}
|
||||
|
||||
if (silent)
|
||||
{
|
||||
cmd.CaptureStdErr().CaptureStdOut();
|
||||
}
|
||||
|
||||
var result = cmd.Environment(env).Execute();
|
||||
|
||||
result.EnsureSuccessful();
|
||||
return result.ExitCode;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class BuildReporter
|
||||
{
|
||||
private const string TimeSpanFormat = @"hh\:mm\:ss\.fff";
|
||||
private static DateTime _initialTime = DateTime.Now;
|
||||
|
||||
public static void BeginSection(string type, string name)
|
||||
{
|
||||
Reporter.Output.WriteLine($"[{type.PadRight(10)} >]".Green() + $" [....] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
|
||||
}
|
||||
|
||||
public static void EndSection(string type, string name, bool success)
|
||||
{
|
||||
var header = $"[{type.PadRight(10)} <]";
|
||||
if(success)
|
||||
{
|
||||
header = header.Green();
|
||||
}
|
||||
else
|
||||
{
|
||||
header = header.Red();
|
||||
}
|
||||
var successString = success ? " OK " : "FAIL";
|
||||
Reporter.Output.WriteLine(header + $" [{successString}] [{(DateTime.Now - _initialTime).ToString(TimeSpanFormat)}]".Blue() + $" {name}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildSetup
|
||||
{
|
||||
private Dictionary<string, BuildTarget> _targets = new Dictionary<string, BuildTarget>();
|
||||
|
||||
public IList<TargetOverride> _overrides = new List<TargetOverride>();
|
||||
|
||||
public string ProductName { get; }
|
||||
|
||||
public BuildSetup(string productName)
|
||||
{
|
||||
ProductName = productName;
|
||||
}
|
||||
|
||||
public static BuildSetup Create(string productName)
|
||||
{
|
||||
return new BuildSetup(productName);
|
||||
}
|
||||
|
||||
public BuildSetup UseTargets(IEnumerable<BuildTarget> targets)
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
BuildTarget previousTarget;
|
||||
if (_targets.TryGetValue(target.Name, out previousTarget))
|
||||
{
|
||||
_overrides.Add(new TargetOverride(target.Name, previousTarget.Source, target.Source));
|
||||
}
|
||||
_targets[target.Name] = target;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BuildSetup UseAllTargetsFromAssembly<T>()
|
||||
{
|
||||
var asm = typeof(T).GetTypeInfo().Assembly;
|
||||
return UseTargets(asm.GetExportedTypes().SelectMany(t => CollectTargets(t)));
|
||||
}
|
||||
|
||||
public BuildSetup UseTargetsFrom<T>()
|
||||
{
|
||||
return UseTargets(CollectTargets(typeof(T)));
|
||||
}
|
||||
|
||||
public int Run(string[] args)
|
||||
{
|
||||
var targets = new[] { BuildContext.DefaultTarget };
|
||||
if(args.Length > 0)
|
||||
{
|
||||
targets = args;
|
||||
}
|
||||
|
||||
Reporter.Output.WriteBanner($"Building {ProductName}");
|
||||
|
||||
if (_overrides.Any())
|
||||
{
|
||||
foreach (var targetOverride in _overrides)
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"Target {targetOverride.Name} from {targetOverride.OriginalSource} was overridden in {targetOverride.OverrideSource}".Black());
|
||||
}
|
||||
}
|
||||
|
||||
var context = new BuildContext(_targets, Directory.GetCurrentDirectory());
|
||||
BuildTargetResult result = null;
|
||||
try
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
result = context.RunTarget(target);
|
||||
if(!result.Success)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Reporter.Error.WriteLine(ex.ToString().Red());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(result != null && !result.Success)
|
||||
{
|
||||
Reporter.Error.WriteLine($"Build failed: {result.ErrorMessage}".Red());
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Reporter.Output.WriteLine("Build succeeded".Green());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<BuildTarget> CollectTargets(Type typ)
|
||||
{
|
||||
return from m in typ.GetMethods()
|
||||
let targetAttribute = m.GetCustomAttribute<TargetAttribute>()
|
||||
let conditionalAttributes = m.GetCustomAttributes<TargetConditionAttribute>(false)
|
||||
where targetAttribute != null
|
||||
select CreateTarget(m, targetAttribute, conditionalAttributes);
|
||||
}
|
||||
|
||||
private static BuildTarget CreateTarget(
|
||||
MethodInfo methodInfo,
|
||||
TargetAttribute targetAttribute,
|
||||
IEnumerable<TargetConditionAttribute> targetConditionAttributes)
|
||||
{
|
||||
var name = targetAttribute.Name ?? methodInfo.Name;
|
||||
|
||||
var conditions = ExtractTargetConditionsFromAttributes(targetConditionAttributes);
|
||||
|
||||
return new BuildTarget(
|
||||
name,
|
||||
$"{methodInfo.DeclaringType.FullName}.{methodInfo.Name}",
|
||||
targetAttribute.Dependencies,
|
||||
conditions,
|
||||
(Func<BuildTargetContext, BuildTargetResult>)methodInfo.CreateDelegate(typeof(Func<BuildTargetContext, BuildTargetResult>)));
|
||||
}
|
||||
|
||||
private static IEnumerable<Func<bool>> ExtractTargetConditionsFromAttributes(
|
||||
IEnumerable<TargetConditionAttribute> targetConditionAttributes)
|
||||
{
|
||||
if (targetConditionAttributes == null || targetConditionAttributes.Count() == 0)
|
||||
{
|
||||
return Enumerable.Empty<Func<bool>>();
|
||||
}
|
||||
|
||||
return targetConditionAttributes
|
||||
.Select<TargetConditionAttribute, Func<bool>>(c => c.EvaluateCondition)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private string GenerateSourceString(string file, int? line, string member)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(file) && line != null)
|
||||
{
|
||||
return $"{file}:{line}";
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(member))
|
||||
{
|
||||
return member;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public class TargetOverride
|
||||
{
|
||||
public string Name { get; }
|
||||
public string OriginalSource { get; }
|
||||
public string OverrideSource { get; }
|
||||
|
||||
public TargetOverride(string name, string originalSource, string overrideSource)
|
||||
{
|
||||
Name = name;
|
||||
OriginalSource = originalSource;
|
||||
OverrideSource = overrideSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildTarget
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Source { get; }
|
||||
public IEnumerable<string> Dependencies { get; }
|
||||
public IEnumerable<Func<bool>> Conditions { get; }
|
||||
public Func<BuildTargetContext, BuildTargetResult> Body { get; }
|
||||
|
||||
public BuildTarget(string name, string source) : this(name, source, Enumerable.Empty<string>(), Enumerable.Empty<Func<bool>>(), null) { }
|
||||
public BuildTarget(string name, string source, IEnumerable<string> dependencies) : this(name, source, dependencies, Enumerable.Empty<Func<bool>>(), null) { }
|
||||
public BuildTarget(
|
||||
string name,
|
||||
string source,
|
||||
IEnumerable<string> dependencies,
|
||||
IEnumerable<Func<bool>> conditions,
|
||||
Func<BuildTargetContext, BuildTargetResult> body)
|
||||
{
|
||||
Name = name;
|
||||
Source = source;
|
||||
Dependencies = dependencies;
|
||||
Conditions = conditions;
|
||||
Body = body;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildTargetContext
|
||||
{
|
||||
private IDictionary<string, BuildTargetResult> _dependencyResults;
|
||||
|
||||
public BuildContext BuildContext { get; }
|
||||
public BuildTarget Target { get; }
|
||||
|
||||
public BuildTargetContext(BuildContext buildContext, BuildTarget target, IDictionary<string, BuildTargetResult> dependencyResults)
|
||||
{
|
||||
BuildContext = buildContext;
|
||||
Target = target;
|
||||
_dependencyResults = dependencyResults;
|
||||
}
|
||||
|
||||
public BuildTargetResult Success()
|
||||
{
|
||||
return new BuildTargetResult(Target, success: true);
|
||||
}
|
||||
|
||||
public BuildTargetResult Failed() => Failed(errorMessage: string.Empty);
|
||||
|
||||
public BuildTargetResult Failed(string errorMessage)
|
||||
{
|
||||
return new BuildTargetResult(Target, success: false, errorMessage: errorMessage);
|
||||
}
|
||||
|
||||
public void Info(string message) => BuildContext.Info(message);
|
||||
public void Warn(string message) => BuildContext.Warn(message);
|
||||
public void Error(string message) => BuildContext.Error(message);
|
||||
public void Verbose(string message) => BuildContext.Verbose(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class BuildTargetResult
|
||||
{
|
||||
public BuildTarget Target { get; }
|
||||
public bool Success { get; }
|
||||
public string ErrorMessage { get; }
|
||||
public Exception Exception { get; }
|
||||
|
||||
public BuildTargetResult(BuildTarget target, bool success) : this(target, success, errorMessage: string.Empty) { }
|
||||
|
||||
public BuildTargetResult(BuildTarget target, bool success, Exception exception) : this(target, success, exception.ToString())
|
||||
{
|
||||
Exception = exception;
|
||||
}
|
||||
|
||||
public BuildTargetResult(BuildTarget target, bool success, string errorMessage)
|
||||
{
|
||||
Target = target;
|
||||
Success = success;
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public void EnsureSuccessful()
|
||||
{
|
||||
if(!Success)
|
||||
{
|
||||
if(string.IsNullOrEmpty(ErrorMessage))
|
||||
{
|
||||
throw new BuildFailureException(Target, Exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new BuildFailureException(ErrorMessage, Exception, Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,361 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class Command
|
||||
{
|
||||
private Process _process;
|
||||
|
||||
private StringWriter _stdOutCapture;
|
||||
private StringWriter _stdErrCapture;
|
||||
|
||||
private Action<string> _stdOutForward;
|
||||
private Action<string> _stdErrForward;
|
||||
|
||||
private Action<string> _stdOutHandler;
|
||||
private Action<string> _stdErrHandler;
|
||||
|
||||
private bool _running = false;
|
||||
private bool _quietBuildReporter = false;
|
||||
|
||||
private Command(string executable, string args)
|
||||
{
|
||||
// Set the things we need
|
||||
var psi = new ProcessStartInfo()
|
||||
{
|
||||
FileName = executable,
|
||||
Arguments = args
|
||||
};
|
||||
|
||||
_process = new Process()
|
||||
{
|
||||
StartInfo = psi
|
||||
};
|
||||
}
|
||||
|
||||
public static Command Create(string executable, params string[] args)
|
||||
{
|
||||
return Create(executable, ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args));
|
||||
}
|
||||
|
||||
public static Command Create(string executable, IEnumerable<string> args)
|
||||
{
|
||||
return Create(executable, ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args));
|
||||
}
|
||||
|
||||
public static Command Create(string executable, string args)
|
||||
{
|
||||
ResolveExecutablePath(ref executable, ref args);
|
||||
|
||||
return new Command(executable, args);
|
||||
}
|
||||
|
||||
private static void ResolveExecutablePath(ref string executable, ref string args)
|
||||
{
|
||||
foreach (string suffix in Constants.RunnableSuffixes)
|
||||
{
|
||||
var fullExecutable = Path.GetFullPath(Path.Combine(
|
||||
AppContext.BaseDirectory, executable + suffix));
|
||||
|
||||
if (File.Exists(fullExecutable))
|
||||
{
|
||||
executable = fullExecutable;
|
||||
|
||||
// In priority order we've found the best runnable extension, so break.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// On Windows, we want to avoid using "cmd" if possible (it mangles the colors, and a bunch of other things)
|
||||
// So, do a quick path search to see if we can just directly invoke it
|
||||
var useCmd = ShouldUseCmd(executable);
|
||||
|
||||
if (useCmd)
|
||||
{
|
||||
var comSpec = System.Environment.GetEnvironmentVariable("ComSpec");
|
||||
|
||||
// cmd doesn't like "foo.exe ", so we need to ensure that if
|
||||
// args is empty, we just run "foo.exe"
|
||||
if (!string.IsNullOrEmpty(args))
|
||||
{
|
||||
executable = (executable + " " + args).Replace("\"", "\\\"");
|
||||
}
|
||||
args = $"/C \"{executable}\"";
|
||||
executable = comSpec;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldUseCmd(string executable)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
var extension = Path.GetExtension(executable);
|
||||
if (!string.IsNullOrEmpty(extension))
|
||||
{
|
||||
return !string.Equals(extension, ".exe", StringComparison.Ordinal);
|
||||
}
|
||||
else if (executable.Contains(Path.DirectorySeparatorChar))
|
||||
{
|
||||
// It's a relative path without an extension
|
||||
if (File.Exists(executable + ".exe"))
|
||||
{
|
||||
// It refers to an exe!
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Search the path to see if we can find it
|
||||
foreach (var path in System.Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator))
|
||||
{
|
||||
var candidate = Path.Combine(path, executable + ".exe");
|
||||
if (File.Exists(candidate))
|
||||
{
|
||||
// We found an exe!
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// It's a non-exe :(
|
||||
return true;
|
||||
}
|
||||
|
||||
// Non-windows never uses cmd
|
||||
return false;
|
||||
}
|
||||
|
||||
public Command Environment(IDictionary<string, string> env)
|
||||
{
|
||||
if (env == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
foreach (var item in env)
|
||||
{
|
||||
_process.StartInfo.Environment[item.Key] = item.Value;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command Environment(string key, string value)
|
||||
{
|
||||
_process.StartInfo.Environment[key] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command QuietBuildReporter()
|
||||
{
|
||||
_quietBuildReporter = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandResult Execute()
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_running = true;
|
||||
|
||||
if (_process.StartInfo.RedirectStandardOutput)
|
||||
{
|
||||
_process.OutputDataReceived += (sender, args) =>
|
||||
{
|
||||
ProcessData(args.Data, _stdOutCapture, _stdOutForward, _stdOutHandler);
|
||||
};
|
||||
}
|
||||
|
||||
if (_process.StartInfo.RedirectStandardError)
|
||||
{
|
||||
_process.ErrorDataReceived += (sender, args) =>
|
||||
{
|
||||
ProcessData(args.Data, _stdErrCapture, _stdErrForward, _stdErrHandler);
|
||||
};
|
||||
}
|
||||
|
||||
_process.EnableRaisingEvents = true;
|
||||
|
||||
var sw = Stopwatch.StartNew();
|
||||
ReportExecBegin();
|
||||
|
||||
_process.Start();
|
||||
|
||||
if (_process.StartInfo.RedirectStandardOutput)
|
||||
{
|
||||
_process.BeginOutputReadLine();
|
||||
}
|
||||
|
||||
if (_process.StartInfo.RedirectStandardError)
|
||||
{
|
||||
_process.BeginErrorReadLine();
|
||||
}
|
||||
|
||||
_process.WaitForExit();
|
||||
|
||||
var exitCode = _process.ExitCode;
|
||||
|
||||
ReportExecEnd(exitCode);
|
||||
|
||||
return new CommandResult(
|
||||
_process.StartInfo,
|
||||
exitCode,
|
||||
_stdOutCapture?.GetStringBuilder()?.ToString(),
|
||||
_stdErrCapture?.GetStringBuilder()?.ToString());
|
||||
}
|
||||
|
||||
public Command WorkingDirectory(string projectDirectory)
|
||||
{
|
||||
_process.StartInfo.WorkingDirectory = projectDirectory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command EnvironmentVariable(string name, string value)
|
||||
{
|
||||
_process.StartInfo.Environment[name] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command CaptureStdOut()
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardOutput = true;
|
||||
_stdOutCapture = new StringWriter();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command CaptureStdErr()
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardError = true;
|
||||
_stdErrCapture = new StringWriter();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command ForwardStdOut(TextWriter to = null)
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardOutput = true;
|
||||
if (to == null)
|
||||
{
|
||||
_stdOutForward = Reporter.Output.WriteLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stdOutForward = to.WriteLine;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command ForwardStdErr(TextWriter to = null)
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardError = true;
|
||||
if (to == null)
|
||||
{
|
||||
_stdErrForward = Reporter.Error.WriteLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
_stdErrForward = to.WriteLine;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command OnOutputLine(Action<string> handler)
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardOutput = true;
|
||||
if (_stdOutHandler != null)
|
||||
{
|
||||
throw new InvalidOperationException("Already handling stdout!");
|
||||
}
|
||||
_stdOutHandler = handler;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Command OnErrorLine(Action<string> handler)
|
||||
{
|
||||
ThrowIfRunning();
|
||||
_process.StartInfo.RedirectStandardError = true;
|
||||
if (_stdErrHandler != null)
|
||||
{
|
||||
throw new InvalidOperationException("Already handling stderr!");
|
||||
}
|
||||
_stdErrHandler = handler;
|
||||
return this;
|
||||
}
|
||||
|
||||
private string FormatProcessInfo(ProcessStartInfo info)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(info.Arguments))
|
||||
{
|
||||
return info.FileName;
|
||||
}
|
||||
|
||||
return info.FileName + " " + info.Arguments;
|
||||
}
|
||||
|
||||
private void ReportExecBegin()
|
||||
{
|
||||
if (!_quietBuildReporter)
|
||||
{
|
||||
BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo));
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportExecEnd(int exitCode)
|
||||
{
|
||||
if (!_quietBuildReporter)
|
||||
{
|
||||
var message = $"{FormatProcessInfo(_process.StartInfo)} exited with {exitCode}";
|
||||
if (exitCode == 0)
|
||||
{
|
||||
BuildReporter.EndSection("EXEC", message.Green(), success: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildReporter.EndSection("EXEC", message.Red().Bold(), success: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowIfRunning([CallerMemberName] string memberName = null)
|
||||
{
|
||||
if (_running)
|
||||
{
|
||||
throw new InvalidOperationException($"Unable to invoke {memberName} after the command has been run");
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessData(string data, StringWriter capture, Action<string> forward, Action<string> handler)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (capture != null)
|
||||
{
|
||||
capture.WriteLine(data);
|
||||
}
|
||||
|
||||
if (forward != null)
|
||||
{
|
||||
forward(data);
|
||||
}
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public struct CommandResult
|
||||
{
|
||||
public static readonly CommandResult Empty = new CommandResult();
|
||||
|
||||
public ProcessStartInfo StartInfo { get; }
|
||||
public int ExitCode { get; }
|
||||
public string StdOut { get; }
|
||||
public string StdErr { get; }
|
||||
|
||||
public CommandResult(ProcessStartInfo startInfo, int exitCode, string stdOut, string stdErr)
|
||||
{
|
||||
StartInfo = startInfo;
|
||||
ExitCode = exitCode;
|
||||
StdOut = stdOut;
|
||||
StdErr = stdErr;
|
||||
}
|
||||
|
||||
public void EnsureSuccessful(bool suppressOutput = false)
|
||||
{
|
||||
if(ExitCode != 0)
|
||||
{
|
||||
StringBuilder message = new StringBuilder($"Command failed with exit code {ExitCode}: {StartInfo.FileName} {StartInfo.Arguments}");
|
||||
|
||||
if (!suppressOutput)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(StdOut))
|
||||
{
|
||||
message.AppendLine($"{Environment.NewLine}Standard Output:{Environment.NewLine}{StdOut}");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(StdErr))
|
||||
{
|
||||
message.AppendLine($"{Environment.NewLine}Standard Error:{Environment.NewLine}{StdErr}");
|
||||
}
|
||||
}
|
||||
|
||||
throw new BuildFailureException(message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
//public static readonly string ProjectFileName = "project.json";
|
||||
public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;
|
||||
|
||||
// Priority order of runnable suffixes to look for and run
|
||||
public static readonly string[] RunnableSuffixes = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
||||
? new string[] { ".exe", ".cmd", ".bat" }
|
||||
: new string[] { string.Empty };
|
||||
|
||||
public static readonly string DynamicLibPrefix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "lib";
|
||||
|
||||
public static readonly string DynamicLibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".dll" :
|
||||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib" : ".so";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class CurrentArchitecture
|
||||
{
|
||||
public static BuildArchitecture Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return DetermineCurrentArchitecture();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Isx86
|
||||
{
|
||||
get
|
||||
{
|
||||
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
||||
return string.Equals(archName, "x86", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Isx64
|
||||
{
|
||||
get
|
||||
{
|
||||
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
||||
return string.Equals(archName, "x64", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
private static BuildArchitecture DetermineCurrentArchitecture()
|
||||
{
|
||||
if (Isx86)
|
||||
{
|
||||
return BuildArchitecture.x86;
|
||||
}
|
||||
else if (Isx64)
|
||||
{
|
||||
return BuildArchitecture.x64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(BuildArchitecture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class CurrentPlatform
|
||||
{
|
||||
public static BuildPlatform Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return DetermineCurrentPlatform();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsOSX
|
||||
{
|
||||
get
|
||||
{
|
||||
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsUbuntu
|
||||
{
|
||||
get
|
||||
{
|
||||
var osname = RuntimeEnvironment.OperatingSystem;
|
||||
return string.Equals(osname, "ubuntu", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsCentOS
|
||||
{
|
||||
get
|
||||
{
|
||||
var osname = RuntimeEnvironment.OperatingSystem;
|
||||
return string.Equals(osname, "centos", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsRHEL
|
||||
{
|
||||
get
|
||||
{
|
||||
var osname = RuntimeEnvironment.OperatingSystem;
|
||||
return string.Equals(osname, "rhel", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsUnix
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsLinux || IsOSX;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsDebian
|
||||
{
|
||||
get
|
||||
{
|
||||
var osname = RuntimeEnvironment.OperatingSystem;
|
||||
return string.Equals(osname, "debian", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsLinux
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsUbuntu || IsCentOS || IsRHEL || IsDebian;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsPlatform(BuildPlatform platform)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case BuildPlatform.Windows:
|
||||
return IsWindows;
|
||||
case BuildPlatform.Ubuntu:
|
||||
return IsUbuntu;
|
||||
case BuildPlatform.OSX:
|
||||
return IsOSX;
|
||||
case BuildPlatform.CentOS:
|
||||
return IsCentOS;
|
||||
case BuildPlatform.RHEL:
|
||||
return IsRHEL;
|
||||
case BuildPlatform.Debian:
|
||||
return IsDebian;
|
||||
case BuildPlatform.Unix:
|
||||
return IsUnix;
|
||||
case BuildPlatform.Linux:
|
||||
return IsLinux;
|
||||
default:
|
||||
throw new Exception("Unrecognized Platform.");
|
||||
}
|
||||
}
|
||||
|
||||
private static BuildPlatform DetermineCurrentPlatform()
|
||||
{
|
||||
if (IsWindows)
|
||||
{
|
||||
return BuildPlatform.Windows;
|
||||
}
|
||||
else if (IsOSX)
|
||||
{
|
||||
return BuildPlatform.OSX;
|
||||
}
|
||||
else if (IsUbuntu)
|
||||
{
|
||||
return BuildPlatform.Ubuntu;
|
||||
}
|
||||
else if (IsCentOS)
|
||||
{
|
||||
return BuildPlatform.CentOS;
|
||||
}
|
||||
else if (IsRHEL)
|
||||
{
|
||||
return BuildPlatform.RHEL;
|
||||
}
|
||||
else if (IsDebian)
|
||||
{
|
||||
return BuildPlatform.Debian;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(BuildPlatform);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class DebugHelper
|
||||
{
|
||||
[Conditional("DEBUG")]
|
||||
public static void HandleDebugSwitch(ref string[] args)
|
||||
{
|
||||
if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
args = args.Skip(1).ToArray();
|
||||
WaitForDebugger();
|
||||
}
|
||||
}
|
||||
|
||||
private static void WaitForDebugger()
|
||||
{
|
||||
Console.WriteLine("Waiting for debugger to attach. Press ENTER to continue");
|
||||
Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public enum BuildArchitecture
|
||||
{
|
||||
x86 = 1,
|
||||
x64 = 2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public enum BuildPlatform
|
||||
{
|
||||
Windows = 1,
|
||||
Unix = 2,
|
||||
Linux = 3,
|
||||
OSX = 4,
|
||||
Ubuntu = 5,
|
||||
CentOS = 6,
|
||||
RHEL = 7,
|
||||
Debian = 8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>49beb486-ab5a-4416-91ea-8cd34abb0c9d</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.Build.Framework</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
// Stupid-simple console manager
|
||||
internal class Reporter
|
||||
{
|
||||
private static readonly Reporter Null = new Reporter(console: null);
|
||||
private static object _lock = new object();
|
||||
|
||||
private readonly AnsiConsole _console;
|
||||
|
||||
private Reporter(AnsiConsole console)
|
||||
{
|
||||
_console = console;
|
||||
}
|
||||
|
||||
public static Reporter Output { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||
public static Reporter Error { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||
public static Reporter Verbose { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||
|
||||
public void WriteLine(string message)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_console?.WriteLine(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteLine()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_console?.Writer?.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
public void Write(string message)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_console?.Writer?.Write(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteBanner(string content)
|
||||
{
|
||||
string border = new string('*', content.Length + 6);
|
||||
WriteLine($@"{border}
|
||||
* {content} *
|
||||
{border}".Green());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public static class StandardGoals
|
||||
{
|
||||
public static BuildSetup UseStandardGoals(this BuildSetup self)
|
||||
{
|
||||
return self.UseTargets(new[]
|
||||
{
|
||||
new BuildTarget("Default", "Standard Goals", new [] { "Prepare", "Compile", "Test", "Package", "Publish" }),
|
||||
new BuildTarget("Prepare", "Standard Goals"),
|
||||
new BuildTarget("Compile", "Standard Goals"),
|
||||
new BuildTarget("Test", "Standard Goals"),
|
||||
new BuildTarget("Package", "Standard Goals"),
|
||||
new BuildTarget("Publish", "Standard Goals")
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
public class TargetAttribute : Attribute
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public IEnumerable<string> Dependencies { get; }
|
||||
|
||||
public TargetAttribute()
|
||||
{
|
||||
Dependencies = Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
// Attributes can only use constants, so a comma-separated string is better :)
|
||||
public TargetAttribute(params string[] dependencies)
|
||||
{
|
||||
Dependencies = dependencies;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
public class BuildArchitecturesAttribute : TargetConditionAttribute
|
||||
{
|
||||
private IEnumerable<BuildArchitecture> _buildArchitectures;
|
||||
|
||||
public BuildArchitecturesAttribute(params BuildArchitecture[] architectures)
|
||||
{
|
||||
if (architectures == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(architectures));
|
||||
}
|
||||
|
||||
_buildArchitectures = architectures;
|
||||
}
|
||||
|
||||
public override bool EvaluateCondition()
|
||||
{
|
||||
var currentArchitecture = CurrentArchitecture.Current;
|
||||
|
||||
if (currentArchitecture == default(BuildArchitecture))
|
||||
{
|
||||
throw new Exception("Unrecognized Architecture");
|
||||
}
|
||||
|
||||
foreach (var architecture in _buildArchitectures)
|
||||
{
|
||||
if (architecture == currentArchitecture)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
public class BuildPlatformsAttribute : TargetConditionAttribute
|
||||
{
|
||||
private IEnumerable<BuildPlatform> _buildPlatforms;
|
||||
|
||||
public BuildPlatformsAttribute(params BuildPlatform[] platforms)
|
||||
{
|
||||
if (platforms == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(platforms));
|
||||
}
|
||||
|
||||
_buildPlatforms = platforms;
|
||||
}
|
||||
|
||||
public override bool EvaluateCondition()
|
||||
{
|
||||
foreach (var platform in _buildPlatforms)
|
||||
{
|
||||
if (CurrentPlatform.IsPlatform(platform))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
|
||||
public class EnvironmentAttribute : TargetConditionAttribute
|
||||
{
|
||||
private string _envVar;
|
||||
private string[] _expectedVals;
|
||||
|
||||
public EnvironmentAttribute(string envVar, params string[] expectedVals)
|
||||
{
|
||||
if (string.IsNullOrEmpty(envVar))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(envVar));
|
||||
}
|
||||
if (expectedVals == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(expectedVals));
|
||||
}
|
||||
|
||||
_envVar = envVar;
|
||||
_expectedVals = expectedVals;
|
||||
}
|
||||
|
||||
public override bool EvaluateCondition()
|
||||
{
|
||||
var actualVal = Environment.GetEnvironmentVariable(_envVar);
|
||||
|
||||
if (_expectedVals.Any())
|
||||
{
|
||||
return _expectedVals.Any(ev => string.Equals(actualVal, ev, StringComparison.Ordinal));
|
||||
}
|
||||
else
|
||||
{
|
||||
return !string.IsNullOrEmpty(actualVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public abstract class TargetConditionAttribute : Attribute
|
||||
{
|
||||
public abstract bool EvaluateCondition();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
public class UndefinedTargetException : Exception
|
||||
{
|
||||
public UndefinedTargetException(string message) : base(message) { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"allowUnsafe": true,
|
||||
"compile": [
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/RuntimeEnvironment.cs",
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/Platform.cs",
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/Native/*.cs"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.5.0-rc2-24027",
|
||||
"System.Diagnostics.Process": "4.1.0-rc2-24027",
|
||||
"System.Reflection.TypeExtensions": "4.1.0-rc2-24027"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.3": {
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,304 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
using static Microsoft.DotNet.Cli.Build.FS;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class CompileTargets
|
||||
{
|
||||
public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86;
|
||||
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
||||
|
||||
public static string HostPackagePlatformRid => HostPackageSupportedRids[
|
||||
(RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
|
||||
? $"win7-{RuntimeEnvironment.RuntimeArchitecture}"
|
||||
: RuntimeEnvironment.GetRuntimeIdentifier()];
|
||||
|
||||
public static readonly Dictionary<string, string> HostPackageSupportedRids = new Dictionary<string, string>()
|
||||
{
|
||||
// Key: Current platform RID. Value: The actual publishable (non-dummy) package name produced by the build system for this RID.
|
||||
{ "win7-x64", "win7-x64" },
|
||||
{ "win7-x86", "win7-x86" },
|
||||
{ "osx.10.10-x64", "osx.10.10-x64" },
|
||||
{ "osx.10.11-x64", "osx.10.10-x64" },
|
||||
{ "ubuntu.14.04-x64", "ubuntu.14.04-x64" },
|
||||
{ "centos.7-x64", "rhel.7-x64" },
|
||||
{ "rhel.7-x64", "rhel.7-x64" },
|
||||
{ "rhel.7.2-x64", "rhel.7-x64" },
|
||||
{ "debian.8-x64", "debian.8-x64" }
|
||||
};
|
||||
|
||||
[Target(nameof(PrepareTargets.Init),
|
||||
nameof(CompileCoreHost),
|
||||
nameof(PackagePkgProjects),
|
||||
nameof(RestoreLockedCoreHost),
|
||||
nameof(PublishSharedFrameworkAndSharedHost))]
|
||||
public static BuildTargetResult Compile(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
// We need to generate stub host packages so we can restore our standalone test assets against the metapackage
|
||||
// we built earlier in the build
|
||||
// https://github.com/dotnet/cli/issues/2438
|
||||
[Target]
|
||||
public static BuildTargetResult GenerateStubHostPackages(BuildTargetContext c)
|
||||
{
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
|
||||
var currentRid = HostPackagePlatformRid;
|
||||
|
||||
var stubPackageBuilder = new StubPackageBuilder(DotNetCli.Stage0, Dirs.Intermediate, Dirs.CorehostDummyPackages);
|
||||
|
||||
foreach (var hostPackage in hostVersion.LatestHostPackages)
|
||||
{
|
||||
foreach (var rid in HostPackageSupportedRids.Values.Distinct())
|
||||
{
|
||||
if (!rid.Equals(currentRid))
|
||||
{
|
||||
var basePackageId = hostPackage.Key;
|
||||
var packageVersion = hostPackage.Value;
|
||||
|
||||
var packageId = $"runtime.{rid}.{basePackageId}";
|
||||
|
||||
stubPackageBuilder.GeneratePackage(packageId, packageVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult CompileCoreHost(BuildTargetContext c)
|
||||
{
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
|
||||
|
||||
// Generate build files
|
||||
var cmakeOut = Path.Combine(Dirs.CorehostLatest, "cmake");
|
||||
|
||||
Rmdir(cmakeOut);
|
||||
Mkdirp(cmakeOut);
|
||||
|
||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||
|
||||
// Run the build
|
||||
string rid = DotNetCli.Stage0.GetRuntimeId();
|
||||
string corehostSrcDir = Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost");
|
||||
string commitHash = c.BuildContext.Get<string>("CommitHash");
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
// Why does Windows directly call cmake but Linux/Mac calls "build.sh" in the corehost dir?
|
||||
// See the comment in "src/corehost/build.sh" for details. It doesn't work for some reason.
|
||||
var visualStudio = IsWinx86 ? "Visual Studio 14 2015" : "Visual Studio 14 2015 Win64";
|
||||
var archMacro = IsWinx86 ? "-DCLI_CMAKE_PLATFORM_ARCH_I386=1" : "-DCLI_CMAKE_PLATFORM_ARCH_AMD64=1";
|
||||
var ridMacro = $"-DCLI_CMAKE_RUNTIME_ID:STRING={rid}";
|
||||
var arch = IsWinx86 ? "x86" : "x64";
|
||||
var baseSupportedRid = $"win7-{arch}";
|
||||
var cmakeHostVer = $"-DCLI_CMAKE_HOST_VER:STRING={hostVersion.LatestHostVersion}";
|
||||
var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={hostVersion.LatestHostPolicyVersion}";
|
||||
var cmakeHostFxrVer = $"-DCLI_CMAKE_HOST_FXR_VER:STRING={hostVersion.LatestHostFxrVersion}";
|
||||
var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}";
|
||||
var cmakeCommitHash = $"-DCLI_CMAKE_COMMIT_HASH:STRING={commitHash}";
|
||||
|
||||
ExecIn(cmakeOut, "cmake",
|
||||
corehostSrcDir,
|
||||
archMacro,
|
||||
ridMacro,
|
||||
cmakeHostVer,
|
||||
cmakeHostFxrVer,
|
||||
cmakeHostPolicyVer,
|
||||
cmakeBaseRid,
|
||||
cmakeCommitHash,
|
||||
"-G",
|
||||
visualStudio);
|
||||
|
||||
var pf32 = RuntimeInformation.OSArchitecture == Architecture.X64 ?
|
||||
Environment.GetEnvironmentVariable("ProgramFiles(x86)") :
|
||||
Environment.GetEnvironmentVariable("ProgramFiles");
|
||||
|
||||
if (configuration.Equals("Release"))
|
||||
{
|
||||
// Cmake calls it "RelWithDebInfo" in the generated MSBuild
|
||||
configuration = "RelWithDebInfo";
|
||||
}
|
||||
|
||||
Exec(Path.Combine(pf32, "MSBuild", "14.0", "Bin", "MSBuild.exe"),
|
||||
Path.Combine(cmakeOut, "ALL_BUILD.vcxproj"),
|
||||
$"/p:Configuration={configuration}");
|
||||
|
||||
// Copy the output out
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.exe"), Path.Combine(Dirs.CorehostLatest, "dotnet.exe"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.pdb"), Path.Combine(Dirs.CorehostLatest, "dotnet.pdb"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.dll"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.dll"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.pdb"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.pdb"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.dll"), Path.Combine(Dirs.CorehostLatest, "hostfxr.dll"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.pdb"), Path.Combine(Dirs.CorehostLatest, "hostfxr.pdb"), overwrite: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecIn(cmakeOut, Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost", "build.sh"),
|
||||
"--arch",
|
||||
"x64",
|
||||
"--hostver",
|
||||
hostVersion.LatestHostVersion,
|
||||
"--fxrver",
|
||||
hostVersion.LatestHostFxrVersion,
|
||||
"--policyver",
|
||||
hostVersion.LatestHostPolicyVersion,
|
||||
"--rid",
|
||||
rid,
|
||||
"--commithash",
|
||||
commitHash);
|
||||
|
||||
// Copy the output out
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "dotnet"), Path.Combine(Dirs.CorehostLatest, "dotnet"), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "dll", HostArtifactNames.HostPolicyBaseName), Path.Combine(Dirs.CorehostLatest, HostArtifactNames.HostPolicyBaseName), overwrite: true);
|
||||
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", HostArtifactNames.DotnetHostFxrBaseName), Path.Combine(Dirs.CorehostLatest, HostArtifactNames.DotnetHostFxrBaseName), overwrite: true);
|
||||
}
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(CompileTargets.GenerateStubHostPackages))]
|
||||
public static BuildTargetResult PackagePkgProjects(BuildTargetContext c)
|
||||
{
|
||||
var arch = IsWinx86 ? "x86" : "x64";
|
||||
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
|
||||
var hostNugetversion = hostVersion.LatestHostVersion;
|
||||
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{hostNugetversion}{Environment.NewLine}";
|
||||
var pkgDir = Path.Combine(c.BuildContext.BuildDirectory, "pkg");
|
||||
File.WriteAllText(Path.Combine(pkgDir, "version.txt"), content);
|
||||
|
||||
if (CurrentPlatform.IsWindows)
|
||||
{
|
||||
Command.Create(Path.Combine(pkgDir, "pack.cmd"))
|
||||
// Workaround to arg escaping adding backslashes for arguments to .cmd scripts.
|
||||
.Environment("__WorkaroundCliCoreHostBuildArch", arch)
|
||||
.Environment("__WorkaroundCliCoreHostBinDir", Dirs.CorehostLatest)
|
||||
.Environment("__WorkaroundCliCoreHostPolicyVer", hostVersion.LatestHostPolicyVersionNoSuffix)
|
||||
.Environment("__WorkaroundCliCoreHostFxrVer", hostVersion.LatestHostFxrVersionNoSuffix)
|
||||
.Environment("__WorkaroundCliCoreHostVer", hostVersion.LatestHostVersionNoSuffix)
|
||||
.Environment("__WorkaroundCliCoreHostBuildMajor", hostVersion.LatestHostBuildMajor)
|
||||
.Environment("__WorkaroundCliCoreHostBuildMinor", hostVersion.LatestHostBuildMinor)
|
||||
.Environment("__WorkaroundCliCoreHostVersionTag", hostVersion.LatestHostPrerelease)
|
||||
.ForwardStdOut()
|
||||
.ForwardStdErr()
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
else
|
||||
{
|
||||
Exec(Path.Combine(pkgDir, "pack.sh"),
|
||||
"--arch",
|
||||
"x64",
|
||||
"--hostbindir",
|
||||
Dirs.CorehostLatest,
|
||||
"--policyver",
|
||||
hostVersion.LatestHostPolicyVersionNoSuffix,
|
||||
"--fxrver",
|
||||
hostVersion.LatestHostFxrVersionNoSuffix,
|
||||
"--hostver",
|
||||
hostVersion.LatestHostVersionNoSuffix,
|
||||
"--build-major",
|
||||
hostVersion.LatestHostBuildMajor,
|
||||
"--build-minor",
|
||||
hostVersion.LatestHostBuildMinor,
|
||||
"--vertag",
|
||||
hostVersion.LatestHostPrerelease);
|
||||
}
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(pkgDir, "bin", "packages"), "*.nupkg"))
|
||||
{
|
||||
var fileName = Path.GetFileName(file);
|
||||
File.Copy(file, Path.Combine(Dirs.CorehostLocalPackages, fileName), true);
|
||||
|
||||
Console.WriteLine($"Copying package {fileName} to artifacts directory {Dirs.CorehostLocalPackages}.");
|
||||
}
|
||||
foreach (var item in hostVersion.LatestHostPackages)
|
||||
{
|
||||
var fileFilter = $"runtime.{HostPackagePlatformRid}.{item.Key}.{item.Value}.nupkg";
|
||||
if (Directory.GetFiles(Dirs.CorehostLocalPackages, fileFilter).Length == 0)
|
||||
{
|
||||
throw new BuildFailureException($"Nupkg for {fileFilter} was not created.");
|
||||
}
|
||||
}
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PrepareTargets.Init))]
|
||||
public static BuildTargetResult RestoreLockedCoreHost(BuildTargetContext c)
|
||||
{
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
|
||||
var lockedHostFxrVersion = hostVersion.LockedHostFxrVersion;
|
||||
|
||||
var currentRid = HostPackagePlatformRid;
|
||||
|
||||
string projectJson = $@"{{
|
||||
""dependencies"": {{
|
||||
""Microsoft.NETCore.DotNetHostResolver"" : ""{lockedHostFxrVersion}""
|
||||
}},
|
||||
""frameworks"": {{
|
||||
""netcoreapp1.0"": {{}}
|
||||
}},
|
||||
""runtimes"": {{
|
||||
""{currentRid}"": {{}}
|
||||
}}
|
||||
}}";
|
||||
var tempPjDirectory = Path.Combine(Dirs.Intermediate, "lockedHostTemp");
|
||||
FS.Rmdir(tempPjDirectory);
|
||||
Directory.CreateDirectory(tempPjDirectory);
|
||||
var tempPjFile = Path.Combine(tempPjDirectory, "project.json");
|
||||
File.WriteAllText(tempPjFile, projectJson);
|
||||
|
||||
DotNetCli.Stage0.Restore("--verbosity", "verbose",
|
||||
"--fallbacksource", Dirs.CorehostLocalPackages,
|
||||
"--fallbacksource", Dirs.CorehostDummyPackages)
|
||||
.WorkingDirectory(tempPjDirectory)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
// Clean out before publishing locked binaries
|
||||
FS.Rmdir(Dirs.CorehostLocked);
|
||||
|
||||
// Use specific RIDS for non-backward compatible platforms.
|
||||
(CurrentPlatform.IsWindows
|
||||
? DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build")
|
||||
: DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build", "-r", currentRid))
|
||||
.WorkingDirectory(tempPjDirectory)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult PublishSharedFrameworkAndSharedHost(BuildTargetContext c)
|
||||
{
|
||||
var outputDir = Dirs.SharedFrameworkPublish;
|
||||
var dotnetCli = DotNetCli.Stage0;
|
||||
var sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var commitHash = c.BuildContext.Get<string>("CommitHash");
|
||||
|
||||
var sharedFrameworkPublisher = new SharedFrameworkPublisher(
|
||||
Dirs.RepoRoot,
|
||||
Dirs.CorehostLocked,
|
||||
Dirs.CorehostLatest,
|
||||
Dirs.CorehostLocalPackages,
|
||||
sharedFrameworkNugetVersion);
|
||||
|
||||
sharedFrameworkPublisher.PublishSharedFramework(outputDir, commitHash, dotnetCli);
|
||||
sharedFrameworkPublisher.CopySharedHostArtifacts(outputDir);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class DebTargets
|
||||
{
|
||||
[Target(nameof(GenerateSharedHostDeb),
|
||||
nameof(GenerateSharedFrameworkDeb))]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult GenerateDebs(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c)
|
||||
{
|
||||
var packageName = Monikers.GetDebianSharedHostPackageName(c);
|
||||
var version = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
|
||||
var inputRoot = c.BuildContext.Get<string>("SharedHostPublishRoot");
|
||||
var debFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
|
||||
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedhost");
|
||||
var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
|
||||
|
||||
if (Directory.Exists(objRoot))
|
||||
{
|
||||
Directory.Delete(objRoot, true);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(objRoot);
|
||||
|
||||
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedhost-debian.sh"),
|
||||
"--input", inputRoot, "--output", debFile, "-b", Monikers.SharedHostBrandName,
|
||||
"--obj-root", objRoot, "--version", version, "-m", manPagesDir)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(InstallSharedHost))]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c)
|
||||
{
|
||||
var packageName = Monikers.GetDebianSharedFrameworkPackageName(c);
|
||||
var version = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var inputRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
||||
var debFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
|
||||
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedframework");
|
||||
|
||||
if (Directory.Exists(objRoot))
|
||||
{
|
||||
Directory.Delete(objRoot, true);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(objRoot);
|
||||
|
||||
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"),
|
||||
"--input", inputRoot, "--output", debFile, "--package-name", packageName, "-b", Monikers.SharedFxBrandName,
|
||||
"--framework-nuget-name", Monikers.SharedFrameworkName,
|
||||
"--framework-nuget-version", c.BuildContext.Get<string>("SharedFrameworkNugetVersion"),
|
||||
"--obj-root", objRoot, "--version", version)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(InstallSharedFramework),
|
||||
nameof(RemovePackages))]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult TestDebInstaller(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult InstallSharedHost(BuildTargetContext c)
|
||||
{
|
||||
InstallPackage(c.BuildContext.Get<string>("SharedHostInstallerFile"));
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(InstallSharedHost))]
|
||||
public static BuildTargetResult InstallSharedFramework(BuildTargetContext c)
|
||||
{
|
||||
InstallPackage(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"));
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult RemovePackages(BuildTargetContext c)
|
||||
{
|
||||
IEnumerable<string> orderedPackageNames = new List<string>()
|
||||
{
|
||||
Monikers.GetSdkDebianPackageName(c),
|
||||
Monikers.GetDebianSharedFrameworkPackageName(c),
|
||||
Monikers.GetDebianSharedHostPackageName(c)
|
||||
};
|
||||
|
||||
foreach(var packageName in orderedPackageNames)
|
||||
{
|
||||
RemovePackage(packageName);
|
||||
}
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static void InstallPackage(string packagePath)
|
||||
{
|
||||
Cmd("sudo", "dpkg", "-i", packagePath)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
|
||||
private static void RemovePackage(string packageName)
|
||||
{
|
||||
Cmd("sudo", "dpkg", "-r", packageName)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class InstallerTargets
|
||||
{
|
||||
[Target(nameof(MsiTargets.GenerateMsis),
|
||||
nameof(MsiTargets.GenerateBundles),
|
||||
nameof(PkgTargets.GeneratePkgs),
|
||||
nameof(DebTargets.GenerateDebs))]
|
||||
public static BuildTargetResult GenerateInstaller(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(DebTargets.TestDebInstaller))]
|
||||
public static BuildTargetResult TestInstaller(BuildTargetContext c)
|
||||
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net.Http;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class MsiTargets
|
||||
{
|
||||
private const string ENGINE = "engine.exe";
|
||||
|
||||
private const string WixVersion = "3.10.2";
|
||||
|
||||
private static string WixRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(Dirs.Output, $"WixTools.{WixVersion}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string SharedHostMsi { get; set; }
|
||||
|
||||
private static string SharedFrameworkMsi { get; set; }
|
||||
|
||||
private static string SharedFrameworkBundle { get; set; }
|
||||
|
||||
private static string SharedFrameworkEngine { get; set; }
|
||||
|
||||
private static string MsiVersion { get; set; }
|
||||
|
||||
private static string DisplayVersion { get; set; }
|
||||
|
||||
private static string Arch { get; } = CurrentArchitecture.Current.ToString();
|
||||
|
||||
private static void AcquireWix(BuildTargetContext c)
|
||||
{
|
||||
if (File.Exists(Path.Combine(WixRoot, "candle.exe")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(WixRoot);
|
||||
|
||||
c.Info("Downloading WixTools..");
|
||||
|
||||
DownloadFile($"https://dotnetcli.blob.core.windows.net/build/wix/wix.{WixVersion}.zip", Path.Combine(WixRoot, "WixTools.zip"));
|
||||
|
||||
c.Info("Extracting WixTools..");
|
||||
ZipFile.ExtractToDirectory(Path.Combine(WixRoot, "WixTools.zip"), WixRoot);
|
||||
}
|
||||
|
||||
private static void DownloadFile(string uri, string destinationPath)
|
||||
{
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
var getTask = httpClient.GetStreamAsync(uri);
|
||||
|
||||
using (var outStream = File.OpenWrite(destinationPath))
|
||||
{
|
||||
getTask.Result.CopyTo(outStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult InitMsi(BuildTargetContext c)
|
||||
{
|
||||
|
||||
SharedFrameworkBundle = c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile");
|
||||
SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedHostInstallerFile"), "msi");
|
||||
SharedFrameworkMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"), "msi");
|
||||
SharedFrameworkEngine = GetEngineName(SharedFrameworkBundle);
|
||||
|
||||
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
||||
MsiVersion = buildVersion.GenerateMsiVersion();
|
||||
DisplayVersion = buildVersion.SimpleVersion;
|
||||
|
||||
AcquireWix(c);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(MsiTargets.InitMsi),
|
||||
nameof(GenerateDotnetSharedHostMsi),
|
||||
nameof(GenerateDotnetSharedFrameworkMsi))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateMsis(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(MsiTargets.InitMsi),
|
||||
nameof(GenerateSharedFxBundle))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateBundles(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c)
|
||||
{
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
|
||||
var hostMsiVersion = hostVersion.GenerateMsiVersion();
|
||||
var hostNugetVersion = hostVersion.LockedHostVersion;
|
||||
var inputDir = c.BuildContext.Get<string>("SharedHostPublishRoot");
|
||||
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost");
|
||||
var sharedHostBrandName = $"'{Monikers.SharedHostBrandName}'";
|
||||
|
||||
if (Directory.Exists(wixObjRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(wixObjRoot);
|
||||
}
|
||||
Directory.CreateDirectory(wixObjRoot);
|
||||
|
||||
Cmd("powershell", "-NoProfile", "-NoLogo",
|
||||
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"),
|
||||
inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, Arch, wixObjRoot)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
|
||||
{
|
||||
var inputDir = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
||||
var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
|
||||
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var msiVerison = sharedFrameworkNuGetVersion.Split('-')[0];
|
||||
var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper();
|
||||
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
|
||||
var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
|
||||
|
||||
if (Directory.Exists(wixObjRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(wixObjRoot);
|
||||
}
|
||||
Directory.CreateDirectory(wixObjRoot);
|
||||
|
||||
Cmd("powershell", "-NoProfile", "-NoLogo",
|
||||
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"),
|
||||
inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(MsiTargets.InitMsi))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateSharedFxBundle(BuildTargetContext c)
|
||||
{
|
||||
var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
|
||||
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper();
|
||||
var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
|
||||
|
||||
Cmd("powershell", "-NoProfile", "-NoLogo",
|
||||
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"),
|
||||
SharedFrameworkMsi, SharedHostMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, DisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static string GetEngineName(string bundle)
|
||||
{
|
||||
var engine = $"{Path.GetFileNameWithoutExtension(bundle)}-{ENGINE}";
|
||||
return Path.Combine(Path.GetDirectoryName(bundle), engine);
|
||||
}
|
||||
|
||||
[Target(nameof(MsiTargets.InitMsi))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult ExtractEngineFromBundle(BuildTargetContext c)
|
||||
{
|
||||
ExtractEngineFromBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(MsiTargets.InitMsi))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult ReattachEngineToBundle(BuildTargetContext c)
|
||||
{
|
||||
ReattachEngineToBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static void ExtractEngineFromBundleHelper(string bundle, string engine)
|
||||
{
|
||||
Cmd($"{WixRoot}\\insignia.exe", "-ib", bundle, "-o", engine)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
|
||||
private static void ReattachEngineToBundleHelper(string bundle, string engine)
|
||||
{
|
||||
Cmd($"{WixRoot}\\insignia.exe", "-ab", engine, bundle, "-o", bundle)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
File.Delete(engine);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public static class PackageTargets
|
||||
{
|
||||
[Target(
|
||||
nameof(PackageTargets.CopySharedHostLayout),
|
||||
nameof(PackageTargets.CopySharedFxLayout),
|
||||
nameof(PackageTargets.CopyCombinedFrameworkHostLayout))]
|
||||
public static BuildTargetResult InitPackage(BuildTargetContext c)
|
||||
{
|
||||
Directory.CreateDirectory(Dirs.Packages);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PrepareTargets.Init),
|
||||
nameof(PackageTargets.InitPackage),
|
||||
nameof(PackageTargets.GenerateVersionBadge),
|
||||
nameof(PackageTargets.GenerateCompressedFile),
|
||||
nameof(InstallerTargets.GenerateInstaller),
|
||||
nameof(InstallerTargets.TestInstaller))]
|
||||
[Environment("DOTNET_BUILD_SKIP_PACKAGING", null, "0", "false")]
|
||||
public static BuildTargetResult Package(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult GenerateVersionBadge(BuildTargetContext c)
|
||||
{
|
||||
var sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var versionSvg = Path.Combine(Dirs.RepoRoot, "resources", "images", "version_badge.svg");
|
||||
var outputVersionSvg = c.BuildContext.Get<string>("VersionBadge");
|
||||
|
||||
var versionSvgContent = File.ReadAllText(versionSvg);
|
||||
versionSvgContent = versionSvgContent.Replace("ver_number", sharedFrameworkNugetVersion);
|
||||
File.WriteAllText(outputVersionSvg, versionSvgContent);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult CopySharedHostLayout(BuildTargetContext c)
|
||||
{
|
||||
var sharedHostRoot = Path.Combine(Dirs.Output, "obj", "sharedHost");
|
||||
if (Directory.Exists(sharedHostRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(sharedHostRoot);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(sharedHostRoot);
|
||||
|
||||
foreach (var file in Directory.GetFiles(Dirs.SharedFrameworkPublish, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
var destFile = file.Replace(Dirs.SharedFrameworkPublish, sharedHostRoot);
|
||||
File.Copy(file, destFile, true);
|
||||
c.Warn(destFile);
|
||||
}
|
||||
FixPermissions(sharedHostRoot);
|
||||
|
||||
c.BuildContext["SharedHostPublishRoot"] = sharedHostRoot;
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult CopySharedFxLayout(BuildTargetContext c)
|
||||
{
|
||||
var sharedFxRoot = Path.Combine(Dirs.Output, "obj", "sharedFx");
|
||||
if (Directory.Exists(sharedFxRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(sharedFxRoot);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(sharedFxRoot);
|
||||
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.SharedFrameworkPublish, "shared"), sharedFxRoot, true);
|
||||
FixPermissions(sharedFxRoot);
|
||||
|
||||
c.BuildContext["SharedFrameworkPublishRoot"] = sharedFxRoot;
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult CopyCombinedFrameworkHostLayout(BuildTargetContext c)
|
||||
{
|
||||
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-host");
|
||||
if (Directory.Exists(combinedRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(combinedRoot);
|
||||
}
|
||||
Directory.CreateDirectory(combinedRoot);
|
||||
|
||||
string sharedFrameworkPublishRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
||||
Utils.CopyDirectoryRecursively(sharedFrameworkPublishRoot, combinedRoot);
|
||||
|
||||
string sharedHostPublishRoot = c.BuildContext.Get<string>("SharedHostPublishRoot");
|
||||
Utils.CopyDirectoryRecursively(sharedHostPublishRoot, combinedRoot);
|
||||
|
||||
c.BuildContext["CombinedFrameworkHostRoot"] = combinedRoot;
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PackageTargets.GenerateZip), nameof(PackageTargets.GenerateTarBall))]
|
||||
public static BuildTargetResult GenerateCompressedFile(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PackageTargets.InitPackage))]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateZip(BuildTargetContext c)
|
||||
{
|
||||
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PackageTargets.InitPackage))]
|
||||
[BuildPlatforms(BuildPlatform.Unix)]
|
||||
public static BuildTargetResult GenerateTarBall(BuildTargetContext c)
|
||||
{
|
||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static void CreateZipFromDirectory(string directory, string artifactPath)
|
||||
{
|
||||
if (File.Exists(artifactPath))
|
||||
{
|
||||
File.Delete(artifactPath);
|
||||
}
|
||||
|
||||
ZipFile.CreateFromDirectory(directory, artifactPath, CompressionLevel.Optimal, false);
|
||||
}
|
||||
|
||||
private static void CreateTarBallFromDirectory(string directory, string artifactPath)
|
||||
{
|
||||
if (File.Exists(artifactPath))
|
||||
{
|
||||
File.Delete(artifactPath);
|
||||
}
|
||||
|
||||
Cmd("tar", "-czf", artifactPath, "-C", directory, ".")
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
|
||||
private static void FixPermissions(string directory)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
// Reset everything to user readable/writeable and group and world readable.
|
||||
FS.ChmodAll(directory, "*", "644");
|
||||
|
||||
// Now make things that should be executable, executable.
|
||||
FS.FixModeFlags(directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class PkgTargets
|
||||
{
|
||||
public static string PkgsIntermediateDir { get; set; }
|
||||
public static string SharedHostComponentId { get; set; }
|
||||
public static string SharedFxComponentId { get; set; }
|
||||
public static string SharedFxPkgId { get; set; }
|
||||
public static string SharedFrameworkNugetVersion { get; set; }
|
||||
public static string CLISdkComponentId { get; set; }
|
||||
public static string CLISdkPkgId { get; set; }
|
||||
public static string CLISdkNugetVersion { get; set; }
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.OSX)]
|
||||
public static BuildTargetResult InitPkg(BuildTargetContext c)
|
||||
{
|
||||
PkgsIntermediateDir = Path.Combine(Dirs.Packages, "intermediate");
|
||||
Directory.CreateDirectory(PkgsIntermediateDir);
|
||||
|
||||
SharedHostComponentId = $"com.microsoft.dotnet.sharedhost.component.osx.x64";
|
||||
|
||||
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
|
||||
SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
SharedFxComponentId = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64";
|
||||
SharedFxPkgId = $"com.microsoft.dotnet.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.osx.x64";
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(InitPkg), nameof(GenerateSharedFrameworkProductArchive))]
|
||||
[BuildPlatforms(BuildPlatform.OSX)]
|
||||
public static BuildTargetResult GeneratePkgs(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(GenerateSharedFrameworkPkg), nameof(GenerateSharedHostPkg))]
|
||||
[BuildPlatforms(BuildPlatform.OSX)]
|
||||
public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c)
|
||||
{
|
||||
string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "resources");
|
||||
string outFilePath = Path.Combine(PkgsIntermediateDir, c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile"));
|
||||
|
||||
string inputDistTemplatePath = Path.Combine(
|
||||
Dirs.RepoRoot,
|
||||
"packaging",
|
||||
"osx",
|
||||
"sharedframework",
|
||||
"shared-framework-distribution-template.xml");
|
||||
string distTemplate = File.ReadAllText(inputDistTemplatePath);
|
||||
string distributionPath = Path.Combine(PkgsIntermediateDir, "shared-framework-formatted-distribution.xml");
|
||||
string formattedDistContents =
|
||||
distTemplate.Replace("{SharedFxComponentId}", SharedFxComponentId)
|
||||
.Replace("{SharedHostComponentId}", SharedHostComponentId)
|
||||
.Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
|
||||
.Replace("{SharedFrameworkNugetVersion}", SharedFrameworkNugetVersion)
|
||||
.Replace("{SharedFxBrandName}", Monikers.SharedFxBrandName)
|
||||
.Replace("{SharedHostBrandName}", Monikers.SharedHostBrandName);
|
||||
File.WriteAllText(distributionPath, formattedDistContents);
|
||||
|
||||
Cmd("productbuild",
|
||||
"--version", SharedFrameworkNugetVersion,
|
||||
"--identifier", SharedFxPkgId,
|
||||
"--package-path", PkgsIntermediateDir,
|
||||
"--resources", resourcePath,
|
||||
"--distribution", distributionPath,
|
||||
outFilePath)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.OSX)]
|
||||
public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c)
|
||||
{
|
||||
string outFilePath = Path.Combine(PkgsIntermediateDir, SharedFxComponentId + ".pkg");
|
||||
string installLocation = "/usr/local/share/dotnet";
|
||||
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "scripts");
|
||||
|
||||
Cmd("pkgbuild",
|
||||
"--root", c.BuildContext.Get<string>("SharedFrameworkPublishRoot"),
|
||||
"--identifier", SharedFxComponentId,
|
||||
"--version", SharedFrameworkNugetVersion,
|
||||
"--install-location", installLocation,
|
||||
"--scripts", scriptsLocation,
|
||||
outFilePath)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.OSX)]
|
||||
public static BuildTargetResult GenerateSharedHostPkg(BuildTargetContext c)
|
||||
{
|
||||
string version = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
|
||||
string outFilePath = Path.Combine(PkgsIntermediateDir, SharedHostComponentId + ".pkg");
|
||||
string installLocation = "/usr/local/share/dotnet";
|
||||
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedhost", "scripts");
|
||||
|
||||
Cmd("pkgbuild",
|
||||
"--root", c.BuildContext.Get<string>("SharedHostPublishRoot"),
|
||||
"--identifier", SharedHostComponentId,
|
||||
"--version", version,
|
||||
"--install-location", installLocation,
|
||||
"--scripts", scriptsLocation,
|
||||
outFilePath)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
using static Microsoft.DotNet.Cli.Build.FS;
|
||||
using static Microsoft.DotNet.Cli.Build.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class PrepareTargets
|
||||
{
|
||||
[Target(nameof(Init))]
|
||||
public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))]
|
||||
public static BuildTargetResult CheckPrereqs(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(CheckCoreclrPlatformDependencies))]
|
||||
public static BuildTargetResult CheckPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))]
|
||||
public static BuildTargetResult CheckCoreclrPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||
|
||||
// All major targets will depend on this in order to ensure variables are set up right if they are run independently
|
||||
[Target(
|
||||
nameof(GenerateVersions),
|
||||
nameof(CheckPrereqs),
|
||||
nameof(LocateStage0),
|
||||
nameof(ExpectedBuildArtifacts),
|
||||
nameof(RestorePackages))]
|
||||
public static BuildTargetResult Init(BuildTargetContext c)
|
||||
{
|
||||
var configEnv = Environment.GetEnvironmentVariable("CONFIGURATION");
|
||||
|
||||
if (string.IsNullOrEmpty(configEnv))
|
||||
{
|
||||
configEnv = "Debug";
|
||||
}
|
||||
|
||||
c.BuildContext["Configuration"] = configEnv;
|
||||
c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL");
|
||||
|
||||
c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
|
||||
c.Info("Build Environment:");
|
||||
c.Info($" Operating System: {RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}");
|
||||
c.Info($" Platform: {RuntimeEnvironment.OperatingSystemPlatform}");
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult GenerateVersions(BuildTargetContext c)
|
||||
{
|
||||
var gitResult = Cmd("git", "rev-list", "--count", "HEAD")
|
||||
.CaptureStdOut()
|
||||
.Execute();
|
||||
gitResult.EnsureSuccessful();
|
||||
var commitCount = int.Parse(gitResult.StdOut);
|
||||
|
||||
gitResult = Cmd("git", "rev-parse", "HEAD")
|
||||
.CaptureStdOut()
|
||||
.Execute();
|
||||
gitResult.EnsureSuccessful();
|
||||
var commitHash = gitResult.StdOut.Trim();
|
||||
|
||||
var hostVersion = new HostVersion()
|
||||
{
|
||||
CommitCount = commitCount
|
||||
};
|
||||
|
||||
var branchInfo = new BranchInfo(Dirs.RepoRoot);
|
||||
var buildVersion = new BuildVersion()
|
||||
{
|
||||
Major = int.Parse(branchInfo.Entries["MAJOR_VERSION"]),
|
||||
Minor = int.Parse(branchInfo.Entries["MINOR_VERSION"]),
|
||||
Patch = int.Parse(branchInfo.Entries["PATCH_VERSION"]),
|
||||
ReleaseSuffix = branchInfo.Entries["RELEASE_SUFFIX"],
|
||||
CommitCount = commitCount
|
||||
};
|
||||
|
||||
c.BuildContext["BuildVersion"] = buildVersion;
|
||||
c.BuildContext["HostVersion"] = hostVersion;
|
||||
c.BuildContext["CommitHash"] = commitHash;
|
||||
c.BuildContext["SharedFrameworkNugetVersion"] = buildVersion.NetCoreAppVersion;
|
||||
|
||||
|
||||
c.Info($"Building Version: {hostVersion.LatestHostVersionNoSuffix} (NuGet Packages: {hostVersion.LatestHostVersion})");
|
||||
c.Info($"From Commit: {commitHash}");
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult LocateStage0(BuildTargetContext c)
|
||||
{
|
||||
// We should have been run in the repo root, so locate the stage 0 relative to current directory
|
||||
var stage0 = DotNetCli.Stage0.BinPath;
|
||||
|
||||
if (!Directory.Exists(stage0))
|
||||
{
|
||||
return c.Failed($"Stage 0 directory does not exist: {stage0}");
|
||||
}
|
||||
|
||||
// Identify the version
|
||||
string versionFile = Directory.GetFiles(stage0, ".version", SearchOption.AllDirectories).FirstOrDefault();
|
||||
|
||||
if (string.IsNullOrEmpty(versionFile))
|
||||
{
|
||||
throw new Exception($"'.version' file not found in '{stage0}' folder");
|
||||
}
|
||||
|
||||
var version = File.ReadAllLines(versionFile);
|
||||
c.Info($"Using Stage 0 Version: {version[1]}");
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult ExpectedBuildArtifacts(BuildTargetContext c)
|
||||
{
|
||||
var config = Environment.GetEnvironmentVariable("CONFIGURATION");
|
||||
var versionBadgeName = $"sharedfx_{CurrentPlatform.Current}_{CurrentArchitecture.Current}_{config}_version_badge.svg";
|
||||
c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);
|
||||
|
||||
var sharedFrameworkVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
|
||||
|
||||
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
|
||||
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
|
||||
AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static void AddInstallerArtifactToContext(
|
||||
BuildTargetContext c,
|
||||
string artifactPrefix,
|
||||
string contextPrefix,
|
||||
string version)
|
||||
{
|
||||
var productName = Monikers.GetProductMoniker(c, artifactPrefix, version);
|
||||
|
||||
var extension = CurrentPlatform.IsWindows ? ".zip" : ".tar.gz";
|
||||
c.BuildContext[contextPrefix + "CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension);
|
||||
|
||||
string installer = "";
|
||||
switch (CurrentPlatform.Current)
|
||||
{
|
||||
case BuildPlatform.Windows:
|
||||
installer = productName + ".exe";
|
||||
break;
|
||||
case BuildPlatform.OSX:
|
||||
installer = productName + ".pkg";
|
||||
break;
|
||||
case BuildPlatform.Ubuntu:
|
||||
installer = productName + ".deb";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(installer))
|
||||
{
|
||||
c.BuildContext[contextPrefix + "InstallerFile"] = Path.Combine(Dirs.Packages, installer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult CheckUbuntuCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||
{
|
||||
var errorMessageBuilder = new StringBuilder();
|
||||
var stage0 = DotNetCli.Stage0.BinPath;
|
||||
|
||||
foreach (var package in PackageDependencies.UbuntuCoreclrAndCoreFxDependencies)
|
||||
{
|
||||
if (!AptDependencyUtility.PackageIsInstalled(package))
|
||||
{
|
||||
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
errorMessageBuilder.Append($"-> install with apt-get install {package}");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessageBuilder.Length == 0)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return c.Failed(errorMessageBuilder.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.CentOS)]
|
||||
public static BuildTargetResult CheckCentOSCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||
{
|
||||
var errorMessageBuilder = new StringBuilder();
|
||||
|
||||
foreach (var package in PackageDependencies.CentosCoreclrAndCoreFxDependencies)
|
||||
{
|
||||
if (!YumDependencyUtility.PackageIsInstalled(package))
|
||||
{
|
||||
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
errorMessageBuilder.Append($"-> install with yum install {package}");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessageBuilder.Length == 0)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return c.Failed(errorMessageBuilder.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult RestorePackages(BuildTargetContext c)
|
||||
{
|
||||
var dotnet = DotNetCli.Stage0;
|
||||
|
||||
dotnet.Restore("--verbosity", "verbose", "--disable-parallel")
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "tools", "independent", "RuntimeGraphGenerator"))
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult CheckPrereqCmakePresent(BuildTargetContext c)
|
||||
{
|
||||
try
|
||||
{
|
||||
Command.Create("cmake", "--version")
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.Execute();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string message = $@"Error running cmake: {ex.Message}
|
||||
cmake is required to build the native host 'corehost'";
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
message += Environment.NewLine + "Download it from https://www.cmake.org";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
message += Environment.NewLine + "Ubuntu: 'sudo apt-get install cmake'";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
message += Environment.NewLine + "OS X w/Homebrew: 'brew install cmake'";
|
||||
}
|
||||
return c.Failed(message);
|
||||
}
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
return BuildSetup.Create(".NET Core Host")
|
||||
.UseStandardGoals()
|
||||
.UseAllTargetsFromAssembly<Program>()
|
||||
.Run(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public static class PublishTargets
|
||||
{
|
||||
private static AzurePublisher AzurePublisherTool { get; set; }
|
||||
|
||||
private static DebRepoPublisher DebRepoPublisherTool { get; set; }
|
||||
|
||||
private static string Channel { get; set; }
|
||||
|
||||
private static string SharedFrameworkNugetVersion { get; set; }
|
||||
|
||||
private static string SharedHostNugetVersion { get; set; }
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult InitPublish(BuildTargetContext c)
|
||||
{
|
||||
AzurePublisherTool = new AzurePublisher();
|
||||
DebRepoPublisherTool = new DebRepoPublisher(Dirs.Packages);
|
||||
SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
SharedHostNugetVersion = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
|
||||
Channel = c.BuildContext.Get<string>("Channel");
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(PrepareTargets.Init),
|
||||
nameof(PublishTargets.InitPublish),
|
||||
nameof(PublishTargets.PublishArtifacts))]
|
||||
[Environment("PUBLISH_TO_AZURE_BLOB", "1", "true")] // This is set by CI systems
|
||||
public static BuildTargetResult Publish(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(
|
||||
nameof(PublishTargets.PublishInstallerFilesToAzure),
|
||||
nameof(PublishTargets.PublishArchivesToAzure),
|
||||
/*nameof(PublishTargets.PublishDebFilesToDebianRepo),*/ //https://github.com/dotnet/cli/issues/2973
|
||||
nameof(PublishTargets.PublishCoreHostPackages),
|
||||
nameof(PublishTargets.PublishSharedFrameworkVersionBadge))]
|
||||
public static BuildTargetResult PublishArtifacts(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(
|
||||
nameof(PublishTargets.PublishSharedHostInstallerFileToAzure),
|
||||
nameof(PublishTargets.PublishSharedFrameworkInstallerFileToAzure),
|
||||
nameof(PublishTargets.PublishCombinedFrameworkHostInstallerFileToAzure))]
|
||||
public static BuildTargetResult PublishInstallerFilesToAzure(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(PublishTargets.PublishCombinedHostFrameworkArchiveToAzure))]
|
||||
public static BuildTargetResult PublishArchivesToAzure(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(
|
||||
nameof(PublishSharedFrameworkDebToDebianRepo),
|
||||
nameof(PublishSharedHostDebToDebianRepo))]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult PublishDebFilesToDebianRepo(BuildTargetContext c)
|
||||
{
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult PublishSharedFrameworkVersionBadge(BuildTargetContext c)
|
||||
{
|
||||
var versionBadge = c.BuildContext.Get<string>("VersionBadge");
|
||||
var versionBadgeBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}/{Path.GetFileName(versionBadge)}";
|
||||
AzurePublisherTool.PublishFile(versionBadgeBlob, versionBadge);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult PublishCoreHostPackages(BuildTargetContext c)
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(Dirs.CorehostLocalPackages, "*.nupkg"))
|
||||
{
|
||||
var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}/{Path.GetFileName(file)}";
|
||||
AzurePublisherTool.PublishFile(hostBlob, file);
|
||||
Console.WriteLine($"Publishing package {hostBlob} to Azure.");
|
||||
}
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu, BuildPlatform.Windows)]
|
||||
public static BuildTargetResult PublishSharedHostInstallerFileToAzure(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedHostNugetVersion;
|
||||
var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
|
||||
|
||||
if (CurrentPlatform.Current == BuildPlatform.Windows)
|
||||
{
|
||||
installerFile = Path.ChangeExtension(installerFile, "msi");
|
||||
}
|
||||
|
||||
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult PublishSharedFrameworkInstallerFileToAzure(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedFrameworkNugetVersion;
|
||||
var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
|
||||
|
||||
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]
|
||||
public static BuildTargetResult PublishCombinedFrameworkHostInstallerFileToAzure(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedFrameworkNugetVersion;
|
||||
var installerFile = c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile");
|
||||
|
||||
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult PublishCombinedHostFrameworkArchiveToAzure(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedFrameworkNugetVersion;
|
||||
var archiveFile = c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile");
|
||||
|
||||
AzurePublisherTool.PublishArchive(archiveFile, Channel, version);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult PublishSharedFrameworkDebToDebianRepo(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedFrameworkNugetVersion;
|
||||
|
||||
var packageName = Monikers.GetDebianSharedFrameworkPackageName(c);
|
||||
var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
|
||||
var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version);
|
||||
|
||||
DebRepoPublisherTool.PublishDebFileToDebianRepo(
|
||||
packageName,
|
||||
version,
|
||||
uploadUrl);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult PublishSharedHostDebToDebianRepo(BuildTargetContext c)
|
||||
{
|
||||
var version = SharedHostNugetVersion;
|
||||
|
||||
var packageName = Monikers.GetDebianSharedHostPackageName(c);
|
||||
var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
|
||||
var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version);
|
||||
|
||||
DebRepoPublisherTool.PublishDebFileToDebianRepo(
|
||||
packageName,
|
||||
version,
|
||||
uploadUrl);
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Build;
|
||||
|
||||
namespace Microsoft.DotNet.Host.Build
|
||||
{
|
||||
public class StubPackageBuilder
|
||||
{
|
||||
private DotNetCli _dotnet;
|
||||
private string _intermediateDirectory;
|
||||
private string _outputDirectory;
|
||||
|
||||
private bool _dummyFileCreated;
|
||||
|
||||
public StubPackageBuilder(DotNetCli dotnet, string intermediateDirectory, string outputDirectory)
|
||||
{
|
||||
_dotnet = dotnet;
|
||||
_intermediateDirectory = intermediateDirectory;
|
||||
_outputDirectory = outputDirectory;
|
||||
}
|
||||
|
||||
public void GeneratePackage(string packageId, string version)
|
||||
{
|
||||
if (!_dummyFileCreated)
|
||||
{
|
||||
CreateDummyFile(_dotnet, _intermediateDirectory);
|
||||
}
|
||||
|
||||
CreateStubPackage(_dotnet, packageId, version, _intermediateDirectory, _outputDirectory);
|
||||
}
|
||||
|
||||
private void CreateDummyFile(DotNetCli dotnet, string intermediateDirectory)
|
||||
{
|
||||
var dummyTxt = "dummy text";
|
||||
|
||||
var tempPjDirectory = Path.Combine(intermediateDirectory, "dummyNuGetPackageIntermediate");
|
||||
FS.Rmdir(tempPjDirectory);
|
||||
|
||||
Directory.CreateDirectory(tempPjDirectory);
|
||||
|
||||
var dummyTextFile = Path.Combine(tempPjDirectory, "dummy.txt");
|
||||
|
||||
File.WriteAllText(dummyTextFile, dummyTxt);
|
||||
|
||||
_dummyFileCreated = true;
|
||||
}
|
||||
|
||||
private static void CreateStubPackage(DotNetCli dotnet,
|
||||
string packageId,
|
||||
string version,
|
||||
string intermediateDirectory,
|
||||
string outputDirectory)
|
||||
{
|
||||
var projectJson = new StringBuilder();
|
||||
projectJson.Append("{");
|
||||
projectJson.Append($" \"version\": \"{version}\",");
|
||||
projectJson.Append($" \"name\": \"{packageId}\",");
|
||||
projectJson.Append(" \"packOptions\": { \"files\": { \"include\": \"dummy.txt\" } },");
|
||||
projectJson.Append(" \"frameworks\": { \"netcoreapp1.0\": { } },");
|
||||
projectJson.Append("}");
|
||||
|
||||
var tempPjDirectory = Path.Combine(intermediateDirectory, "dummyNuGetPackageIntermediate");
|
||||
var tempPjFile = Path.Combine(tempPjDirectory, "project.json");
|
||||
|
||||
File.WriteAllText(tempPjFile, projectJson.ToString());
|
||||
|
||||
dotnet.Pack(
|
||||
tempPjFile, "--no-build",
|
||||
"--output", outputDirectory)
|
||||
.WorkingDirectory(tempPjDirectory)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
param(
|
||||
[string]$Configuration="Debug",
|
||||
[string]$Architecture="x64",
|
||||
[string[]]$Targets=@("Default"),
|
||||
[switch]$NoPackage,
|
||||
[switch]$Help)
|
||||
|
||||
if($Help)
|
||||
{
|
||||
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] [-Targets <TARGETS...>]"
|
||||
Write-Host ""
|
||||
Write-Host "Options:"
|
||||
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
|
||||
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
||||
Write-Host " -NoPackage Skip packaging targets"
|
||||
Write-Host " -Help Display this help message"
|
||||
exit 0
|
||||
}
|
||||
|
||||
$env:CONFIGURATION = $Configuration;
|
||||
$RepoRoot = "$PSScriptRoot\..\.."
|
||||
|
||||
if($NoPackage)
|
||||
{
|
||||
$env:DOTNET_BUILD_SKIP_PACKAGING=1
|
||||
}
|
||||
else
|
||||
{
|
||||
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
||||
}
|
||||
|
||||
# Load Branch Info
|
||||
cat "$RepoRoot\branchinfo.txt" | ForEach-Object {
|
||||
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
|
||||
$splat = $_.Split([char[]]@("="), 2)
|
||||
Set-Content "env:\$($splat[0])" -Value $splat[1]
|
||||
}
|
||||
}
|
||||
|
||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||
if (!$env:DOTNET_INSTALL_DIR)
|
||||
{
|
||||
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\Windows\$Architecture"
|
||||
}
|
||||
|
||||
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
||||
{
|
||||
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
|
||||
}
|
||||
|
||||
# Install a stage 0
|
||||
Write-Host "Installing .NET Core CLI Stage 0 from branchinfo channel"
|
||||
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel $env:CHANNEL -Architecture $Architecture -Verbose
|
||||
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
||||
|
||||
# Put the stage0 on the path
|
||||
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
||||
|
||||
# Restore the build scripts
|
||||
Write-Host "Restoring Build Script projects..."
|
||||
pushd "$PSScriptRoot\.."
|
||||
dotnet restore --infer-runtimes
|
||||
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
|
||||
popd
|
||||
|
||||
# Publish the builder
|
||||
Write-Host "Compiling Build Scripts..."
|
||||
dotnet publish "$PSScriptRoot" -o "$PSScriptRoot\bin" --framework netcoreapp1.0
|
||||
if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
|
||||
|
||||
# Run the builder
|
||||
Write-Host "Invoking Build Scripts..."
|
||||
Write-Host " Configuration: $env:CONFIGURATION"
|
||||
& "$PSScriptRoot\bin\dotnet-host-build.exe" @Targets
|
||||
if($LASTEXITCODE -ne 0) { throw "Build failed" }
|
|
@ -0,0 +1,118 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
OLDPATH="$PATH"
|
||||
|
||||
REPOROOT="$DIR/../.."
|
||||
source "$REPOROOT/scripts/common/_prettyprint.sh"
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||
case $lowerI in
|
||||
-c|--configuration)
|
||||
export CONFIGURATION=$2
|
||||
shift
|
||||
;;
|
||||
--targets)
|
||||
IFS=',' read -r -a targets <<< $2
|
||||
shift
|
||||
;;
|
||||
--nopackage)
|
||||
export DOTNET_BUILD_SKIP_PACKAGING=1
|
||||
;;
|
||||
--skip-prereqs)
|
||||
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
||||
export DOTNET_INSTALL_SKIP_PREREQS=1
|
||||
;;
|
||||
--help)
|
||||
echo "Usage: $0 [--configuration <CONFIGURATION>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help] [--targets <TARGETS...>]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||
echo " --targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
||||
echo " --nopackage Skip packaging targets"
|
||||
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
|
||||
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
|
||||
echo " --help Display this help message"
|
||||
echo " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
# Set up the environment to be used for building with clang.
|
||||
if which "clang-3.5" > /dev/null 2>&1; then
|
||||
export CC="$(which clang-3.5)"
|
||||
export CXX="$(which clang++-3.5)"
|
||||
elif which "clang-3.6" > /dev/null 2>&1; then
|
||||
export CC="$(which clang-3.6)"
|
||||
export CXX="$(which clang++-3.6)"
|
||||
elif which clang > /dev/null 2>&1; then
|
||||
export CC="$(which clang)"
|
||||
export CXX="$(which clang++)"
|
||||
else
|
||||
error "Unable to find Clang Compiler"
|
||||
error "Install clang-3.5 or clang3.6"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load Branch Info
|
||||
while read line; do
|
||||
if [[ $line != \#* ]]; then
|
||||
IFS='=' read -ra splat <<< "$line"
|
||||
export ${splat[0]}="${splat[1]}"
|
||||
fi
|
||||
done < "$REPOROOT/branchinfo.txt"
|
||||
|
||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$(uname)
|
||||
[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR
|
||||
|
||||
$REPOROOT/scripts/obtain/dotnet-install.sh --channel $CHANNEL --verbose
|
||||
|
||||
# Put stage 0 on the PATH (for this shell only)
|
||||
PATH="$DOTNET_INSTALL_DIR:$PATH"
|
||||
|
||||
# Increases the file descriptors limit for this bash. It prevents an issue we were hitting during restore
|
||||
FILE_DESCRIPTOR_LIMIT=$( ulimit -n )
|
||||
if [ $FILE_DESCRIPTOR_LIMIT -lt 1024 ]
|
||||
then
|
||||
echo "Increasing file description limit to 1024"
|
||||
ulimit -n 1024
|
||||
fi
|
||||
|
||||
# Restore the build scripts
|
||||
echo "Restoring Build Script projects..."
|
||||
(
|
||||
cd "$DIR/.."
|
||||
dotnet restore --infer-runtimes
|
||||
)
|
||||
|
||||
# Build the builder
|
||||
echo "Compiling Build Scripts..."
|
||||
dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0
|
||||
|
||||
export PATH="$OLDPATH"
|
||||
# Run the builder
|
||||
echo "Invoking Build Scripts..."
|
||||
echo "Configuration: $CONFIGURATION"
|
||||
|
||||
$DIR/bin/dotnet-host-build ${targets[@]}
|
||||
exit $?
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>1dbb7542-0345-4f4b-a84b-3b00b185d416</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.Build</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"description": "Build scripts for dotnet-cli",
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.5.0-rc2-24027",
|
||||
"Microsoft.CSharp": "4.0.1-rc2-24027",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-24027",
|
||||
"System.Reflection.Metadata": "1.3.0-rc2-24027",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027",
|
||||
"System.Xml.XmlSerializer": "4.0.11-rc2-24027",
|
||||
"WindowsAzure.Storage": "6.2.2-preview",
|
||||
|
||||
"Microsoft.DotNet.Cli.Build.Framework": {"target":"project"},
|
||||
"shared-build-targets-utils": {"target": "project"}
|
||||
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DependencyVersions
|
||||
{
|
||||
public static readonly string CoreCLRVersion = "1.0.2-rc2-24027";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class HostArtifactNames
|
||||
{
|
||||
public static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}";
|
||||
public static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}";
|
||||
public static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class PackageDependencies
|
||||
{
|
||||
public static string[] DebianPackageBuildDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"devscripts",
|
||||
"debhelper",
|
||||
"build-essential"
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] UbuntuCoreclrAndCoreFxDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"libc6",
|
||||
"libedit2",
|
||||
"libffi6",
|
||||
"libgcc1",
|
||||
"libicu52",
|
||||
"liblldb-3.6",
|
||||
"libllvm3.6",
|
||||
"liblttng-ust0",
|
||||
"liblzma5",
|
||||
"libncurses5",
|
||||
"libpython2.7",
|
||||
"libstdc++6",
|
||||
"libtinfo5",
|
||||
"libunwind8",
|
||||
"liburcu1",
|
||||
"libuuid1",
|
||||
"zlib1g",
|
||||
"libasn1-8-heimdal",
|
||||
"libcomerr2",
|
||||
"libcurl3",
|
||||
"libgcrypt11",
|
||||
"libgnutls26",
|
||||
"libgpg-error0",
|
||||
"libgssapi3-heimdal",
|
||||
"libgssapi-krb5-2",
|
||||
"libhcrypto4-heimdal",
|
||||
"libheimbase1-heimdal",
|
||||
"libheimntlm0-heimdal",
|
||||
"libhx509-5-heimdal",
|
||||
"libidn11",
|
||||
"libk5crypto3",
|
||||
"libkeyutils1",
|
||||
"libkrb5-26-heimdal",
|
||||
"libkrb5-3",
|
||||
"libkrb5support0",
|
||||
"libldap-2.4-2",
|
||||
"libp11-kit0",
|
||||
"libroken18-heimdal",
|
||||
"librtmp0",
|
||||
"libsasl2-2",
|
||||
"libsqlite3-0",
|
||||
"libssl1.0.0",
|
||||
"libtasn1-6",
|
||||
"libwind0-heimdal"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] CentosCoreclrAndCoreFxDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"unzip",
|
||||
"libunwind",
|
||||
"gettext",
|
||||
"libcurl-devel",
|
||||
"openssl-devel",
|
||||
"zlib",
|
||||
"libicu-devel"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class AzurePublisher
|
||||
{
|
||||
private static readonly string s_dotnetBlobRootUrl = "https://dotnetcli.blob.core.windows.net/dotnet/";
|
||||
private static readonly string s_dotnetBlobContainerName = "dotnet";
|
||||
|
||||
private string _connectionString { get; set; }
|
||||
private CloudBlobContainer _blobContainer { get; set; }
|
||||
|
||||
public AzurePublisher()
|
||||
{
|
||||
_connectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING").Trim('"');
|
||||
_blobContainer = GetDotnetBlobContainer(_connectionString);
|
||||
}
|
||||
|
||||
private CloudBlobContainer GetDotnetBlobContainer(string connectionString)
|
||||
{
|
||||
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
|
||||
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
|
||||
|
||||
return blobClient.GetContainerReference(s_dotnetBlobContainerName);
|
||||
}
|
||||
|
||||
public void PublishInstallerFile(string installerFile, string channel, string version)
|
||||
{
|
||||
var installerFileBlob = CalculateInstallerBlob(installerFile, channel, version);
|
||||
PublishFile(installerFileBlob, installerFile);
|
||||
}
|
||||
|
||||
public void PublishArchive(string archiveFile, string channel, string version)
|
||||
{
|
||||
var archiveFileBlob = CalculateArchiveBlob(archiveFile, channel, version);
|
||||
PublishFile(archiveFileBlob, archiveFile);
|
||||
}
|
||||
|
||||
public void PublishFile(string blob, string file)
|
||||
{
|
||||
CloudBlockBlob blockBlob = _blobContainer.GetBlockBlobReference(blob);
|
||||
blockBlob.UploadFromFileAsync(file, FileMode.Open).Wait();
|
||||
|
||||
SetBlobPropertiesBasedOnFileType(blockBlob);
|
||||
}
|
||||
|
||||
public void PublishStringToBlob(string blob, string content)
|
||||
{
|
||||
CloudBlockBlob blockBlob = _blobContainer.GetBlockBlobReference(blob);
|
||||
blockBlob.UploadTextAsync(content).Wait();
|
||||
|
||||
blockBlob.Properties.ContentType = "text/plain";
|
||||
blockBlob.SetPropertiesAsync().Wait();
|
||||
}
|
||||
|
||||
public void CopyBlob(string sourceBlob, string targetBlob)
|
||||
{
|
||||
CloudBlockBlob source = _blobContainer.GetBlockBlobReference(sourceBlob);
|
||||
CloudBlockBlob target = _blobContainer.GetBlockBlobReference(targetBlob);
|
||||
|
||||
// Create the empty blob
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
target.UploadFromStreamAsync(ms).Wait();
|
||||
}
|
||||
|
||||
// Copy actual blob data
|
||||
target.StartCopyAsync(source).Wait();
|
||||
}
|
||||
|
||||
private void SetBlobPropertiesBasedOnFileType(CloudBlockBlob blockBlob)
|
||||
{
|
||||
if (Path.GetExtension(blockBlob.Uri.AbsolutePath.ToLower()) == ".svg")
|
||||
{
|
||||
blockBlob.Properties.ContentType = "image/svg+xml";
|
||||
blockBlob.Properties.CacheControl = "no-cache";
|
||||
blockBlob.SetPropertiesAsync().Wait();
|
||||
}
|
||||
else if (Path.GetExtension(blockBlob.Uri.AbsolutePath.ToLower()) == ".version")
|
||||
{
|
||||
blockBlob.Properties.ContentType = "text/plain";
|
||||
blockBlob.SetPropertiesAsync().Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> ListBlobs(string virtualDirectory)
|
||||
{
|
||||
CloudBlobDirectory blobDir = _blobContainer.GetDirectoryReference(virtualDirectory);
|
||||
BlobContinuationToken continuationToken = new BlobContinuationToken();
|
||||
|
||||
var blobFiles = blobDir.ListBlobsSegmentedAsync(continuationToken).Result;
|
||||
return blobFiles.Results.Select(bf => bf.Uri.PathAndQuery);
|
||||
}
|
||||
|
||||
public string AcquireLeaseOnBlob(string blob)
|
||||
{
|
||||
CloudBlockBlob cloudBlob = _blobContainer.GetBlockBlobReference(blob);
|
||||
System.Threading.Tasks.Task<string> task = cloudBlob.AcquireLeaseAsync(TimeSpan.FromMinutes(1), null);
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
|
||||
public void ReleaseLeaseOnBlob(string blob, string leaseId)
|
||||
{
|
||||
CloudBlockBlob cloudBlob = _blobContainer.GetBlockBlobReference(blob);
|
||||
AccessCondition ac = new AccessCondition() { LeaseId = leaseId };
|
||||
cloudBlob.ReleaseLeaseAsync(ac).Wait();
|
||||
}
|
||||
|
||||
public bool IsLatestSpecifiedVersion(string version)
|
||||
{
|
||||
System.Threading.Tasks.Task<bool> task = _blobContainer.GetBlockBlobReference(version).ExistsAsync();
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
|
||||
public void DropLatestSpecifiedVersion(string version)
|
||||
{
|
||||
CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(version);
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
blob.UploadFromStreamAsync(ms).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateBlobIfNotExists(string path)
|
||||
{
|
||||
System.Threading.Tasks.Task<bool> task = _blobContainer.GetBlockBlobReference(path).ExistsAsync();
|
||||
task.Wait();
|
||||
if (!task.Result)
|
||||
{
|
||||
CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(path);
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
blob.UploadFromStreamAsync(ms).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryDeleteBlob(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeleteBlob(path);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Deleting blob {path} failed with \r\n{e.Message}");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteBlob(string path)
|
||||
{
|
||||
_blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait();
|
||||
}
|
||||
|
||||
public string CalculateInstallerUploadUrl(string installerFile, string channel, string version)
|
||||
{
|
||||
return $"{s_dotnetBlobRootUrl}{CalculateInstallerBlob(installerFile, channel, version)}";
|
||||
}
|
||||
|
||||
public string CalculateInstallerBlob(string installerFile, string channel, string version)
|
||||
{
|
||||
return $"{channel}/Installers/{version}/{Path.GetFileName(installerFile)}";
|
||||
}
|
||||
|
||||
public string CalculateArchiveUploadUrl(string archiveFile, string channel, string version)
|
||||
{
|
||||
return $"{s_dotnetBlobRootUrl}{CalculateArchiveBlob(archiveFile, channel, version)}";
|
||||
}
|
||||
|
||||
public string CalculateArchiveBlob(string archiveFile, string channel, string version)
|
||||
{
|
||||
return $"{channel}/Binaries/{version}/{Path.GetFileName(archiveFile)}";
|
||||
}
|
||||
|
||||
public void DownloadFiles(string blobVirtualDirectory, string fileExtension, string downloadPath)
|
||||
{
|
||||
CloudBlobDirectory blobDir = _blobContainer.GetDirectoryReference(blobVirtualDirectory);
|
||||
BlobContinuationToken continuationToken = new BlobContinuationToken();
|
||||
|
||||
var blobFiles = blobDir.ListBlobsSegmentedAsync(continuationToken).Result;
|
||||
|
||||
foreach (var blobFile in blobFiles.Results.OfType<CloudBlockBlob>())
|
||||
{
|
||||
if (Path.GetExtension(blobFile.Uri.AbsoluteUri) == fileExtension)
|
||||
{
|
||||
string localBlobFile = Path.Combine(downloadPath, Path.GetFileName(blobFile.Uri.AbsoluteUri));
|
||||
Console.WriteLine($"Downloading {blobFile.Uri.AbsoluteUri} to {localBlobFile}...");
|
||||
blobFile.DownloadToFileAsync(localBlobFile, FileMode.Create).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DebRepoPublisher
|
||||
{
|
||||
private const string _debianRevisionNumber = "1";
|
||||
private string _repoID;
|
||||
private string _uploadJsonDirectory;
|
||||
|
||||
public DebRepoPublisher(string uploadJsonDirectory)
|
||||
{
|
||||
_uploadJsonDirectory = uploadJsonDirectory;
|
||||
_repoID = Environment.GetEnvironmentVariable("REPO_ID");
|
||||
}
|
||||
|
||||
public void PublishDebFileToDebianRepo(string packageName, string packageVersion, string uploadUrl)
|
||||
{
|
||||
var uploadJson = GenerateUploadJsonFile(packageName, packageVersion, uploadUrl);
|
||||
|
||||
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "publish", "repoapi_client.sh"), "-addpkg", uploadJson)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
|
||||
private string GenerateUploadJsonFile(string packageName, string packageVersion, string uploadUrl)
|
||||
{
|
||||
var uploadJson = Path.Combine(_uploadJsonDirectory, "package_upload.json");
|
||||
File.Delete(uploadJson);
|
||||
|
||||
using (var fileStream = File.Create(uploadJson))
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(fileStream))
|
||||
{
|
||||
sw.WriteLine("{");
|
||||
sw.WriteLine($" \"name\":\"{packageName}\",");
|
||||
sw.WriteLine($" \"version\":\"{packageVersion}-{_debianRevisionNumber}\",");
|
||||
sw.WriteLine($" \"repositoryId\":\"{_repoID}\",");
|
||||
sw.WriteLine($" \"sourceUrl\":\"{uploadUrl}\"");
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
return uploadJson;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class AptDependencyUtility
|
||||
{
|
||||
public static bool PackageIsInstalled(string packageName)
|
||||
{
|
||||
var result = Command.Create("dpkg", "-s", packageName)
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.QuietBuildReporter()
|
||||
.Execute();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class BranchInfo
|
||||
{
|
||||
private static readonly string s_branchInfoFileName = "branchinfo.txt";
|
||||
|
||||
private string _repoRoot;
|
||||
private string _branchInfoFile;
|
||||
|
||||
public IDictionary<string, string> Entries { get; set; }
|
||||
|
||||
public BranchInfo(string repoRoot)
|
||||
{
|
||||
_repoRoot = repoRoot;
|
||||
_branchInfoFile = Path.Combine(_repoRoot, s_branchInfoFileName);
|
||||
|
||||
Entries = ReadBranchInfo(_branchInfoFile);
|
||||
}
|
||||
|
||||
private IDictionary<string, string> ReadBranchInfo(string path)
|
||||
{
|
||||
var lines = File.ReadAllLines(path);
|
||||
var dict = new Dictionary<string, string>();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (!line.Trim().StartsWith("#") && !string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
var splat = line.Split(new[] { '=' }, 2);
|
||||
dict[splat[0]] = splat[1];
|
||||
}
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class BuildVersion : Version
|
||||
{
|
||||
public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCountString}";
|
||||
public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}";
|
||||
public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}";
|
||||
public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc3-{CommitCountString}";
|
||||
public string ProductionVersion => $"{Major}.{Minor}.{Patch}";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class Crossgen
|
||||
{
|
||||
private string _coreClrVersion;
|
||||
private string _crossGenPath;
|
||||
|
||||
// This is not always correct. The version of crossgen we need to pick up is whatever one was restored as part
|
||||
// of the Microsoft.NETCore.Runtime.CoreCLR package that is part of the shared library. For now, the version hardcoded
|
||||
// in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
|
||||
// we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
|
||||
// was used, and then select that version.
|
||||
public Crossgen(string coreClrVersion)
|
||||
{
|
||||
_coreClrVersion = coreClrVersion;
|
||||
_crossGenPath = GetCrossgenPathForVersion();
|
||||
}
|
||||
|
||||
private string GetCrossgenPathForVersion()
|
||||
{
|
||||
string arch = RuntimeEnvironment.RuntimeArchitecture;
|
||||
string packageId;
|
||||
if (CurrentPlatform.IsWindows)
|
||||
{
|
||||
packageId = $"runtime.win7-{arch}.Microsoft.NETCore.Runtime.CoreCLR";
|
||||
}
|
||||
else if (CurrentPlatform.IsUbuntu)
|
||||
{
|
||||
packageId = "runtime.ubuntu.14.04-x64.Microsoft.NETCore.Runtime.CoreCLR";
|
||||
}
|
||||
else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL)
|
||||
{
|
||||
// CentOS runtime is in the runtime.rhel.7-x64... package.
|
||||
packageId = "runtime.rhel.7-x64.Microsoft.NETCore.Runtime.CoreCLR";
|
||||
}
|
||||
else if (CurrentPlatform.IsOSX)
|
||||
{
|
||||
packageId = "runtime.osx.10.10-x64.Microsoft.NETCore.Runtime.CoreCLR";
|
||||
}
|
||||
else if (CurrentPlatform.IsDebian)
|
||||
{
|
||||
packageId = "runtime.debian.8-x64.Microsoft.NETCore.Runtime.CoreCLR";
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
Dirs.NuGetPackages,
|
||||
packageId,
|
||||
_coreClrVersion,
|
||||
"tools",
|
||||
$"crossgen{Constants.ExeSuffix}");
|
||||
}
|
||||
|
||||
public void CrossgenDirectory(string sharedFxPath, string pathToAssemblies)
|
||||
{
|
||||
// Check if we need to skip crossgen
|
||||
if (string.Equals(Environment.GetEnvironmentVariable("DISABLE_CROSSGEN"), "1"))
|
||||
{
|
||||
var originalColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Skipping crossgen for because DISABLE_CROSSGEN is set to 1");
|
||||
Console.ForegroundColor = originalColor;
|
||||
return;
|
||||
}
|
||||
|
||||
// HACK
|
||||
// The input directory can be a portable FAT app (example the CLI itself).
|
||||
// In that case there can be RID specific managed dependencies which are not right next to the app binary (example System.Diagnostics.TraceSource).
|
||||
// We need those dependencies during crossgen. For now we just pass all subdirectories of the input directory as input to crossgen.
|
||||
// The right fix -
|
||||
// If the assembly has deps.json then parse the json file to get all the dependencies, pass these dependencies as input to crossgen.
|
||||
// else pass the current directory of assembly as input to crossgen.
|
||||
var addtionalPaths = Directory.GetDirectories(pathToAssemblies, "*", SearchOption.AllDirectories).ToList();
|
||||
var paths = new List<string>() { sharedFxPath, pathToAssemblies };
|
||||
paths.AddRange(addtionalPaths);
|
||||
var platformAssembliesPaths = string.Join(Path.PathSeparator.ToString(), paths.Distinct());
|
||||
|
||||
var env = new Dictionary<string, string>()
|
||||
{
|
||||
// disable partial ngen
|
||||
{ "COMPlus_PartialNGen", "0" }
|
||||
};
|
||||
|
||||
foreach (var file in Directory.GetFiles(pathToAssemblies))
|
||||
{
|
||||
string fileName = Path.GetFileName(file);
|
||||
|
||||
if (fileName == "mscorlib.dll" || fileName == "mscorlib.ni.dll" || !PEUtils.HasMetadata(file))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string tempPathName = Path.ChangeExtension(file, "readytorun");
|
||||
|
||||
IList<string> crossgenArgs = new List<string> {
|
||||
"-readytorun", "-in", file, "-out", tempPathName,
|
||||
"-platform_assemblies_paths", platformAssembliesPaths
|
||||
};
|
||||
|
||||
ExecSilent(_crossGenPath, crossgenArgs, env);
|
||||
|
||||
File.Copy(tempPathName, file, overwrite: true);
|
||||
File.Delete(tempPathName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class Dirs
|
||||
{
|
||||
public static readonly string RepoRoot = Directory.GetCurrentDirectory();
|
||||
public static readonly string Output = Path.Combine(
|
||||
RepoRoot,
|
||||
"artifacts",
|
||||
RuntimeEnvironment.GetRuntimeIdentifier());
|
||||
|
||||
public static readonly string Intermediate = Path.Combine(Output, "intermediate");
|
||||
public static readonly string PackagesIntermediate = Path.Combine(Output, "packages/intermediate");
|
||||
public static readonly string PackagesNoRID = Path.Combine(RepoRoot, "artifacts", "packages");
|
||||
public static readonly string Packages = Path.Combine(Output, "packages");
|
||||
public static readonly string Stage1 = Path.Combine(Output, "stage1");
|
||||
public static readonly string Stage1Compilation = Path.Combine(Output, "stage1compilation");
|
||||
public static readonly string Stage1Symbols = Path.Combine(Output, "stage1symbols");
|
||||
public static readonly string Stage2 = Path.Combine(Output, "stage2");
|
||||
public static readonly string Stage2Compilation = Path.Combine(Output, "stage2compilation");
|
||||
public static readonly string Stage2Symbols = Path.Combine(Output, "stage2symbols");
|
||||
public static readonly string CorehostLatest = Path.Combine(Output, "corehost"); // Not using Path.Combine(Output, "corehost", "latest") to keep signing working.
|
||||
public static readonly string CorehostLocked = Path.Combine(Output, "corehost", "locked");
|
||||
public static readonly string CorehostLocalPackages = Path.Combine(Output, "corehost");
|
||||
public static readonly string CorehostDummyPackages = Path.Combine(Output, "corehostdummypackages");
|
||||
public static readonly string SharedFrameworkPublish = Path.Combine(Output, "sharedFrameworkPublish");
|
||||
public static readonly string TestOutput = Path.Combine(Output, "tests");
|
||||
public static readonly string TestArtifacts = Path.Combine(TestOutput, "artifacts");
|
||||
public static readonly string TestPackages = Path.Combine(TestOutput, "packages");
|
||||
public static readonly string TestPackagesBuild = Path.Combine(TestOutput, "packagesBuild");
|
||||
|
||||
|
||||
public static readonly string OSXReferenceAssembliesPath = "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks";
|
||||
public static readonly string UsrLocalReferenceAssembliesPath = "/usr/local/lib/mono/xbuild-frameworks";
|
||||
public static readonly string UsrReferenceAssembliesPath = "/usr/lib/mono/xbuild-frameworks";
|
||||
|
||||
|
||||
public static string NuGetPackages = Environment.GetEnvironmentVariable("NUGET_PACKAGES") ?? GetNuGetPackagesDir();
|
||||
|
||||
private static string GetNuGetPackagesDir()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), ".nuget", "packages");
|
||||
}
|
||||
return Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".nuget", "packages");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetCli
|
||||
{
|
||||
public static readonly DotNetCli Stage0 = new DotNetCli(GetStage0Path());
|
||||
public static readonly DotNetCli Stage1 = new DotNetCli(Dirs.Stage1);
|
||||
public static readonly DotNetCli Stage2 = new DotNetCli(Dirs.Stage2);
|
||||
|
||||
public string BinPath { get; }
|
||||
|
||||
public DotNetCli(string binPath)
|
||||
{
|
||||
BinPath = binPath;
|
||||
}
|
||||
|
||||
public Command Exec(string command, params string[] args)
|
||||
{
|
||||
var newArgs = args.ToList();
|
||||
newArgs.Insert(0, command);
|
||||
|
||||
if (EnvVars.Verbose)
|
||||
{
|
||||
newArgs.Insert(0, "-v");
|
||||
}
|
||||
|
||||
return Command.Create(Path.Combine(BinPath, $"dotnet{Constants.ExeSuffix}"), newArgs);
|
||||
}
|
||||
|
||||
public Command Restore(params string[] args) => Exec("restore", args);
|
||||
public Command Build(params string[] args) => Exec("build", args);
|
||||
public Command Pack(params string[] args) => Exec("pack", args);
|
||||
public Command Test(params string[] args) => Exec("test", args);
|
||||
public Command Publish(params string[] args) => Exec("publish", args);
|
||||
|
||||
public string GetRuntimeId()
|
||||
{
|
||||
string info = Exec("", "--info").CaptureStdOut().Execute().StdOut;
|
||||
string rid = Array.Find<string>(info.Split(Environment.NewLine.ToCharArray()), (e) => e.Contains("RID:"))?.Replace("RID:", "").Trim();
|
||||
|
||||
if (string.IsNullOrEmpty(rid))
|
||||
{
|
||||
throw new BuildFailureException("Could not find the Runtime ID from Stage0 --info or --version");
|
||||
}
|
||||
|
||||
return rid;
|
||||
}
|
||||
|
||||
private static string GetStage0Path()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), ".dotnet_stage0",
|
||||
RuntimeEnvironment.OperatingSystemPlatform.ToString(),
|
||||
RuntimeEnvironment.RuntimeArchitecture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), ".dotnet_stage0", RuntimeEnvironment.OperatingSystemPlatform.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class EnvVars
|
||||
{
|
||||
public static readonly bool Verbose = GetBool("DOTNET_BUILD_VERBOSE");
|
||||
|
||||
private static bool GetBool(string name, bool defaultValue = false)
|
||||
{
|
||||
var str = Environment.GetEnvironmentVariable(name);
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
switch (str.ToLowerInvariant())
|
||||
{
|
||||
case "true":
|
||||
case "1":
|
||||
case "yes":
|
||||
return true;
|
||||
case "false":
|
||||
case "0":
|
||||
case "no":
|
||||
return false;
|
||||
default:
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static string EnsureVariable(string variableName)
|
||||
{
|
||||
string value = Environment.GetEnvironmentVariable(variableName);
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new BuildFailureException($"'{variableName}' environment variable was not found.");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class FS
|
||||
{
|
||||
public static void Mkdirp(string dir)
|
||||
{
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Rm(string file)
|
||||
{
|
||||
if(File.Exists(file))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Rmdir(string dir)
|
||||
{
|
||||
if(Directory.Exists(dir))
|
||||
{
|
||||
Directory.Delete(dir, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RmFilesInDirRecursive(string dir, string filePattern)
|
||||
{
|
||||
var files = Directory.EnumerateFiles(dir, filePattern, SearchOption.AllDirectories);
|
||||
foreach (var file in files)
|
||||
{
|
||||
FS.Rm(file);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Chmod(string file, string mode, bool recursive = false)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
if (recursive)
|
||||
{
|
||||
Command.Create("chmod", "-R", mode, file).Execute().EnsureSuccessful();
|
||||
}
|
||||
else
|
||||
{
|
||||
Command.Create("chmod", mode, file).Execute().EnsureSuccessful();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChmodAll(string searchDir, string pattern, string mode)
|
||||
{
|
||||
Exec("find", searchDir, "-type", "f", "-name", pattern, "-exec", "chmod", mode, "{}", ";");
|
||||
}
|
||||
|
||||
public static void FixModeFlags(string dir)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
// Managed code doesn't need 'x'
|
||||
ChmodAll(dir, "*.dll", "644");
|
||||
ChmodAll(dir, "*.exe", "644");
|
||||
|
||||
// Generally, dylibs and sos have 'x' (no idea if it's required ;))
|
||||
// (No need to condition this on OS since there shouldn't be any dylibs on Linux,
|
||||
// but even if they are we may as well set their mode flags :))
|
||||
ChmodAll(dir, "*.dylib", "755");
|
||||
ChmodAll(dir, "*.so", "755");
|
||||
|
||||
// Executables (those without dots) are executable :)
|
||||
Exec("find", dir, "-type", "f", "!", "-name", "*.*", "-exec", "chmod", "755", "{}", ";");
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyRecursive(string sourceDirectory, string destinationDirectory, bool overwrite = false)
|
||||
{
|
||||
Mkdirp(destinationDirectory);
|
||||
|
||||
foreach(var dir in Directory.EnumerateDirectories(sourceDirectory))
|
||||
{
|
||||
CopyRecursive(dir, Path.Combine(destinationDirectory, Path.GetFileName(dir)), overwrite);
|
||||
}
|
||||
|
||||
foreach(var file in Directory.EnumerateFiles(sourceDirectory))
|
||||
{
|
||||
var dest = Path.Combine(destinationDirectory, Path.GetFileName(file));
|
||||
if (!File.Exists(dest) || overwrite)
|
||||
{
|
||||
// We say overwrite true, because we only get here if the file didn't exist (thus it doesn't matter) or we
|
||||
// wanted to overwrite :)
|
||||
File.Copy(file, dest, overwrite: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CleanBinObj(BuildTargetContext c, string dir)
|
||||
{
|
||||
dir = dir ?? c.BuildContext.BuildDirectory;
|
||||
foreach(var candidate in Directory.EnumerateDirectories(dir))
|
||||
{
|
||||
if (string.Equals(Path.GetFileName(candidate), "bin") ||
|
||||
string.Equals(Path.GetFileName(candidate), "obj"))
|
||||
{
|
||||
Utils.DeleteDirectory(candidate);
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanBinObj(c, candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class HostVersion : Version
|
||||
{
|
||||
// ------------------------------------------HOST-VERSIONING-------------------------------------------
|
||||
//
|
||||
// Host versions are independent of CLI versions. Moreover, these version numbers
|
||||
// are baked into the binary and is used to look up a serviced binary replacement.
|
||||
//
|
||||
|
||||
//
|
||||
// Latest hosts for production of nupkgs.
|
||||
//
|
||||
|
||||
// Version constants without suffix
|
||||
public override int Major => 1;
|
||||
public override int Minor => 0;
|
||||
public override int Patch => 1;
|
||||
public override string ReleaseSuffix => "rc3";
|
||||
public string LatestHostVersionNoSuffix => $"{Major}.{Minor}.{Patch}";
|
||||
public string LatestHostFxrVersionNoSuffix => $"{Major}.{Minor}.{Patch}";
|
||||
public string LatestHostPolicyVersionNoSuffix => $"{Major}.{Minor}.{Patch}";
|
||||
public string LatestHostPrerelease => ReleaseSuffix;
|
||||
public string LatestHostBuildMajor => $"{CommitCountString}";
|
||||
public string LatestHostBuildMinor => "00";
|
||||
public string LatestHostSuffix => $"{ReleaseSuffix}-{LatestHostBuildMajor}-{LatestHostBuildMinor}";
|
||||
|
||||
// Full versions and package information.
|
||||
public string LatestHostVersion => $"{LatestHostVersionNoSuffix}-{LatestHostSuffix}";
|
||||
public string LatestHostFxrVersion => $"{LatestHostFxrVersionNoSuffix}-{LatestHostSuffix}";
|
||||
public string LatestHostPolicyVersion => $"{LatestHostPolicyVersionNoSuffix}-{LatestHostSuffix}";
|
||||
public Dictionary<string, string> LatestHostPackages => new Dictionary<string, string>()
|
||||
{
|
||||
{ "Microsoft.NETCore.DotNetHost", LatestHostVersion },
|
||||
{ "Microsoft.NETCore.DotNetHostResolver", LatestHostFxrVersion },
|
||||
{ "Microsoft.NETCore.DotNetHostPolicy", LatestHostPolicyVersion }
|
||||
};
|
||||
|
||||
//
|
||||
// Locked muxer for consumption in CLI.
|
||||
//
|
||||
public bool IsLocked = false; // Set this variable to toggle muxer locking.
|
||||
public string LockedHostFxrVersion => IsLocked ? "1.0.1-rc2-002468-00" : LatestHostFxrVersion;
|
||||
public string LockedHostVersion => IsLocked ? "1.0.1-rc2-002468-00" : LatestHostVersion;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class JsonUtils
|
||||
{
|
||||
public static JObject ReadProject(string projectJsonPath)
|
||||
{
|
||||
using (TextReader projectFileReader = File.OpenText(projectJsonPath))
|
||||
{
|
||||
var projectJsonReader = new JsonTextReader(projectFileReader);
|
||||
|
||||
var serializer = new JsonSerializer();
|
||||
return serializer.Deserialize<JObject>(projectJsonReader);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteProject(JObject projectRoot, string projectJsonPath)
|
||||
{
|
||||
string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented);
|
||||
|
||||
File.WriteAllText(projectJsonPath, projectJson + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class Monikers
|
||||
{
|
||||
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
||||
public const string CLISdkBrandName = "Microsoft .NET Core 1.0.0 RC2 - SDK Preview 1";
|
||||
public const string SharedFxBrandName = "Microsoft .NET Core 1.0.0 RC2 - Runtime";
|
||||
public const string SharedHostBrandName = "Microsoft .NET Core 1.0.0 RC2 - Host";
|
||||
|
||||
public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix, string version)
|
||||
{
|
||||
string osname = GetOSShortName();
|
||||
var arch = CurrentArchitecture.Current.ToString();
|
||||
return $"{artifactPrefix}-{osname}-{arch}.{version}";
|
||||
}
|
||||
|
||||
public static string GetDebianPackageName(BuildTargetContext c)
|
||||
{
|
||||
var channel = c.BuildContext.Get<string>("Channel").ToLower();
|
||||
var packageName = "";
|
||||
switch (channel)
|
||||
{
|
||||
case "dev":
|
||||
packageName = "dotnet-nightly";
|
||||
break;
|
||||
case "beta":
|
||||
case "rc1":
|
||||
case "rc2":
|
||||
case "preview":
|
||||
case "rtm":
|
||||
packageName = "dotnet";
|
||||
break;
|
||||
default:
|
||||
throw new Exception($"Unknown channel - {channel}");
|
||||
}
|
||||
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public static string GetSdkDebianPackageName(BuildTargetContext c)
|
||||
{
|
||||
var channel = c.BuildContext.Get<string>("Channel").ToLower();
|
||||
var nugetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
|
||||
|
||||
var packagePrefix = "";
|
||||
switch (channel)
|
||||
{
|
||||
case "dev":
|
||||
packagePrefix = "dotnet-nightly";
|
||||
break;
|
||||
case "beta":
|
||||
case "rc1":
|
||||
case "rc2":
|
||||
case "preview":
|
||||
case "rtm":
|
||||
packagePrefix = "dotnet";
|
||||
break;
|
||||
default:
|
||||
throw new Exception($"Unknown channel - {channel}");
|
||||
}
|
||||
|
||||
return $"{packagePrefix}-dev-{nugetVersion}";
|
||||
}
|
||||
|
||||
public static string GetDebianSharedFrameworkPackageName(BuildTargetContext c)
|
||||
{
|
||||
var sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
|
||||
return $"dotnet-sharedframework-{SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower();
|
||||
}
|
||||
|
||||
public static string GetDebianSharedHostPackageName(BuildTargetContext c)
|
||||
{
|
||||
return $"dotnet-host".ToLower();
|
||||
}
|
||||
|
||||
public static string GetOSShortName()
|
||||
{
|
||||
string osname = "";
|
||||
switch (CurrentPlatform.Current)
|
||||
{
|
||||
case BuildPlatform.Windows:
|
||||
osname = "win";
|
||||
break;
|
||||
default:
|
||||
osname = CurrentPlatform.Current.ToString().ToLower();
|
||||
break;
|
||||
}
|
||||
|
||||
return osname;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection.PortableExecutable;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class PEUtils
|
||||
{
|
||||
public static bool HasMetadata(string pathToFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var inStream = File.OpenRead(pathToFile))
|
||||
{
|
||||
using (var peReader = new PEReader(inStream))
|
||||
{
|
||||
return peReader.HasMetadata;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BadImageFormatException) { }
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class PublishMutationUtilties
|
||||
{
|
||||
public static void CleanPublishOutput(
|
||||
string path,
|
||||
string name,
|
||||
bool deleteRuntimeConfigJson=false,
|
||||
bool deleteDepsJson=false)
|
||||
{
|
||||
File.Delete(Path.Combine(path, $"{name}{Constants.ExeSuffix}"));
|
||||
File.Delete(Path.Combine(path, $"{name}.dll"));
|
||||
File.Delete(Path.Combine(path, $"{name}.pdb"));
|
||||
|
||||
if (deleteRuntimeConfigJson)
|
||||
{
|
||||
File.Delete(Path.Combine(path, $"{name}.runtimeconfig.json"));
|
||||
}
|
||||
|
||||
if (deleteDepsJson)
|
||||
{
|
||||
File.Delete(Path.Combine(path, $"{name}.deps.json"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeEntryPointLibraryName(string depsFile, string newName)
|
||||
{
|
||||
JToken deps;
|
||||
using (var file = File.OpenText(depsFile))
|
||||
using (JsonTextReader reader = new JsonTextReader(file))
|
||||
{
|
||||
deps = JObject.ReadFrom(reader);
|
||||
}
|
||||
|
||||
string version = null;
|
||||
foreach (JProperty target in deps["targets"])
|
||||
{
|
||||
var targetLibrary = target.Value.Children<JProperty>().FirstOrDefault();
|
||||
if (targetLibrary == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
version = targetLibrary.Name.Substring(targetLibrary.Name.IndexOf('/') + 1);
|
||||
if (newName == null)
|
||||
{
|
||||
targetLibrary.Remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
targetLibrary.Replace(new JProperty(newName + '/' + version, targetLibrary.Value));
|
||||
}
|
||||
}
|
||||
if (version != null)
|
||||
{
|
||||
var library = deps["libraries"].Children<JProperty>().First();
|
||||
if (newName == null)
|
||||
{
|
||||
library.Remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
library.Replace(new JProperty(newName + '/' + version, library.Value));
|
||||
}
|
||||
using (var file = File.CreateText(depsFile))
|
||||
using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented })
|
||||
{
|
||||
deps.WriteTo(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
using static Microsoft.DotNet.Cli.Build.FS;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class SharedFrameworkPublisher
|
||||
{
|
||||
public static string s_sharedFrameworkName = "Microsoft.NETCore.App";
|
||||
|
||||
private string _sharedFrameworkTemplateSourceRoot;
|
||||
private string _sharedFrameworkNugetVersion;
|
||||
private string _sharedFrameworkRid;
|
||||
private string _sharedFrameworkSourceRoot;
|
||||
private string _repoRoot;
|
||||
private string _corehostLockedDirectory;
|
||||
private string _corehostLatestDirectory;
|
||||
|
||||
private Crossgen _crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
|
||||
private string _corehostPackageSource;
|
||||
|
||||
public SharedFrameworkPublisher(
|
||||
string repoRoot,
|
||||
string corehostLockedDirectory,
|
||||
string corehostLatestDirectory,
|
||||
string corehostPackageSource,
|
||||
string sharedFrameworkNugetVersion)
|
||||
{
|
||||
_repoRoot = repoRoot;
|
||||
_corehostLockedDirectory = corehostLockedDirectory;
|
||||
_corehostLatestDirectory = corehostLatestDirectory;
|
||||
_corehostPackageSource = corehostPackageSource;
|
||||
|
||||
_sharedFrameworkTemplateSourceRoot = Path.Combine(repoRoot, "src", "sharedframework", "framework");
|
||||
_sharedFrameworkNugetVersion = sharedFrameworkNugetVersion;
|
||||
|
||||
_sharedFrameworkRid = ComputeSharedFrameworkRid();
|
||||
|
||||
_sharedFrameworkSourceRoot = GenerateSharedFrameworkProject(
|
||||
_sharedFrameworkNugetVersion,
|
||||
_sharedFrameworkTemplateSourceRoot,
|
||||
_sharedFrameworkRid);
|
||||
}
|
||||
|
||||
public static string GetSharedFrameworkPublishPath(string outputRootDirectory, string sharedFrameworkNugetVersion)
|
||||
{
|
||||
return Path.Combine(
|
||||
outputRootDirectory,
|
||||
"shared",
|
||||
s_sharedFrameworkName,
|
||||
sharedFrameworkNugetVersion);
|
||||
}
|
||||
|
||||
private string ComputeSharedFrameworkRid()
|
||||
{
|
||||
return RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows
|
||||
? $"win7-{RuntimeEnvironment.RuntimeArchitecture}"
|
||||
: RuntimeEnvironment.GetRuntimeIdentifier();
|
||||
}
|
||||
|
||||
public void CopySharedHostArtifacts(string sharedFrameworkPublishRoot)
|
||||
{
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName),
|
||||
Path.Combine(sharedFrameworkPublishRoot, HostArtifactNames.DotnetHostBaseName), true);
|
||||
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostFxrBaseName),
|
||||
Path.Combine(sharedFrameworkPublishRoot, HostArtifactNames.DotnetHostFxrBaseName), true);
|
||||
|
||||
}
|
||||
|
||||
public void PublishSharedFramework(string outputRootDirectory, string commitHash, DotNetCli dotnetCli)
|
||||
{
|
||||
dotnetCli.Restore(
|
||||
"--verbosity", "verbose",
|
||||
"--disable-parallel",
|
||||
"--infer-runtimes",
|
||||
"--fallbacksource", _corehostPackageSource)
|
||||
.WorkingDirectory(_sharedFrameworkSourceRoot)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
// We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier.
|
||||
string sharedFrameworkNameAndVersionRoot = GetSharedFrameworkPublishPath(outputRootDirectory, _sharedFrameworkNugetVersion);
|
||||
if (Directory.Exists(sharedFrameworkNameAndVersionRoot))
|
||||
{
|
||||
Utils.DeleteDirectory(sharedFrameworkNameAndVersionRoot);
|
||||
}
|
||||
|
||||
dotnetCli.Publish(
|
||||
"--output", sharedFrameworkNameAndVersionRoot,
|
||||
"-r", _sharedFrameworkRid,
|
||||
_sharedFrameworkSourceRoot)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
|
||||
// Clean up artifacts that dotnet-publish generates which we don't need
|
||||
PublishMutationUtilties.CleanPublishOutput(
|
||||
sharedFrameworkNameAndVersionRoot,
|
||||
"framework",
|
||||
deleteRuntimeConfigJson: true,
|
||||
deleteDepsJson: false);
|
||||
|
||||
// Rename the .deps file
|
||||
var destinationDeps = Path.Combine(sharedFrameworkNameAndVersionRoot, $"{s_sharedFrameworkName}.deps.json");
|
||||
File.Move(Path.Combine(sharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps);
|
||||
PublishMutationUtilties.ChangeEntryPointLibraryName(destinationDeps, null);
|
||||
|
||||
// Generate RID fallback graph
|
||||
GenerateRuntimeGraph(dotnetCli, destinationDeps);
|
||||
|
||||
CopyHostArtifactsToSharedFramework(sharedFrameworkNameAndVersionRoot);
|
||||
|
||||
if (File.Exists(Path.Combine(sharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll")))
|
||||
{
|
||||
// Publish already places the crossgen'd version of mscorlib into the output, so we can
|
||||
// remove the IL version
|
||||
File.Delete(Path.Combine(sharedFrameworkNameAndVersionRoot, "mscorlib.dll"));
|
||||
}
|
||||
|
||||
_crossgenUtil.CrossgenDirectory(sharedFrameworkNameAndVersionRoot, sharedFrameworkNameAndVersionRoot);
|
||||
|
||||
// Generate .version file for sharedfx
|
||||
var version = _sharedFrameworkNugetVersion;
|
||||
var content = $@"{commitHash}{Environment.NewLine}{version}{Environment.NewLine}";
|
||||
File.WriteAllText(Path.Combine(sharedFrameworkNameAndVersionRoot, ".version"), content);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void GenerateRuntimeGraph(DotNetCli dotnetCli, string destinationDeps)
|
||||
{
|
||||
string runtimeGraphGeneratorRuntime = null;
|
||||
switch (RuntimeEnvironment.OperatingSystemPlatform)
|
||||
{
|
||||
case Platform.Windows:
|
||||
runtimeGraphGeneratorRuntime = "win";
|
||||
break;
|
||||
case Platform.Linux:
|
||||
runtimeGraphGeneratorRuntime = "linux";
|
||||
break;
|
||||
case Platform.Darwin:
|
||||
runtimeGraphGeneratorRuntime = "osx";
|
||||
break;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(runtimeGraphGeneratorRuntime))
|
||||
{
|
||||
var runtimeGraphGeneratorName = "RuntimeGraphGenerator";
|
||||
var runtimeGraphGeneratorProject = Path.Combine(Dirs.RepoRoot, "tools", "independent", runtimeGraphGeneratorName);
|
||||
var runtimeGraphGeneratorOutput = Path.Combine(Dirs.Output, "tools", "independent", runtimeGraphGeneratorName);
|
||||
|
||||
dotnetCli.Publish(
|
||||
"--output", runtimeGraphGeneratorOutput,
|
||||
runtimeGraphGeneratorProject).Execute().EnsureSuccessful();
|
||||
var runtimeGraphGeneratorExe = Path.Combine(runtimeGraphGeneratorOutput, $"{runtimeGraphGeneratorName}{Constants.ExeSuffix}");
|
||||
|
||||
Cmd(runtimeGraphGeneratorExe, "--project", _sharedFrameworkSourceRoot, "--deps", destinationDeps, runtimeGraphGeneratorRuntime)
|
||||
.Execute()
|
||||
.EnsureSuccessful();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Could not determine rid graph generation runtime for platform {RuntimeEnvironment.OperatingSystemPlatform}");
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyHostArtifactsToSharedFramework(string sharedFrameworkNameAndVersionRoot)
|
||||
{
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName),
|
||||
Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.DotnetHostBaseName), true);
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostBaseName),
|
||||
Path.Combine(sharedFrameworkNameAndVersionRoot, $"corehost{Constants.ExeSuffix}"), true);
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLockedDirectory, HostArtifactNames.DotnetHostFxrBaseName),
|
||||
Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.DotnetHostFxrBaseName), true);
|
||||
|
||||
// Hostpolicy should be the latest and not the locked version as it is supposed to evolve for
|
||||
// the framework and has a tight coupling with coreclr's API in the framework.
|
||||
File.Copy(
|
||||
Path.Combine(_corehostLatestDirectory, HostArtifactNames.HostPolicyBaseName),
|
||||
Path.Combine(sharedFrameworkNameAndVersionRoot, HostArtifactNames.HostPolicyBaseName), true);
|
||||
}
|
||||
|
||||
private string GenerateSharedFrameworkProject(
|
||||
string sharedFrameworkNugetVersion,
|
||||
string sharedFrameworkTemplatePath,
|
||||
string rid)
|
||||
{
|
||||
string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework");
|
||||
Utils.DeleteDirectory(sharedFrameworkProjectPath);
|
||||
CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true);
|
||||
|
||||
string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template");
|
||||
JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile);
|
||||
sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = sharedFrameworkNugetVersion;
|
||||
((JObject)sharedFrameworkProject["runtimes"]).RemoveAll();
|
||||
sharedFrameworkProject["runtimes"][rid] = new JObject();
|
||||
|
||||
string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json");
|
||||
JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath);
|
||||
|
||||
Rm(templateFile);
|
||||
|
||||
return sharedFrameworkProjectPath;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static void CleanNuGetTempCache()
|
||||
{
|
||||
// Clean NuGet Temp Cache on Linux (seeing some issues on Linux)
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && Directory.Exists("/tmp/NuGet"))
|
||||
{
|
||||
Directory.Delete("/tmp/NuGet", recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetOSName()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return "win";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
return "osx";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
// Generate a Version 5 (SHA1 Name Based) Guid from a name.
|
||||
public static Guid GenerateGuidFromName(string name)
|
||||
{
|
||||
// Any fixed GUID will do for a namespace.
|
||||
Guid namespaceId = new Guid("28F1468D-672B-489A-8E0C-7C5B3030630C");
|
||||
|
||||
using (SHA1 hasher = SHA1.Create())
|
||||
{
|
||||
var nameBytes = System.Text.Encoding.UTF8.GetBytes(name ?? string.Empty);
|
||||
var namespaceBytes = namespaceId.ToByteArray();
|
||||
|
||||
SwapGuidByteOrder(namespaceBytes);
|
||||
|
||||
var streamToHash = new byte[namespaceBytes.Length + nameBytes.Length];
|
||||
|
||||
Array.Copy(namespaceBytes, streamToHash, namespaceBytes.Length);
|
||||
Array.Copy(nameBytes, 0, streamToHash, namespaceBytes.Length, nameBytes.Length);
|
||||
|
||||
var hashResult = hasher.ComputeHash(streamToHash);
|
||||
|
||||
var res = new byte[16];
|
||||
|
||||
Array.Copy(hashResult, res, res.Length);
|
||||
|
||||
unchecked { res[6] = (byte)(0x50 | (res[6] & 0x0F)); }
|
||||
unchecked { res[8] = (byte)(0x40 | (res[8] & 0x3F)); }
|
||||
|
||||
SwapGuidByteOrder(res);
|
||||
|
||||
return new Guid(res);
|
||||
}
|
||||
}
|
||||
|
||||
// Do a byte order swap, .NET GUIDs store multi byte components in little
|
||||
// endian.
|
||||
private static void SwapGuidByteOrder(byte[] b)
|
||||
{
|
||||
Swap(b, 0, 3);
|
||||
Swap(b, 1, 2);
|
||||
Swap(b, 5, 6);
|
||||
Swap(b, 7, 8);
|
||||
}
|
||||
|
||||
private static void Swap(byte[] b, int x, int y)
|
||||
{
|
||||
byte t = b[x];
|
||||
b[x] = b[y];
|
||||
b[y] = t;
|
||||
}
|
||||
|
||||
public static void DeleteDirectory(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
File.Delete(file);
|
||||
}
|
||||
var retry = 5;
|
||||
while (retry >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(path, true);
|
||||
return;
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
if (retry == 0)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
System.Threading.Thread.Sleep(200);
|
||||
retry--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyDirectoryRecursively(string path, string destination, bool keepParentDir = false)
|
||||
{
|
||||
if (keepParentDir)
|
||||
{
|
||||
path = path.TrimEnd(Path.DirectorySeparatorChar);
|
||||
destination = Path.Combine(destination, Path.GetFileName(path));
|
||||
Directory.CreateDirectory(destination);
|
||||
}
|
||||
|
||||
foreach (var file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
string destFile = file.Replace(path, destination);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
|
||||
File.Copy(file, destFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetVersionFileContent(string commitHash, string version)
|
||||
{
|
||||
return $@"{commitHash}{Environment.NewLine}{version}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
public static string GetSharedFrameworkVersionFileContent(BuildTargetContext c)
|
||||
{
|
||||
string SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||
return $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{SharedFrameworkNugetVersion}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
public static string GetCliVersionFileContent(BuildTargetContext c)
|
||||
{
|
||||
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
||||
var version = buildVersion.NuGetVersion;
|
||||
return $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public abstract class Version
|
||||
{
|
||||
public virtual int Major { get; set; }
|
||||
public virtual int Minor { get; set; }
|
||||
public virtual int Patch { get; set; }
|
||||
public virtual int CommitCount { get; set; }
|
||||
public virtual string CommitCountString => CommitCount.ToString("000000");
|
||||
public virtual string ReleaseSuffix { get; set; }
|
||||
|
||||
public string GenerateMsiVersion()
|
||||
{
|
||||
// MSI versioning
|
||||
// Encode the CLI version to fit into the MSI versioning scheme - https://msdn.microsoft.com/en-us/library/windows/desktop/aa370859(v=vs.85).aspx
|
||||
// MSI versions are 3 part
|
||||
// major.minor.build
|
||||
// Size(bits) of each part 8 8 16
|
||||
// So we have 32 bits to encode the CLI version
|
||||
// Starting with most significant bit this how the CLI version is going to be encoded as MSI Version
|
||||
// CLI major -> 6 bits
|
||||
// CLI minor -> 6 bits
|
||||
// CLI patch -> 6 bits
|
||||
// CLI commitcount -> 14 bits
|
||||
var major = Major << 26;
|
||||
var minor = Minor << 20;
|
||||
var patch = Patch << 14;
|
||||
var msiVersionNumber = major | minor | patch | CommitCount;
|
||||
|
||||
var msiMajor = (msiVersionNumber >> 24) & 0xFF;
|
||||
var msiMinor = (msiVersionNumber >> 16) & 0xFF;
|
||||
var msiBuild = msiVersionNumber & 0xFFFF;
|
||||
|
||||
return $"{msiMajor}.{msiMinor}.{msiBuild}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class YumDependencyUtility
|
||||
{
|
||||
public static bool PackageIsInstalled(string packageName)
|
||||
{
|
||||
var result = Command.Create("yum", "list", "installed", packageName)
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.QuietBuildReporter()
|
||||
.Execute();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class VersionRepoUpdater
|
||||
{
|
||||
private static Regex s_nugetFileRegex = new Regex("^(.*?)\\.(([0-9]+\\.)?[0-9]+\\.[0-9]+(-([A-z0-9-]+))?)\\.nupkg$");
|
||||
|
||||
private string _gitHubAuthToken;
|
||||
private string _gitHubUser;
|
||||
private string _gitHubEmail;
|
||||
private string _versionsRepoOwner;
|
||||
private string _versionsRepo;
|
||||
|
||||
public VersionRepoUpdater(
|
||||
string gitHubAuthToken,
|
||||
string gitHubUser = null,
|
||||
string gitHubEmail = null,
|
||||
string versionRepoOwner = null,
|
||||
string versionsRepo = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(gitHubAuthToken))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(gitHubAuthToken));
|
||||
}
|
||||
|
||||
_gitHubAuthToken = gitHubAuthToken;
|
||||
_gitHubUser = gitHubUser ?? "dotnet-bot";
|
||||
_gitHubEmail = gitHubEmail ?? "dotnet-bot@microsoft.com";
|
||||
_versionsRepoOwner = versionRepoOwner ?? "dotnet";
|
||||
_versionsRepo = versionsRepo ?? "versions";
|
||||
}
|
||||
|
||||
public async Task UpdatePublishedVersions(string nupkgFilePath, string versionsRepoPath)
|
||||
{
|
||||
List<NuGetPackageInfo> publishedPackages = GetPackageInfo(nupkgFilePath);
|
||||
|
||||
string packageInfoFileContent = string.Join(
|
||||
Environment.NewLine,
|
||||
publishedPackages
|
||||
.OrderBy(t => t.Id)
|
||||
.Select(t => $"{t.Id} {t.Version}"));
|
||||
|
||||
string prereleaseVersion = publishedPackages
|
||||
.Where(t => !string.IsNullOrEmpty(t.Prerelease))
|
||||
.Select(t => t.Prerelease)
|
||||
.FirstOrDefault();
|
||||
|
||||
string packageInfoFilePath = $"{versionsRepoPath}_Packages.txt";
|
||||
string message = $"Adding package info to {packageInfoFilePath} for {prereleaseVersion}";
|
||||
|
||||
await UpdateGitHubFile(packageInfoFilePath, packageInfoFileContent, message);
|
||||
}
|
||||
|
||||
private static List<NuGetPackageInfo> GetPackageInfo(string nupkgFilePath)
|
||||
{
|
||||
List<NuGetPackageInfo> packages = new List<NuGetPackageInfo>();
|
||||
|
||||
foreach (string filePath in Directory.GetFiles(nupkgFilePath, "*.nupkg"))
|
||||
{
|
||||
Match match = s_nugetFileRegex.Match(Path.GetFileName(filePath));
|
||||
|
||||
packages.Add(new NuGetPackageInfo()
|
||||
{
|
||||
Id = match.Groups[1].Value,
|
||||
Version = match.Groups[2].Value,
|
||||
Prerelease = match.Groups[5].Value,
|
||||
});
|
||||
}
|
||||
|
||||
return packages;
|
||||
}
|
||||
|
||||
private async Task UpdateGitHubFile(string path, string newFileContent, string commitMessage)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");
|
||||
client.DefaultRequestHeaders.Add("Authorization", $"token {_gitHubAuthToken}");
|
||||
client.DefaultRequestHeaders.Add("User-Agent", _gitHubUser);
|
||||
|
||||
string fileUrl = $"https://api.github.com/repos/{_versionsRepoOwner}/{_versionsRepo}/contents/{path}";
|
||||
|
||||
Console.WriteLine($"Getting the 'sha' of the current contents of file '{_versionsRepoOwner}/{_versionsRepo}/{path}'");
|
||||
|
||||
string currentFile = await client.GetStringAsync(fileUrl);
|
||||
string currentSha = JObject.Parse(currentFile)["sha"].ToString();
|
||||
|
||||
Console.WriteLine($"Got 'sha' value of '{currentSha}'");
|
||||
|
||||
Console.WriteLine($"Request to update file '{_versionsRepoOwner}/{_versionsRepo}/{path}' contents to:");
|
||||
Console.WriteLine(newFileContent);
|
||||
|
||||
string updateFileBody = $@"{{
|
||||
""message"": ""{commitMessage}"",
|
||||
""committer"": {{
|
||||
""name"": ""{_gitHubUser}"",
|
||||
""email"": ""{_gitHubEmail}""
|
||||
}},
|
||||
""content"": ""{ToBase64(newFileContent)}"",
|
||||
""sha"": ""{currentSha}""
|
||||
}}";
|
||||
|
||||
Console.WriteLine("Sending request...");
|
||||
StringContent content = new StringContent(updateFileBody);
|
||||
|
||||
using (HttpResponseMessage response = await client.PutAsync(fileUrl, content))
|
||||
{
|
||||
response.EnsureSuccessStatusCode();
|
||||
Console.WriteLine("Updated the file successfully...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string ToBase64(string value)
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(value));
|
||||
}
|
||||
|
||||
private class NuGetPackageInfo
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Prerelease { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"description": "Build scripts for dotnet-cli",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.5.0-rc2-24027",
|
||||
"Microsoft.CSharp": "4.0.1-rc2-24027",
|
||||
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-24027",
|
||||
"System.Reflection.Metadata": "1.3.0-rc2-24027",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027",
|
||||
"System.Xml.XmlSerializer": "4.0.11-rc2-24027",
|
||||
"WindowsAzure.Storage": "6.2.2-preview"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
"portable-net45+win8"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.25123" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25123</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>b768bd29-12bf-4c7c-b093-03193fe244d1</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.Build</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"projects": [ "src", "test", "tools", "build_projects" ]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"dotnet": {
|
||||
"projects": "src/*/project.json;test/*/project.json;scripts/*/project.json",
|
||||
"enablePackageRestore": false
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"maintainer_name":"Microsoft",
|
||||
"maintainer_email": "dotnetcore@microsoft.com",
|
||||
|
||||
"package_name": "dotnet-host",
|
||||
"install_root": "/usr/share/dotnet",
|
||||
|
||||
"short_description": "%SHARED_HOST_BRAND_NAME%",
|
||||
"long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.",
|
||||
"homepage": "https://dotnet.github.io/core",
|
||||
|
||||
"release":{
|
||||
"package_version":"1.0.0.0",
|
||||
"package_revision":"1",
|
||||
"urgency" : "low",
|
||||
"changelog_message" : "Inital shared host."
|
||||
},
|
||||
|
||||
"control": {
|
||||
"priority":"standard",
|
||||
"section":"libs",
|
||||
"architecture":"amd64"
|
||||
},
|
||||
|
||||
"copyright": "2015 Microsoft",
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
|
||||
},
|
||||
|
||||
"package_conflicts" : [
|
||||
"dotnet",
|
||||
"dotnet-nightly"
|
||||
],
|
||||
|
||||
"symlinks": {
|
||||
"dotnet" : "/usr/bin/dotnet"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
# Debian Packaging Script
|
||||
# Currently Intended to build on ubuntu14.04
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
source "$DIR/../common/_common.sh"
|
||||
REPOROOT="$DIR/../.."
|
||||
|
||||
help(){
|
||||
echo "Usage: $0"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --input <input directory> Package the entire contents of the directory tree."
|
||||
echo " --output <output debfile> The full path to which the package will be written."
|
||||
echo " --package-name <package name> Package to identify during installation. Example - 'dotnet-sharedhost'"
|
||||
echo " --brand-name <brand name> Brand name of the package, used for 'short_description' of the deb file. Example - '.NET Core Host'"
|
||||
echo " --obj-root <object root> Root folder for intermediate objects."
|
||||
echo " --version <version> Version for the debain package."
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||
case $lowerI in
|
||||
-o|--output)
|
||||
OUTPUT_DEBIAN_FILE=$2
|
||||
shift
|
||||
;;
|
||||
-i|--input)
|
||||
REPO_BINARIES_DIR=$2
|
||||
shift
|
||||
;;
|
||||
-p|--package-name)
|
||||
SHARED_HOST_DEBIAN_PACKAGE_NAME=$2
|
||||
shift
|
||||
;;
|
||||
-b|--brand-name)
|
||||
SHARED_HOST_BRAND_NAME=$2
|
||||
shift
|
||||
;;
|
||||
--obj-root)
|
||||
OBJECT_DIR=$2
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
SHARED_HOST_DEBIAN_VERSION=$2
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
help
|
||||
;;
|
||||
-m|--manpages)
|
||||
MANPAGE_DIR=$2
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PACKAGING_ROOT="$REPOROOT/packaging/host/debian"
|
||||
PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool"
|
||||
|
||||
PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output"
|
||||
PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate"
|
||||
TEST_STAGE_DIR="$OBJECT_DIR/debian_tests"
|
||||
|
||||
execute_build(){
|
||||
create_empty_debian_layout
|
||||
copy_files_to_debian_layout
|
||||
update_debian_json
|
||||
create_debian_package
|
||||
}
|
||||
|
||||
create_empty_debian_layout(){
|
||||
header "Creating empty debian package layout"
|
||||
|
||||
rm -rf "$PACKAGE_LAYOUT_DIR"
|
||||
mkdir -p "$PACKAGE_LAYOUT_DIR"
|
||||
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/\$"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/samples"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/docs"
|
||||
}
|
||||
|
||||
copy_files_to_debian_layout(){
|
||||
header "Copying files to debian layout"
|
||||
|
||||
# Copy Built Binaries
|
||||
cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
|
||||
# Copy config file
|
||||
cp "$PACKAGING_ROOT/dotnet-sharedhost-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json"
|
||||
|
||||
# Copy Manpages
|
||||
cp -a "$MANPAGE_DIR/host/." "$PACKAGE_LAYOUT_DIR/docs"
|
||||
}
|
||||
|
||||
create_debian_package(){
|
||||
header "Packing .deb"
|
||||
|
||||
mkdir -p "$PACKAGE_OUTPUT_DIR"
|
||||
|
||||
"$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -n "$SHARED_HOST_DEBIAN_PACKAGE_NAME" -v "$SHARED_HOST_DEBIAN_VERSION"
|
||||
}
|
||||
|
||||
update_debian_json()
|
||||
{
|
||||
header "Updating debian.json file"
|
||||
sed -i "s/%SHARED_HOST_BRAND_NAME%/$SHARED_HOST_BRAND_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json
|
||||
}
|
||||
|
||||
test_debian_package(){
|
||||
header "Testing debian Shared Host package"
|
||||
|
||||
install_bats
|
||||
run_package_integrity_tests
|
||||
}
|
||||
|
||||
install_bats() {
|
||||
rm -rf $TEST_STAGE_DIR
|
||||
git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR
|
||||
}
|
||||
|
||||
run_package_integrity_tests() {
|
||||
# Set LAST_VERSION_URL to enable upgrade tests
|
||||
# export LAST_VERSION_URL="$PREVIOUS_VERSION_URL"
|
||||
|
||||
$TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats
|
||||
}
|
||||
|
||||
execute_build
|
||||
|
||||
DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb")
|
||||
|
||||
test_debian_package
|
||||
|
||||
mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE"
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"maintainer_name":"Microsoft",
|
||||
"maintainer_email": "dotnetcore@microsoft.com",
|
||||
|
||||
"package_name": "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%",
|
||||
"install_root": "/usr/share/dotnet",
|
||||
|
||||
"short_description": "%SHARED_FRAMEWORK_BRAND_NAME% %SHARED_FRAMEWORK_NUGET_NAME% %SHARED_FRAMEWORK_NUGET_VERSION%",
|
||||
"long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.",
|
||||
"homepage": "https://dotnet.github.io/core",
|
||||
|
||||
"release":{
|
||||
"package_version":"1.0.0.0",
|
||||
"package_revision":"1",
|
||||
"urgency" : "low",
|
||||
"changelog_message" : "Inital shared framework."
|
||||
},
|
||||
|
||||
"control": {
|
||||
"priority":"standard",
|
||||
"section":"libs",
|
||||
"architecture":"amd64"
|
||||
},
|
||||
|
||||
"copyright": "2015 Microsoft",
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
|
||||
},
|
||||
|
||||
"debian_dependencies":{
|
||||
"dotnet-host" : {},
|
||||
"libssl1.0.0" : {},
|
||||
"libcurl3" : {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
# Debian Packaging Script
|
||||
# Currently Intended to build on ubuntu14.04
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
source "$DIR/../common/_common.sh"
|
||||
REPOROOT="$DIR/../.."
|
||||
|
||||
help(){
|
||||
echo "Usage: $0"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --input <input directory> Package the entire contents of the directory tree."
|
||||
echo " --output <output debfile> The full path to which the package will be written."
|
||||
echo " --package-name <package name> Package to identify during installation. Example - 'dotnet-sharedframework'"
|
||||
echo " --brand-name <brand name> Brand name of the package, used for 'short_description' of the deb file. Example - '.NET Core'"
|
||||
echo " --framework-nuget-name <name> The name of the nuget package that produced this shared framework."
|
||||
echo " --framework-nuget-version <ver> The versionf of the nuget package that produced this shared framework."
|
||||
echo " --obj-root <object root> Root folder for intermediate objects."
|
||||
echo " --version <version> Version for the debain package."
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||
case $lowerI in
|
||||
-o|--output)
|
||||
OUTPUT_DEBIAN_FILE=$2
|
||||
shift
|
||||
;;
|
||||
-i|--input)
|
||||
REPO_BINARIES_DIR=$2
|
||||
shift
|
||||
;;
|
||||
-p|--package-name)
|
||||
SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME=$2
|
||||
shift
|
||||
;;
|
||||
-b|--brand-name)
|
||||
SHARED_FRAMEWORK_BRAND_NAME=$2
|
||||
shift
|
||||
;;
|
||||
--framework-nuget-name)
|
||||
SHARED_FRAMEWORK_NUGET_NAME=$2
|
||||
shift
|
||||
;;
|
||||
--framework-nuget-version)
|
||||
SHARED_FRAMEWORK_NUGET_VERSION=$2
|
||||
shift
|
||||
;;
|
||||
--obj-root)
|
||||
OBJECT_DIR=$2
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
SHARED_FRAMEWORK_DEBIAN_VERSION=$2
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
help
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PACKAGING_ROOT="$REPOROOT/packaging/sharedframework/debian"
|
||||
PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool"
|
||||
|
||||
PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output"
|
||||
PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate"
|
||||
TEST_STAGE_DIR="$OBJECT_DIR/debian_tests"
|
||||
|
||||
execute_build(){
|
||||
create_empty_debian_layout
|
||||
copy_files_to_debian_layout
|
||||
update_debian_json
|
||||
create_debian_package
|
||||
}
|
||||
|
||||
create_empty_debian_layout(){
|
||||
header "Creating empty debian package layout"
|
||||
|
||||
rm -rf "$PACKAGE_LAYOUT_DIR"
|
||||
mkdir -p "$PACKAGE_LAYOUT_DIR"
|
||||
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/\$"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/samples"
|
||||
mkdir "$PACKAGE_LAYOUT_DIR/docs"
|
||||
}
|
||||
|
||||
copy_files_to_debian_layout(){
|
||||
header "Copying files to debian layout"
|
||||
|
||||
# Copy Built Binaries
|
||||
cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root"
|
||||
|
||||
# Copy config file
|
||||
cp "$PACKAGING_ROOT/dotnet-sharedframework-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json"
|
||||
}
|
||||
|
||||
create_debian_package(){
|
||||
header "Packing .deb"
|
||||
|
||||
mkdir -p "$PACKAGE_OUTPUT_DIR"
|
||||
|
||||
"$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -n "$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME" -v "$SHARED_FRAMEWORK_DEBIAN_VERSION"
|
||||
}
|
||||
|
||||
update_debian_json()
|
||||
{
|
||||
header "Updating debian.json file"
|
||||
sed -i "s/%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%/$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json
|
||||
sed -i "s/%SHARED_FRAMEWORK_NUGET_NAME%/$SHARED_FRAMEWORK_NUGET_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json
|
||||
sed -i "s/%SHARED_FRAMEWORK_NUGET_VERSION%/$SHARED_FRAMEWORK_NUGET_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json
|
||||
sed -i "s/%SHARED_FRAMEWORK_BRAND_NAME%/$SHARED_FRAMEWORK_BRAND_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json
|
||||
}
|
||||
|
||||
test_debian_package(){
|
||||
header "Testing debian Shared Framework package"
|
||||
|
||||
install_bats
|
||||
run_package_integrity_tests
|
||||
}
|
||||
|
||||
install_bats() {
|
||||
rm -rf $TEST_STAGE_DIR
|
||||
git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR
|
||||
}
|
||||
|
||||
run_package_integrity_tests() {
|
||||
# Set LAST_VERSION_URL to enable upgrade tests
|
||||
# export LAST_VERSION_URL="$PREVIOUS_VERSION_URL"
|
||||
|
||||
$TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats
|
||||
}
|
||||
|
||||
execute_build
|
||||
|
||||
DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb")
|
||||
|
||||
test_debian_package
|
||||
|
||||
mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE"
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title styles="color:white">Congratulations! You've successfully installed .NET Core!</title>
|
||||
</head>
|
||||
<body>
|
||||
<div align="center" style="font-family: Helvetica;">
|
||||
<h1>The installation was successful.</h1>
|
||||
<p>.NET Core was successfully installed.</p>
|
||||
<h2>
|
||||
Install dependencies
|
||||
</h2>
|
||||
<p>
|
||||
In order to be able to use .NET Core on OS X, you need to install <b>OpenSSL</b> version <b>1.0.1/1.0.2</b>.
|
||||
There are many ways to install/update your libssl. Using <a href="http://www.brew.sh">Homebrew</a> is the easiest.
|
||||
You can view the instructions <a href="http://brewformulas.org/Openssl">here</a> or if you're updating, <a href="https://github.com/dotnet/coreclr/blob/63766f74c4a641a274cd2933b9b7fd7bbddef2dd/Documentation/building/osx-instructions.md#openssl">on this page</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,114 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset2 Symbol;}}
|
||||
{\colortbl ;\red0\green0\blue255;\red31\green73\blue125;}
|
||||
{\*\listtable
|
||||
{\list\listhybrid
|
||||
{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360}
|
||||
{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}
|
||||
{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 }
|
||||
{\list\listhybrid
|
||||
{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363}
|
||||
{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }}
|
||||
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}
|
||||
{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
|
||||
\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par
|
||||
|
||||
\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par
|
||||
|
||||
\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par
|
||||
{\pntext\f3\'B7\tab}supplements,\par
|
||||
{\pntext\f3\'B7\tab}Internet-based services, and\par
|
||||
{\pntext\f3\'B7\tab}support services\par
|
||||
|
||||
\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par
|
||||
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par
|
||||
|
||||
\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par
|
||||
{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\fi-357\li357\sb120\sa120\fs20 DATA. \b0 The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkId=528096.Your }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkId=528096.Your\ul0\cf0}}}}\f0\fs20 use of the software operates as your consent to these practices.\b\par
|
||||
{\listtext\f0 3.\tab}ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par
|
||||
{\pntext\f3\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par
|
||||
|
||||
\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par
|
||||
{\pntext\f3\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par
|
||||
{\pntext\f3\'B7\tab}display your valid copyright notice on your programs; and\par
|
||||
{\pntext\f3\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par
|
||||
|
||||
\pard\nowidctlpar\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par
|
||||
{\pntext\f3\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par
|
||||
{\pntext\f3\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par
|
||||
{\pntext\f3\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf2\f2\par
|
||||
{\pntext\f3\'B7\tab}\cf0\f0 others have the right to modify it.\cf2\f2\par
|
||||
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par
|
||||
{\pntext\f3\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par
|
||||
{\pntext\f3\'B7\tab}publish the software for others to copy;\par
|
||||
{\pntext\f3\'B7\tab}rent, lease or lend the software;\par
|
||||
{\pntext\f3\'B7\tab}transfer the software or this agreement to any third party; or\par
|
||||
{\pntext\f3\'B7\tab}use the software for commercial software hosting services.\par
|
||||
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par
|
||||
\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par
|
||||
\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting\ul0\cf0}}}}\f0\fs19 .\fs20\par
|
||||
\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par
|
||||
\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par
|
||||
\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par
|
||||
|
||||
\pard
|
||||
{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par
|
||||
{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par
|
||||
|
||||
\pard
|
||||
{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}}
|
||||
\nowidctlpar\fi-357\li357\sb120\sa120 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par
|
||||
{\pntext\f0 2.\tab}\b DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par
|
||||
|
||||
\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par
|
||||
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par
|
||||
|
||||
\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par
|
||||
{\pntext\f3\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par
|
||||
|
||||
\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par
|
||||
\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par
|
||||
Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par
|
||||
\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par
|
||||
\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par
|
||||
\lang9 Cette limitation concerne :\par
|
||||
|
||||
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par
|
||||
{\pntext\f3\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par
|
||||
|
||||
\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par
|
||||
\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par
|
||||
\b\fs20\lang1036\par
|
||||
}
|
||||
|