1
0
Форкнуть 0
ApplicationInsights-aspnetcore/dirs.proj

216 строки
11 KiB
Plaintext
Исходник Обычный вид История

2015-06-26 20:24:54 +03:00
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Signing.props"/>
<PropertyGroup>
<CliZipFile>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.zip</CliZipFile>
<CliToolsPath>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.latest</CliToolsPath>
<!-- Library -->
<ProjectToBuild>.\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj</ProjectToBuild>
</PropertyGroup>
<ItemGroup>
<!--<Solution Include="src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.xproj" />-->
<!-- Tests -->
<TestProject Include="test\Microsoft.ApplicationInsights.AspNetCore.Tests\ " />
<TestProject Include="test\WebApi.FunctionalTests\ " />
<TestProject Include="test\WebApi20.FunctionalTests\ " />
<TestProject Include="test\EmptyApp.FunctionalTests\ " />
<TestProject Include="test\EmptyApp20.FunctionalTests\ " />
<TestProject Include="test\MVCFramework.FunctionalTests\ " />
<TestProject Include="test\MVCFramework20.FunctionalTests\ " />
</ItemGroup>
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true" />
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
new System.Net.WebClient().DownloadFile(Address, FileName);
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="ExtractZipArchive" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OutputPath ParameterType="System.String" Required="true" />
<ArchiveFileNameAsRootFolder ParameterType="System.Boolean" Required="false" />
<Overwrite ParameterType="System.Boolean" Required="false" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Using Namespace="System.IO.Compression" />
<Code Type="Fragment" Language="cs">
<![CDATA[
foreach (var inputFilePath in InputFiles.Select(f => f.ItemSpec))
{
using (ZipArchive archive = ZipFile.OpenRead(inputFilePath))
{
string inputFileName = Path.GetFileName(inputFilePath);
if (true == ArchiveFileNameAsRootFolder && true == Overwrite)
{
DirectoryInfo archiveDirectory = new DirectoryInfo(Path.Combine(OutputPath, inputFileName));
if (true == archiveDirectory.Exists)
{
Log.LogMessage ("Archive root folder already exists, deleting path:{0}", archiveDirectory.FullName);
archiveDirectory.Delete(recursive: true);
}
}
foreach (ZipArchiveEntry entry in archive.Entries)
{
string path = ArchiveFileNameAsRootFolder
? Path.Combine(OutputPath, inputFileName, entry.FullName)
: Path.Combine(OutputPath, entry.FullName);
FileInfo fileInfo = new FileInfo(path);
DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
if (false == directoryInfo.Exists)
{
//Log.LogMessage ("Creating directory for archive entry, path:{0}", directoryInfo.FullName);
directoryInfo.Create();
}
//Log.LogMessage("Extracting entry to path:{0}", path);
entry.ExtractToFile(path, Overwrite);
}
}
}
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="InjectXmlLanguage" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Log.LogMessage("Called InjectXmlLanguage");
foreach (var inputFilePath in InputFiles.Select(f => f.ItemSpec))
{
Log.LogMessage("Fixing {0}", inputFilePath);
string filePath = inputFilePath;
if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
filePath = filePath.Substring(0, filePath.Length - 3) + "xml";
}
if (filePath.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
{
string[] files = null;
int starIndex = filePath.IndexOf('*');
if (starIndex >= 0)
{
string dir = filePath.Substring(0, starIndex);
if (string.IsNullOrEmpty(dir))
{
dir = ".";
}
string file = Path.GetFileName(filePath.Substring(starIndex));
files = Directory.GetFiles(dir, file, SearchOption.AllDirectories);
}
else
{
files = new[] { filePath };
}
foreach (string fileName in files)
{
if (File.Exists(fileName))
{
Log.LogMessage("Processing XML: {0}", fileName);
string text = File.ReadAllText(fileName);
text = text.Replace("<doc>", "<doc xml:lang=\"en\">");
File.WriteAllText(fileName, text);
}
}
}
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="CheckBuildParameters">
<Message Importance="high" Text="ComputerName: $(ComputerName)"></Message>
<Message Importance="high" Text="User: $(USERDOMAIN)\$(USERNAME)"></Message>
<Message Importance="high" Text="RunningInMicroBuild: $(RunningInMicroBuild)"></Message>
<Message Importance="high" Text="Intermediate Output Path: $(BaseIntermediateOutputPath)"></Message>
<Message Importance="high" Text="Bin Root: $(BinRoot)"></Message>
<Message Importance="high" Text="Configuration: $(Configuration)"></Message>
<Message Importance="high" Text="CLI Zip: $(CliZipFile)"></Message>
<Message Importance="high" Text="CLI Tools Path: $(CliToolsPath)"></Message>
<Message Importance="high" Text="Run Tests: $(RunTests)"></Message>
<Message Importance="high" Text="Sign Assembly: $(SignAssembly)"></Message>
</Target>
<Target Name="DownloadCLI">
<!--<DownloadFile Address="https://download.microsoft.com/download/E/7/8/E782433E-7737-4E6C-BFBF-290A0A81C3D7/dotnet-sdk-2.1.4-win-x64.zip" FileName="$(CliZipFile)" />-->
<DownloadFile Address="https://download.microsoft.com/download/1/1/5/115B762D-2B41-4AF3-9A63-92D9680B9409/dotnet-sdk-2.1.4-win-x64.zip" FileName="$(CliZipFile)" />
<ExtractZipArchive InputFiles="$(CliZipFile)" OutputPath="$(CliToolsPath)" ArchiveFileNameAsRootFolder="false" Overwrite="true" />
</Target>
<Target Name="ClearNugetCache">
<Exec Command=".\nuget.exe locals all -clear" ContinueOnError="ErrorAndStop" />
</Target>
<Target Name="Build" DependsOnTargets="CheckBuildParameters;DownloadCLI">
<Exec Command='"$(CliToolsPath)\dotnet.exe" --version' />
<Exec Command='"nuget.exe" restore' ContinueOnError="ErrorAndStop" />
<Exec Command='"$(CliToolsPath)\dotnet.exe" build $(ProjectToBuild) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
<Exec Command='"$(CliToolsPath)\dotnet.exe" build %(TestProject.Identity) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
</Target>
<Target Name="Test" AfterTargets="Build" DependsOnTargets="Build">
<Message Condition="$(RunTests) != '' And $(RunTests)" Importance="high" Text="Running tests..."></Message>
<Exec Condition="$(RunTests) != '' And $(RunTests)" Command='"$(CliToolsPath)\dotnet.exe" test -l trx' WorkingDirectory='%(TestProject.Identity)' ContinueOnError="ErrorAndContinue" />
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BinRoot)\$(Configuration)" />
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
<RemoveDir Directories="$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.latest" />
<Delete Files="$(BUILD_ARTIFACTSTAGINGDIRECTORY)\dotnet-sdk-2.1.4-win-x64.zip" />
</Target>
<Target Name="AfterBuild" AfterTargets="Test" DependsOnTargets="Test">
<ItemGroup>
<FilesToSign Include="**\Microsoft.ApplicationInsights.AspNetCore.dll">
<Authenticode Condition="'%(FilesToSign.Authenticode)' == ''">Microsoft</Authenticode>
<StrongName Condition="'%(FilesToSign.StrongName)' == ''">MsSharedLib72</StrongName>
</FilesToSign>
</ItemGroup>
<Message Importance="high" Text="Files to sign:"></Message>
<Message Importance="high" Text="--> File:%(FilesToSign.FileName)%(FilesToSign.Extension)
--> BinariesDirectory:$([System.IO.Path]::GetDirectoryName(%(FilesToSign.FullPath))) --> Authenticode:%(FilesToSign.Authenticode)"></Message>
<ItemGroup>
<DocumentationFiles Include="**\Microsoft.ApplicationInsights.AspNetCore.xml"></DocumentationFiles>
</ItemGroup>
</Target>
<Target Name="FixXmlDocumentation" AfterTargets="AfterBuild" DependsOnTargets="AfterBuild">
<InjectXmlLanguage InputFiles="@(DocumentationFiles)" />
</Target>
<Target Name="PackageNuGet" AfterTargets="SignFiles" DependsOnTargets="AfterBuild;FixXmlDocumentation;SignFiles">
<Exec Command='"$(CliToolsPath)\dotnet.exe" pack $(ProjectToBuild) -c $(Configuration)' ContinueOnError="ErrorAndStop" />
</Target>
2015-06-26 20:24:54 +03:00
</Project>