Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
Make build more sophisticated
Browse files Browse the repository at this point in the history
Add support for dropping release bits, i.e. zip archives.
  • Loading branch information
terrajobst committed Feb 25, 2013
1 parent 37030fd commit 5340e0e
Show file tree
Hide file tree
Showing 15 changed files with 398 additions and 81 deletions.
74 changes: 1 addition & 73 deletions build.proj
@@ -1,78 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir>
<SourceDir>$(ProjectDir)src\</SourceDir>
<LibDir>$(ProjectDir)lib\</LibDir>
<ToolsDir>$(ProjectDir)tools\</ToolsDir>
</PropertyGroup>

<!--
DEFAULT SETTINGS
Those can be customized from the outside.
-->

<PropertyGroup>
<OutDir Condition="'$(OutDir)' == ''">$(ProjectDir)bin\</OutDir>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(ProjectDir)obj\</IntermediateOutputPath>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">Any CPU</Platform>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">True</BuildInParallel>
</PropertyGroup>

<!--
FORWARDING
The properties below handle forwarding of properties to the
underlying MSBuild projects.
-->

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<ProjectProperties>
Configuration=$(Configuration);
Platform=$(Platform);
OutDir=$(OutDir);
IntermediateOutputPath=$(IntermediateOutputPath);
</ProjectProperties>
</PropertyGroup>

<ItemGroup>
<ProjectFiles Include="$(SourceDir)*.sln" />
</ItemGroup>

<Target Name="RecordProjects">
<PropertyGroup>
<_MSBuildAllProjects>$(MSBuildAllProjects);@(ProjectFiles)</_MSBuildAllProjects>
<ProjectProperties>
$(ProjectProperties);
MSBuildAllProjects=$(_MSBuildAllProjects)
</ProjectProperties>
</PropertyGroup>
</Target>

<Target Name="Clean"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Clean" />
</Target>

<Target Name="Build"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Build" />
</Target>

<Target Name="Rebuild"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Rebuild" />
</Target>
<Import Project="$(MSBuildThisFileDirectory)tools\build.proj" />

</Project>
9 changes: 9 additions & 0 deletions src/Common/CommonAssemblyInfo.cs
@@ -0,0 +1,9 @@
using System.Reflection;

[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]

