Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Remove project cruft, create shared projects, unify naming
Browse files Browse the repository at this point in the history
All code now lives either in PCL or Shared projects. All
platform-specific projects have been placed in a Platforms
solution folder, since all they do is reference PCLs and
Shared projects.

The platform projects must be named the same for the PCL
bait&switch behavior to kick in.

Simplified how shared .props y .targets are used/imported,
moved .snk to a single place, improved internals visible to,
etc.
  • Loading branch information
kzu committed May 16, 2016
1 parent 4809d05 commit e03ffc2
Show file tree
Hide file tree
Showing 91 changed files with 526 additions and 2,163 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; EditorConfig to support per-solution formatting.
; Use the EditorConfig VS add-in to make this work.
; http://editorconfig.org/

; This is the default for the codeline.
root = true

[*]
end_of_line = CRLF

[*.{cs,txt,md}]
indent_style = tab
indent_size = 4

[*.{sln,proj,props,targets,xml,config,nuspec}]
indent_style = tab
indent_size = 4

[*.{csproj,resx}]
indent_style = space
indent_size = 2
77 changes: 0 additions & 77 deletions NuGet.Restore.targets

This file was deleted.

38 changes: 27 additions & 11 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
@echo off
rem Only need to run this the first time after clone. Subsequent builds can be just "msbuild".
rem Alternatively, this batch file can be invoked passing msbuild parameters, like: build.cmd /v:detailed /t:Rebuild
:: Optional batch file to quickly build with some defaults.
:: Alternatively, this batch file can be invoked passing msbuild parameters, like: build.cmd /v:detailed /t:Rebuild

cd %~dp0
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
PUSHD "%~dp0" >NUL

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

:: Determine if MSBuild can be located. Allows for a better error message below.
where msbuild > %TEMP%\msbuild.txt
set /p msb=<%TEMP%\msbuild.txt

IF "%msb%"=="" (
echo Please run %~n0 from a Visual Studio Developer Command Prompt.
exit /b -1
)

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST build\.nuget\nuget.exe goto restore
md build\.nuget
copy %CACHED_NUGET% build\.nuget\nuget.exe > nul
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul
.nuget\nuget.exe update -self

:restore
:: Build script packages have no version in the path, so we install them to .nuget\packages to avoid conflicts with
:: solution/project packages.
IF NOT EXIST packages.config goto run
build\.nuget\NuGet.exe install packages.config -OutputDirectory packages -ExcludeVersion
.nuget\NuGet.exe install packages.config -OutputDirectory .nuget\packages -ExcludeVersion

:run
msbuild build.proj /nologo /v:minimal %1 %2 %3 %4 %5 %6 %7 %8 %9
"%msb%" build.proj /v:normal %1 %2 %3 %4 %5 %6 %7 %8 %9

POPD >NUL
ENDLOCAL
ECHO ON
91 changes: 59 additions & 32 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,78 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="Configure" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="packages\GitInfo\build\GitInfo.targets"/>

<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<TrackFileAccess>false</TrackFileAccess>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
<Out Condition=" '$(Out)' == '' ">out</Out>
<GitInfoReportImportance>high</GitInfoReportImportance>
<CommonBuildProperties>TrackFileAccess=false;WarningLevel=0;NoWarn=1591;RunCodeAnalysis=false;Configuration=$(Configuration)</CommonBuildProperties>
</PropertyGroup>

<ItemGroup>
<!-- To build a single solution or project, just pass it as a property $(Solution) or $(Project) -->

<!-- Solutions at the root of the src directory are all built automatically unless overriden -->
<Solution Include="src\*.sln" Condition="'$(Solution)' == ''">
<AdditionalProperties>Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)</AdditionalProperties>
</Solution>

<Solution Include="$(Solution)" Condition="'$(Solution)' != ''">
<AdditionalProperties>Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)</AdditionalProperties>
</Solution>

<NuGet Include="**\*.nuspec" />
<Solution Include="src\*.sln" Condition="'$(Solution)' == ''" />
<Solution Include="$(Solution)" Condition="'$(Solution)' != ''" />
<NuSpec Include="src\**\*.nuspec" />
</ItemGroup>

<Import Project="build\build.targets" />

<Target Name="Clean">
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" Targets="Clean" />
<Exec Command="rmdir $(Out) /S /Q" ContinueOnError="true" />
<Exec Command="rmdir $(PackagesPath) /S /Q" ContinueOnError="true" />
<Exec Command="rmdir src\packages /S /Q" ContinueOnError="true" />
</Target>

<Target Name="Rebuild" DependsOnTargets="Clean;Build" />

<Target Name="Build" DependsOnTargets="GitVersion">
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" />
</Target>

