Skip to content

Commit

Permalink
Add ossbuild for build support on GitHub
Browse files Browse the repository at this point in the history
Common-RSL commit 89adfe794d9682ecff196d0d108b9229e60aa48e
  • Loading branch information
Zhenhua Yao authored and Zhenhua Yao committed Mar 28, 2018
1 parent f511640 commit 21c6f07
Show file tree
Hide file tree
Showing 14 changed files with 426 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .config/.inc/versions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<root>
<versions>
<version name="filever" value="1.2.25.0" />
</versions>
</root>
75 changes: 75 additions & 0 deletions .config/build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
***********************************************************************************************
Environment.props
This file overrides shipped msbuild settings to work well in an isolated no-install drop
Environment.Custom.props should be configured by the build environment administrators to
* Setup paths to local SDKs and Tools
* Add the necessary extensibility hooks for customization from consumers
Build environment administrators must call Environment.{cmd|ps1} from this directory to
setup the build environment properly.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<AssemblyCompany>Microsoft Corporation</AssemblyCompany>
<AssemblyDescription>Microsoft Azure%ae</AssemblyDescription>
<AssemblyCopyright>Copyright %a9 Microsoft Corporation. All rights reserved.</AssemblyCopyright>
</PropertyGroup>

<!-- Auto generate NuGet packages from projects. This is temporary stopgap solution
to help with migrations until we can get a permanant packaging system in place. -->
<PropertyGroup>
<InstallPkgLocal Condition="'$(InstallPkgLocal)'==''">false</InstallPkgLocal>
</PropertyGroup>

<!-- Turning off CLS compliance warnings/errors -->
<PropertyGroup>
<AssemblyCLSCompliant>false</AssemblyCLSCompliant>
</PropertyGroup>

<!-- Required for using Nuproj targets since we don't check in NuGet.exe -->
<PropertyGroup>
<NuProjToolPath>$(PkgNuGet_CommandLine)\tools</NuProjToolPath>
</PropertyGroup>

<!-- Add in StyleCop -->
<PropertyGroup>
<StyleCopEnabled>false</StyleCopEnabled>
<StyleCopVersion Condition="'$(StyleCopVersion)' == ''">4.3.0.8</StyleCopVersion>
</PropertyGroup>

<PropertyGroup>
<GeneratedHeadersDir>$(OutputRoot)\$(BuildType)-$(BuildArchitecture)\Headers</GeneratedHeadersDir>
</PropertyGroup>

<PropertyGroup>
<OutBinDir>$(OutputRoot)\$(BuildType)-$(BuildArchitecture)\Binaries</OutBinDir>
</PropertyGroup>

<PropertyGroup>
<TaefRedist>$(PkgTaef_amd64)\Binaries\Release\x64\TestExecution\</TaefRedist>
</PropertyGroup>

<Choose>
<When Condition="'$(OSSBUILD)' == ''">
<PropertyGroup>
<LibCmd>$(PkgVisualCpp_Corext)\bin\x64\$(_BuildArch)\lib.exe</LibCmd>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<LibCmd>lib.exe</LibCmd>
</PropertyGroup>
</Otherwise>
</Choose>

</Project>
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
objd/
obj/
ossbuild/packageList.props
/out/
.*.swp

