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

Commit e03ffc2

Browse files
committed
Remove project cruft, create shared projects, unify naming
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.
1 parent 4809d05 commit e03ffc2

File tree

91 files changed

+526
-2163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+526
-2163
lines changed

.editorconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; EditorConfig to support per-solution formatting.
2+
; Use the EditorConfig VS add-in to make this work.
3+
; http://editorconfig.org/
4+
5+
; This is the default for the codeline.
6+
root = true
7+
8+
[*]
9+
end_of_line = CRLF
10+
11+
[*.{cs,txt,md}]
12+
indent_style = tab
13+
indent_size = 4
14+
15+
[*.{sln,proj,props,targets,xml,config,nuspec}]
16+
indent_style = tab
17+
indent_size = 4
18+
19+
[*.{csproj,resx}]
20+
indent_style = space
21+
indent_size = 2

NuGet.Restore.targets

-77
This file was deleted.

build.cmd

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

5-
cd %~dp0
4+
@ECHO OFF
5+
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
6+
PUSHD "%~dp0" >NUL
67

7-
SETLOCAL
88
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
99

10+
:: Determine if MSBuild can be located. Allows for a better error message below.
11+
where msbuild > %TEMP%\msbuild.txt
12+
set /p msb=<%TEMP%\msbuild.txt
13+
14+
IF "%msb%"=="" (
15+
echo Please run %~n0 from a Visual Studio Developer Command Prompt.
16+
exit /b -1
17+
)
18+
1019
IF EXIST %CACHED_NUGET% goto copynuget
1120
echo Downloading latest version of NuGet.exe...
1221
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
13-
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
22+
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile '%CACHED_NUGET%'"
1423

1524
:copynuget
16-
IF EXIST build\.nuget\nuget.exe goto restore
17-
md build\.nuget
18-
copy %CACHED_NUGET% build\.nuget\nuget.exe > nul
25+
IF EXIST .nuget\nuget.exe goto restore
26+
md .nuget
27+
copy %CACHED_NUGET% .nuget\nuget.exe > nul
28+
.nuget\nuget.exe update -self
1929

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

2436
:run
25-
msbuild build.proj /nologo /v:minimal %1 %2 %3 %4 %5 %6 %7 %8 %9
37+
"%msb%" build.proj /v:normal %1 %2 %3 %4 %5 %6 %7 %8 %9
38+
39+
POPD >NUL
40+
ENDLOCAL
41+
ECHO ON

build.proj

+59-32
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,78 @@
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
SOFTWARE.
2424
-->
25-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
25+
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="Configure" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2626

27-
<Import Project="packages\GitInfo\build\GitInfo.targets"/>
28-
2927
<PropertyGroup>
30-
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
31-
<TrackFileAccess>false</TrackFileAccess>
28+
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
29+
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
30+
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
31+
<Out Condition=" '$(Out)' == '' ">out</Out>
3232
<GitInfoReportImportance>high</GitInfoReportImportance>
33+
<CommonBuildProperties>TrackFileAccess=false;WarningLevel=0;NoWarn=1591;RunCodeAnalysis=false;Configuration=$(Configuration)</CommonBuildProperties>
3334
</PropertyGroup>
3435

3536
<ItemGroup>
36-
<!-- To build a single solution or project, just pass it as a property $(Solution) or $(Project) -->
37-
3837
<!-- Solutions at the root of the src directory are all built automatically unless overriden -->
39-
<Solution Include="src\*.sln" Condition="'$(Solution)' == ''">
40-
<AdditionalProperties>Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)</AdditionalProperties>
41-
</Solution>
42-
43-
<Solution Include="$(Solution)" Condition="'$(Solution)' != ''">
44-
<AdditionalProperties>Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)</AdditionalProperties>
45-
</Solution>
46-
47-
<NuGet Include="**\*.nuspec" />
38+
<Solution Include="src\*.sln" Condition="'$(Solution)' == ''" />
39+
<Solution Include="$(Solution)" Condition="'$(Solution)' != ''" />
40+
<NuSpec Include="src\**\*.nuspec" />
4841
</ItemGroup>
49-
50-
<Import Project="build\build.targets" />
5142