<Target Name="Package" DependsOnTargets="Build">
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
<Exec Command='"$(NuGet)" Pack "%(NuSpec.Identity)" $(Args) -Properties Id=%(NuSpec.Filename);Configuration=$(Configuration) -Version $(Version) -OutputDirectory $(Out)' />
</Target>

<Target Name="Publish" DependsOnTargets="Package">
<Exec Command='$(NuGet) Push "$(Out)\%(NuSpec.Filename).$(Version).nupkg" $(NuGetPushArgs)'
StandardErrorImportance="high"
StandardOutputImportance="normal" />

<Message Text="Published new package: Id=%(NuSpec.Filename), Version=$(Version)"
Importance="high" />
</Target>

<!-- Configure and restore initial targets and packages -->
<Import Project="src\NuGet.Restore.targets" />
<PropertyGroup>
<BuildPackagesDependsOn>
GitVersion;
GitInfoReport;
NuGetVersion;
</BuildPackagesDependsOn>
<GitInfoTargets>$(PackagesPath)\GitInfo\build\GitInfo.targets</GitInfoTargets>
<PendingRestore Condition=" !Exists('$(GitInfoTargets)') ">true</PendingRestore>
</PropertyGroup>

<Target Name="NuGetVersion" DependsOnTargets="GitVersion">

<Target Name="GitVersion" />
<!-- Gets overriden by the $(GitInfoTargets) if it exists -->
<Import Project="$(GitInfoTargets)" Condition=" Exists('$(GitInfoTargets)') " />

<Target Name="Configure" DependsOnTargets="_GetNuGet;GitVersion">
<!-- We always run NuGet Install since it already checks for already-installed packages and skips them -->
<Exec Command='"$(NuGet)" Install "$(MSBuildThisFileDirectory)packages.config" -OutputDirectory "$(PackagesPath)" -ExcludeVersion' />

<!-- Errors if nuget packages were restored during the build -->
<Error Text="Required build-time NuGet packages were missing and were just restored. Please run the build again."
Condition=" '$(PendingRestore)' == 'true' And '$(target)' != 'configure' "/>

<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</Version>
</PropertyGroup>

<ItemGroup>
<NuGet>
<Version>$(Version)</Version>
</NuGet>
</ItemGroup>

<!-- Update AppVeyor build # to match the actual one being used -->
<Exec Command="appveyor UpdateBuild -Version $(Version)" Condition=" '$(APPVEYOR)' == 'true' "
ConsoleToMSBuild="true"
ContinueOnError="ErrorAndContinue" />
</Target>

</Project>
2 changes: 1 addition & 1 deletion packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitInfo" version="1.0.33-pre" targetFramework="net45" />
<package id="GitInfo" version="1.1.12" targetFramework="net45" />
</packages>
9 changes: 2 additions & 7 deletions src/Before.Hermes.sln.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

<PropertyGroup>
<RestoreDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), NuGet.Restore.targets).TrimEnd("\").TrimEnd("/"))</RestoreDir>
</PropertyGroup>

<Import Project="$(RestoreDir)\NuGet.Restore.targets" />
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="NuGet.Restore.targets" />
</Project>
62 changes: 7 additions & 55 deletions src/Client.Android/Client.Android.csproj
Original file line number Diff line number Diff line change
@@ -1,50 +1,17 @@
<?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')" />
<Import Project="..\Hermes.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C2DCD7CF-3780-4003-B4BE-DBA8DA5C6178}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>System.Net.Mqtt.Client</RootNamespace>
<AssemblyName>System.Net.Mqtt.Android</AssemblyName>
<FileAlignment>512</FileAlignment>
<AssemblyName>System.Net.Mqtt</AssemblyName>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
</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>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Hermes.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<None Include="Hermes.snk" />
</ItemGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="mscorlib" />
Expand All @@ -70,20 +37,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClientFactory.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TcpBinding.cs" />
<Compile Include="TcpChannel.cs" />
<Compile Include="TcpChannelFactory.cs" />
<Compile Include="TcpChannelProvider.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\AboutResources.txt" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Values\Strings.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Client\Client.csproj">
Expand All @@ -99,19 +56,14 @@
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\Client.Shared\Client.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\GitInfo.1.1.5\build\GitInfo.targets" Condition="Exists('..\packages\GitInfo.1.1.5\build\GitInfo.targets')" />
<Import Project="..\Hermes.targets" />
<Import Project="..\packages\GitInfo.1.1.12\build\GitInfo.targets" Condition="Exists('..\packages\GitInfo.1.1.12\build\GitInfo.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GitInfo.1.1.5\build\GitInfo.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitInfo.1.1.5\build\GitInfo.targets'))" />
</Target>
<!-- 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">
<Error Condition="!Exists('..\packages\GitInfo.1.1.12\build\GitInfo.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitInfo.1.1.12\build\GitInfo.targets'))" />
</Target>
-->
</Project>
Loading

0 comments on commit e03ffc2

Please sign in to comment.