[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
63 changes: 63 additions & 0 deletions src/NuProj.Build/NuProj.Build.csproj
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{516B545B-D897-449F-A6BD-49D696ED264A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NuProj.Build</RootNamespace>
<AssemblyName>NuProj.Build</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Zip.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
9 changes: 9 additions & 0 deletions src/NuProj.Build/Properties/AssemblyInfo.cs
@@ -0,0 +1,9 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("NuProj.Build")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]
47 changes: 47 additions & 0 deletions src/NuProj.Build/Zip.cs
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace NuProj.Build
{
public sealed class Zip : Task
{
[Required]
public ITaskItem ZipFileName { get; set; }

[Required]
public ITaskItem[] Files { get; set; }

public override bool Execute()
{
try
{
var zipFileName = ZipFileName.ItemSpec;
var fileNames = Files.Select(f => f.ItemSpec);
CreateZipArchive(zipFileName, fileNames);

}
catch (Exception ex)
{
Log.LogErrorFromException(ex);
}

return !Log.HasLoggedErrors;
}

private static void CreateZipArchive(string zipFileName, IEnumerable<string> fileNames)
{
using (var fileStream = File.Create(zipFileName))
using (var zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create))
{
foreach (var fileName in fileNames)
zipArchive.CreateEntryFromFile(fileName, Path.GetFileName(fileName), CompressionLevel.Optimal);
}
}
}
}
3 changes: 3 additions & 0 deletions src/NuProj.Tasks/NuProj.Tasks.csproj
Expand Up @@ -41,6 +41,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="GenerateNuSpec.cs" />
<Compile Include="NuGetPack.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
8 changes: 0 additions & 8 deletions src/NuProj.Tasks/Properties/AssemblyInfo.cs
@@ -1,17 +1,9 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("NuProj.Tasks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
20 changes: 20 additions & 0 deletions src/NuProj.sln
Expand Up @@ -5,20 +5,40 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuProj.Tasks", "NuProj.Task
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NuProj.Setup", "NuProj.Setup\NuProj.Setup.wixproj", "{30DB7389-4D8A-4106-88FA-1079F2B08CD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuProj.Build", "NuProj.Build\NuProj.Build.csproj", "{516B545B-D897-449F-A6BD-49D696ED264A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Debug|Any CPU.Build.0 = Debug|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Release|Any CPU.ActiveCfg = Release|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Release|Any CPU.Build.0 = Release|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{187C3685-1EC7-4DCE-933B-8F7A43D5A481}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Debug|Any CPU.ActiveCfg = Debug|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Debug|Any CPU.Build.0 = Debug|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Debug|Mixed Platforms.Build.0 = Debug|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Release|Any CPU.ActiveCfg = Release|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Release|Any CPU.Build.0 = Release|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Release|Mixed Platforms.ActiveCfg = Release|x86
{30DB7389-4D8A-4106-88FA-1079F2B08CD6}.Release|Mixed Platforms.Build.0 = Release|x86
{516B545B-D897-449F-A6BD-49D696ED264A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Release|Any CPU.Build.0 = Release|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{516B545B-D897-449F-A6BD-49D696ED264A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
62 changes: 62 additions & 0 deletions tools/binaries.proj
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="build.props" />

<PropertyGroup>
<OutDir Condition="'$(OutDir)' == ''">$(ProjectDir)bin\</OutDir>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(ProjectDir)obj\</IntermediateOutputPath>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">Any CPU</Platform>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">True</BuildInParallel>
</PropertyGroup>

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<ProjectProperties>
Configuration=$(Configuration);
Platform=$(Platform);
OutDir=$(OutDir)raw\;
IntermediateOutputPath=$(IntermediateOutputPath)raw\;
</ProjectProperties>
</PropertyGroup>

<ItemGroup>
<ProjectFiles Include="$(SourceDir)*.sln" />
</ItemGroup>

<Target Name="RecordProjects">
<PropertyGroup>
<_MSBuildAllProjects>$(MSBuildAllProjects);@(ProjectFiles)</_MSBuildAllProjects>
<ProjectProperties>
$(ProjectProperties);
MSBuildAllProjects=$(_MSBuildAllProjects)
</ProjectProperties>
</PropertyGroup>
</Target>

<Target Name="Clean"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Clean" />
</Target>

<Target Name="Build"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Build" />
</Target>

<Target Name="Rebuild"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Rebuild" />
</Target>

</Project>
52 changes: 52 additions & 0 deletions tools/build.proj
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="build.props" />

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<ProjectProperties>
</ProjectProperties>
<BuildInParallel>False</BuildInParallel>
</PropertyGroup>

<ItemGroup>
<ProjectFiles Include="$(ToolsDir)binaries.proj" />
<ProjectFiles Include="$(ToolsDir)release.proj" />
</ItemGroup>

<Target Name="RecordProjects">
<PropertyGroup>
<_MSBuildAllProjects>$(MSBuildAllProjects);@(ProjectFiles)</_MSBuildAllProjects>
<ProjectProperties>
$(ProjectProperties);
MSBuildAllProjects=$(_MSBuildAllProjects)
</ProjectProperties>
</PropertyGroup>
</Target>

<Target Name="Clean"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Clean" />
</Target>

<Target Name="Build"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Build" />
</Target>

<Target Name="Rebuild"
DependsOnTargets="RecordProjects">
<MSBuild Projects="@(ProjectFiles)"
BuildInParallel="$(BuildInParallel)"
Properties="$(ProjectProperties)"
Targets="Rebuild" />
</Target>

</Project>

0 comments on commit 5340e0e

Please sign in to comment.