43+
<Target Name="Clean">
44+
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" Targets="Clean" />
45+
<Exec Command="rmdir $(Out) /S /Q" ContinueOnError="true" />
46+
<Exec Command="rmdir $(PackagesPath) /S /Q" ContinueOnError="true" />
47+
<Exec Command="rmdir src\packages /S /Q" ContinueOnError="true" />
48+
</Target>
49+
50+
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
51+
52+
<Target Name="Build" DependsOnTargets="GitVersion">
53+
<MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" />
54+
</Target>
55+
56+
<Target Name="Package" DependsOnTargets="Build">
57+
<MakeDir Directories="$(Out)" Condition=" !Exists('$(Out)') " />
58+
<Exec Command='"$(NuGet)" Pack "%(NuSpec.Identity)" $(Args) -Properties Id=%(NuSpec.Filename);Configuration=$(Configuration) -Version $(Version) -OutputDirectory $(Out)' />
59+
</Target>
60+
61+
<Target Name="Publish" DependsOnTargets="Package">
62+
<Exec Command='$(NuGet) Push "$(Out)\%(NuSpec.Filename).$(Version).nupkg" $(NuGetPushArgs)'
63+
StandardErrorImportance="high"
64+
StandardOutputImportance="normal" />
65+
66+
<Message Text="Published new package: Id=%(NuSpec.Filename), Version=$(Version)"
67+
Importance="high" />
68+
</Target>
69+
70+
<!-- Configure and restore initial targets and packages -->
71+
<Import Project="src\NuGet.Restore.targets" />
5272
<PropertyGroup>
53-
<BuildPackagesDependsOn>
54-
GitVersion;
55-
GitInfoReport;
56-
NuGetVersion;
57-
</BuildPackagesDependsOn>
73+
<GitInfoTargets>$(PackagesPath)\GitInfo\build\GitInfo.targets</GitInfoTargets>
74+
<PendingRestore Condition=" !Exists('$(GitInfoTargets)') ">true</PendingRestore>
5875
</PropertyGroup>
59-
60-
<Target Name="NuGetVersion" DependsOnTargets="GitVersion">
76+
77+
<Target Name="GitVersion" />
78+
<!-- Gets overriden by the $(GitInfoTargets) if it exists -->
79+
<Import Project="$(GitInfoTargets)" Condition=" Exists('$(GitInfoTargets)') " />
80+
81+
<Target Name="Configure" DependsOnTargets="_GetNuGet;GitVersion">
82+
<!-- We always run NuGet Install since it already checks for already-installed packages and skips them -->
83+
<Exec Command='"$(NuGet)" Install "$(MSBuildThisFileDirectory)packages.config" -OutputDirectory "$(PackagesPath)" -ExcludeVersion' />
84+
85+
<!-- Errors if nuget packages were restored during the build -->
86+
<Error Text="Required build-time NuGet packages were missing and were just restored. Please run the build again."
87+
Condition=" '$(PendingRestore)' == 'true' And '$(target)' != 'configure' "/>
88+
6189
<PropertyGroup>
6290
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</Version>
6391
</PropertyGroup>
64-
65-
<ItemGroup>
66-
<NuGet>
67-
<Version>$(Version)</Version>
68-
</NuGet>
69-
</ItemGroup>
92+
93+
<!-- Update AppVeyor build # to match the actual one being used -->
94+
<Exec Command="appveyor UpdateBuild -Version $(Version)" Condition=" '$(APPVEYOR)' == 'true' "
95+
ConsoleToMSBuild="true"
96+
ContinueOnError="ErrorAndContinue" />
7097
</Target>
71-
98+
7299
</Project>

packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="GitInfo" version="1.0.33-pre" targetFramework="net45" />
3+
<package id="GitInfo" version="1.1.12" targetFramework="net45" />
44
</packages>