# Visual Studio 2015 cache/options directory
.vs/
Expand Down
40 changes: 40 additions & 0 deletions ossbuild/Microsoft.CSharp.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<!-- If no override is provided, fall back on the AssemblyName (C#). -->
<OutDirSuffix Condition="'$(OutDirSuffix)' == ''">$(AssemblyName)\</OutDirSuffix>
<!-- If still not defined, fall back on TargetName (native). -->
<OutDirSuffix Condition="'$(OutDirSuffix)' ==''">$(TargetName)\</OutDirSuffix>
<!-- If still not defined, just use the name of the file -->
<OutDirSuffix Condition="'$(OutDirSuffix)' == ''">$(MSBuildProjectName)</OutDirSuffix>
<BinariesBuildTypeArchDirectory>$(OUTPUTROOT)\$(BuildType)-$(BuildArchitecture)</BinariesBuildTypeArchDirectory>
<OutDir>$(BinariesBuildTypeArchDirectory)\$(OutDirSuffix)</OutDir>
<OutputPath>$(OutDir)</OutputPath>
</PropertyGroup>

<Target Name="BeforeAllTargets" BeforeTargets="BeforeBuild">
<ItemGroup>
<AssemblyAttributes Include="AssemblyCompany"><_Parameter1>$(AssemblyCompany)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCopyright"><_Parameter1>$(AssemblyCopyright)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyDescription"><_Parameter1>$(GitRepositoryName) $(GitBranchName) commit $(VersionCommitHash) on $(BuildDate)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyFileVersion"><_Parameter1>$(BUILDNUMBER)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyInformationalVersion"><_Parameter1>$(AssemblyInformationalVersion)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyProduct"><_Parameter1>$(AssemblyProduct)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyTitle"><_Parameter1>$(AssemblyName)</_Parameter1></AssemblyAttributes>
<AssemblyAttributes Include="AssemblyVersion"><_Parameter1>$(BUILDNUMBER)</_Parameter1></AssemblyAttributes>

<!-- Standard WriteCodeFragment doesn't support boolean. So we have to work around it. -->
<codegenlines Include="[assembly: System.Runtime.InteropServices.ComVisible(false)]" />
<codegenlines Include="[assembly: System.CLSCompliant($(AssemblyCLSCompliant))]" />
</ItemGroup>
<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteCodeFragment AssemblyAttributes="@(AssemblyAttributes)"
Language="C#"
OutputFile="_asmcodegen.cs"
OutputDirectory="$(IntermediateOutputPath)">
<Output TaskParameter="OutputFile" ItemName="Compile" />
</WriteCodeFragment>
<WriteLinesToFile File="$(IntermediateOutputPath)_asmcodegen.cs" Overwrite="false" Lines="@(codegenlines)" />
</Target>
</Project>
23 changes: 23 additions & 0 deletions ossbuild/Microsoft.Cpp.Default.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
</Project>
4 changes: 4 additions & 0 deletions ossbuild/Microsoft.cpp.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
</Project>
16 changes: 16 additions & 0 deletions ossbuild/Microsoft.cpp.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<PropertyGroup>
<!-- If no override is provided, fall back on the AssemblyName (C#). -->
<OutDirSuffix Condition="'$(OutDirSuffix)' == ''">$(AssemblyName)\</OutDirSuffix>
<!-- If still not defined, fall back on TargetName (native). -->
<OutDirSuffix Condition="'$(OutDirSuffix)' ==''">$(TargetName)\</OutDirSuffix>
<!-- If still not defined, just use the name of the file -->
<OutDirSuffix Condition="'$(OutDirSuffix)' == ''">$(MSBuildProjectName)</OutDirSuffix>
<BinariesBuildTypeArchDirectory>$(OUTPUTROOT)\$(BuildType)-$(BuildArchitecture)</BinariesBuildTypeArchDirectory>
<OutDir>$(BinariesBuildTypeArchDirectory)\$(OutDirSuffix)</OutDir>
<OutputPath>$(OutDir)</OutputPath>
<TargetPath>$(OutDir)$(TargetName)$(TargetExt)</TargetPath>
</PropertyGroup>
</Project>
72 changes: 72 additions & 0 deletions ossbuild/NoTarget.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="SimpleRobocopy" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<Sources ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Using Namespace="Microsoft.Build.Framework" />
<Code Type="Fragment" Language="cs"><![CDATA[
foreach (var source in Sources)
{
var item = source.ItemSpec;
var dest = source.GetMetadata("DestinationFolder");
var isRecursive = source.GetMetadata("IsRecursive");
var noSymbols = source.GetMetadata("NoSymbols");
var dirExclude = source.GetMetadata("DirExclude");
var copySymbol = string.IsNullOrEmpty(noSymbols) || noSymbols == "true";
Func<string, bool> shouldCopy = filePath => {
var dir = Path.GetDirectoryName(filePath);
var name = Path.GetFileName(filePath);
var ext = Path.GetExtension(filePath).ToUpperInvariant();
if (!copySymbol && ext == ".PDB")
return false;
if (!string.IsNullOrEmpty(dirExclude) && Regex.IsMatch(dir, dirExclude, RegexOptions.IgnoreCase))
return false;
return true;
};
Log.LogMessage(MessageImportance.High, "Robocopy: {0} -> {1} recursive: '{2}'", item, dest, isRecursive);
if (!Directory.Exists(dest)) {
Directory.CreateDirectory(dest);
}
if (!string.IsNullOrEmpty(isRecursive) &&
string.Equals(isRecursive, "true", StringComparison.OrdinalIgnoreCase) &&
Directory.Exists(item)) {
var files = Directory.EnumerateFiles(item, "*.*", SearchOption.AllDirectories);
foreach (var f in files) {
if (!File.Exists(f)) // skip directories
continue;
var fName = f.Substring(item.Length + 1);
var dName = Path.Combine(dest, fName);
var destDir = Path.GetDirectoryName(dName);
if (!Directory.Exists(destDir))
Directory.CreateDirectory(destDir);
Log.LogMessage("Copy {0} -> {1}", f, dName);
File.Copy(f, dName, true);
}
}
else {
var destFile = Path.Combine(dest, Path.GetFileName(item));
Log.LogMessage("Copy {0} -> {1}", item, destFile);
File.Copy(item, destFile, true);
}
}
]]></Code>
</Task>
</UsingTask>

<Target Name="RobocopyFiles" AfterTargets="_PostBuild" Condition="'@(Robocopy)' != ''">
<SimpleRobocopy Sources="@(Robocopy)" Condition="'@(Robocopy)' != ''" />
</Target>
<Target Name="Build" />
<Target Name="_PostBuild" AfterTargets="Build" />
</Project>
27 changes: 27 additions & 0 deletions ossbuild/Traversal.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MsBuildAllProjects>$(MsBuildAllProjects);$(MsBuildThisFileFullPath)</MsBuildAllProjects>
<IsTraversalProject>true</IsTraversalProject>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<UnloadProjectsOnCompletion Condition="'$(UnloadProjectsOnCompletion)' == ''">false</UnloadProjectsOnCompletion>
</PropertyGroup>

<!-- This target file is only used at the repo root level -->
<Target Name="Build" Condition="'@(ProjectFile)' != ''">
<MSBuild Projects="@(ProjectFile)" Targets="Build" Properties="BuildingTraversal=$(BuildingTraversal)"
BuildInParallel="$(BuildInParallel)"
SkipNonexistentProjects="$(SkipNonexistentProjectsInTraversal)"
UnloadProjectsOnCompletion="$(UnloadProjectsOnCompletion)" />
</Target>

<!-- Copy Build and change name -->
<Target Name="Clean" Condition="'@(ProjectFile)' != ''">
<MSBuild Projects="@(ProjectFile)" Targets="Build" Properties="BuildingTraversal=$(BuildingTraversal)"
BuildInParallel="$(BuildInParallel)"
SkipNonexistentProjects="$(SkipNonexistentProjectsInTraversal)"
UnloadProjectsOnCompletion="$(UnloadProjectsOnCompletion)" />
</Target>

<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
</Project>
65 changes: 65 additions & 0 deletions ossbuild/ossbuildenv.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MsBuildAllProjects>$(MsBuildAllProjects);$(MsBuildThisFileFullPath)</MsBuildAllProjects>
</PropertyGroup>

<PropertyGroup>
<ExtendedTargetsPath>$(REPOROOT)\ossbuild</ExtendedTargetsPath>

<ObjectRoot Condition="'$(ObjectRoot)' == ''">$(OBJECT_ROOT)</ObjectRoot>
<OutputRoot Condition="'$(OutputRoot)' == ''">$(_NTTREE)</OutputRoot>

<ObjectRoot Condition="'$(ObjectRoot)' == ''">$(BaseDir)\out\obj</ObjectRoot>
<OutputRoot Condition="'$(OutputRoot)' == ''">$(BaseDir)\out\bin</OutputRoot>

<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">x64</Platform>

<DefaultBuildArchitecture Condition="'$(_defaultBuildArch)' != ''">$(_defaultBuildArch)</DefaultBuildArchitecture>
<DefaultBuildArchitecture Condition="'$(DefaultBuildArchitecture)' == ''">amd64</DefaultBuildArchitecture>
<DefaultBuildArchitecture Condition="'$(DefaultBuildArchitecture)' == 'x64'">amd64</DefaultBuildArchitecture>

<BuildArchitecture Condition="'$(_BuildArch)' != ''">$(_BuildArch)</BuildArchitecture>
<BuildArchitecture Condition="'$(BuildArchitecture)' == '' AND '$(Platform)' == 'x64'">amd64</BuildArchitecture>
<BuildArchitecture Condition="'$(BuildArchitecture)' == ''">$(DefaultBuildArchitecture)</BuildArchitecture>

<BuildType Condition="'$(Configuration)' == 'Release'">retail</BuildType>
<BuildType Condition="'$(BuildType)' == ''">debug</BuildType>

<BUILD_ALT_DIR Condition="'$(BUILD_ALT_DIR)'=='' AND '$(BuildType)'=='debug'">d</BUILD_ALT_DIR>
<ObjectDirectory Condition="'$(ObjectDirectory)' == ''">obj$(BUILD_ALT_DIR)</ObjectDirectory>
<BaseIntermediateOutputPath>$(ObjectDirectory)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(BuildArchitecture)\</IntermediateOutputPath>
<O>$(IntermediateOutputPath)</O>
<ProjectDirRelativeToBaseDir>$(MSBuildProjectDirectory.Substring($(BaseDir.Length)))</ProjectDirRelativeToBaseDir>
<OutputPath Condition="'$(OutputPath)' == ''">$(ObjectRoot)$(ProjectDirRelativeToBaseDir)\$(O)</OutputPath>
<OutDir>$(OutputPath)</OutDir>

<VanillaSfproj>true</VanillaSfproj>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|amd64' " />

<!-- Redirect to system default props -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="'$(MSBuildProjectExtension)' != '.vcxproj' and '$(MSBuildProjectExtension)' != '.nuproj'" />

<!-- Need to get all PkgXXX figured out -->
<Import Project="$(REPOROOT)\ossbuild\packageList.props" />
<Import Project="$(CONFROOT)\build.props" />

<!-- Redirect CoreXT nupkgs to standard locations -->
<PropertyGroup>
<PkgDotNetFxRefAssemblies_Corext>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2</PkgDotNetFxRefAssemblies_Corext>
<PkgMsTest_Corext>$(DevEnvDir)\PublicAssemblies</PkgMsTest_Corext>
<!-- Bug in NuProj -->
<NuGetToolPath>$(PkgNuproj)\tools</NuGetToolPath>
</PropertyGroup>

<!-- For projects depended by nuproj. CustomAfterMicrosoftCommonTargets? -->
<Import Project="$(PkgNuproj)\tools\Microsoft.Common.Nuproj.targets" />
</Project>
Loading

0 comments on commit 21c6f07

Please sign in to comment.