src/Before.Hermes.sln.targets

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3-
4-
<PropertyGroup>
5-
<RestoreDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), NuGet.Restore.targets).TrimEnd("\").TrimEnd("/"))</RestoreDir>
6-
</PropertyGroup>
7-
8-
<Import Project="$(RestoreDir)\NuGet.Restore.targets" />
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<Import Project="NuGet.Restore.targets" />
94
</Project>
+7-55
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<Import Project="..\Hermes.props" />
35
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>8.0.30703</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
86
<ProjectGuid>{C2DCD7CF-3780-4003-B4BE-DBA8DA5C6178}</ProjectGuid>
97
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10-
<OutputType>Library</OutputType>
11-
<AppDesignerFolder>Properties</AppDesignerFolder>
128
<RootNamespace>System.Net.Mqtt.Client</RootNamespace>
13-
<AssemblyName>System.Net.Mqtt.Android</AssemblyName>
14-
<FileAlignment>512</FileAlignment>
9+
<AssemblyName>System.Net.Mqtt</AssemblyName>
1510
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
1611
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
1712
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
1813
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
19-
<NuGetPackageImportStamp>
20-
</NuGetPackageImportStamp>
21-
</PropertyGroup>
22-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
23-
<DebugSymbols>true</DebugSymbols>
24-
<DebugType>full</DebugType>
25-
<Optimize>false</Optimize>
26-
<OutputPath>bin\Debug\</OutputPath>
27-
<DefineConstants>DEBUG;TRACE</DefineConstants>
28-
<ErrorReport>prompt</ErrorReport>
29-
<WarningLevel>4</WarningLevel>
30-
</PropertyGroup>
31-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32-
<DebugType>pdbonly</DebugType>
33-
<Optimize>true</Optimize>
34-
<OutputPath>bin\Release\</OutputPath>
35-
<DefineConstants>TRACE</DefineConstants>
36-
<ErrorReport>prompt</ErrorReport>
37-
<WarningLevel>4</WarningLevel>
38-
</PropertyGroup>
39-
<PropertyGroup>
40-
<SignAssembly>true</SignAssembly>
41-
</PropertyGroup>
42-
<PropertyGroup>
43-
<AssemblyOriginatorKeyFile>Hermes.snk</AssemblyOriginatorKeyFile>
4414
</PropertyGroup>
45-
<ItemGroup>
46-
<None Include="Hermes.snk" />
47-
</ItemGroup>
4815
<ItemGroup>
4916
<Reference Include="Mono.Android" />
5017
<Reference Include="mscorlib" />
@@ -70,20 +37,10 @@
7037
<Reference Include="System.Xml" />
7138
</ItemGroup>
7239
<ItemGroup>
73-
<Compile Include="ClientFactory.cs" />
74-
<Compile Include="Resources\Resource.Designer.cs" />
7540
<Compile Include="Properties\AssemblyInfo.cs" />
76-
<Compile Include="TcpBinding.cs" />
77-
<Compile Include="TcpChannel.cs" />
78-
<Compile Include="TcpChannelFactory.cs" />
79-
<Compile Include="TcpChannelProvider.cs" />
8041
</ItemGroup>
8142
<ItemGroup>
8243
<None Include="packages.config" />
83-
<None Include="Resources\AboutResources.txt" />
84-
</ItemGroup>
85-
<ItemGroup>
86-
<AndroidResource Include="Resources\Values\Strings.xml" />
8744
</ItemGroup>
8845
<ItemGroup>
8946
<ProjectReference Include="..\Client\Client.csproj">
@@ -99,19 +56,14 @@
9956
<Name>Core</Name>
10057
</ProjectReference>
10158
</ItemGroup>
59+
<Import Project="..\Client.Shared\Client.Shared.projitems" Label="Shared" />
10260
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
103-
<Import Project="..\packages\GitInfo.1.1.5\build\GitInfo.targets" Condition="Exists('..\packages\GitInfo.1.1.5\build\GitInfo.targets')" />
61+
<Import Project="..\Hermes.targets" />
62+
<Import Project="..\packages\GitInfo.1.1.12\build\GitInfo.targets" Condition="Exists('..\packages\GitInfo.1.1.12\build\GitInfo.targets')" />
10463
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
10564
<PropertyGroup>
10665
<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>
10766
</PropertyGroup>
108-
<Error Condition="!Exists('..\packages\GitInfo.1.1.5\build\GitInfo.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitInfo.1.1.5\build\GitInfo.targets'))" />
109-
</Target>
110-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
111-
Other similar extension points exist, see Microsoft.Common.targets.
112-
<Target Name="BeforeBuild">
113-
</Target>
114-
<Target Name="AfterBuild">
67+
<Error Condition="!Exists('..\packages\GitInfo.1.1.12\build\GitInfo.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitInfo.1.1.12\build\GitInfo.targets'))" />
11568
</Target>
116-
-->
11769
</Project>

0 commit comments

Comments
 (0)