Skip to content

Commit

Permalink
Support for dotnetcore using new Visual Studio 2017 csproj format (#41)
Browse files Browse the repository at this point in the history
* dotnet core comaptibility

* Make precompiler directives work

* Use beta version of nunit adapter from nuget.org

* Enable dotnetcore in travis

* Fix dotnet version number

* * More consistent use of assembly attributes
* Target netstandard 1.6
  • Loading branch information
Jann Roder authored and sean-gilliam committed Jun 13, 2017
1 parent bec8db4 commit 2a68abd
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 204 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
language: csharp
solution: src/Hocon.sln
solution: src/Hocon.sln
dotnet: 1.0.1
mono: latest
dist: trusty
11 changes: 3 additions & 8 deletions src/Hocon.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
<<<<<<< HEAD
VisualStudioVersion = 14.0.23107.0
=======
VisualStudioVersion = 14.0.22823.1
>>>>>>> master
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Hocon", "core\Hocon\Akka.Hocon.csproj", "{4A87AD05-BEF2-4B08-BD7E-A9866D88C439}"
EndProject
Expand Down
85 changes: 22 additions & 63 deletions src/core/Hocon.Tests/Hocon.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,74 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4FFD147E-6F27-45AA-B2ED-AD2DA599C532}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Hocon.Tests</RootNamespace>
<AssemblyTitle>Hocon.Tests</AssemblyTitle>
<TargetFramework>net45</TargetFramework>
<AssemblyName>Hocon.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</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>
<PackageId>Hocon.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace>Hocon.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Reference Include="nunit.framework, Version=3.0.5813.39031, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssertionExtensions.cs" />
<Compile Include="ConfigurationSpec.cs" />
<Compile Include="HoconTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Moq" Version="4.7.9" />
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
</ItemGroup>

<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<ProjectReference Include="..\Hocon\Akka.Hocon.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Hocon\Akka.Hocon.csproj">
<Project>{4a87ad05-bef2-4b08-bd7e-a9866d88c439}</Project>
<Name>Hocon</Name>
</ProjectReference>
<Reference Include="System.Configuration" />
</ItemGroup>

<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</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>

</Project>
16 changes: 0 additions & 16 deletions src/core/Hocon.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hocon.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hocon.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
Expand All @@ -21,16 +18,3 @@

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4ffd147e-6f27-45aa-b2ed-ad2da599c532")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
98 changes: 19 additions & 79 deletions src/core/Hocon/Akka.Hocon.csproj
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,80 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{4A87AD05-BEF2-4B08-BD7E-A9866D88C439}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Akka.Configuration</RootNamespace>
<AssemblyName>Akka.Hocon</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>
</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>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\Config.cs" />
<Compile Include="Configuration\ConfigurationException.cs" />
<Compile Include="Configuration\ConfigurationFactory.cs" />
<Compile Include="Configuration\Hocon\HoconConfigurationSection.cs" />
<Compile Include="Configuration\Hocon\CDataConfigurationElement.cs" />
<Compile Include="Configuration\Hocon\HoconArray.cs" />
<Compile Include="Configuration\Hocon\HoconConfigurationElement.cs" />
<Compile Include="Configuration\Hocon\HoconLiteral.cs" />
<Compile Include="Configuration\Hocon\HoconObject.cs" />
<Compile Include="Configuration\Hocon\HoconParserException.cs" />
<Compile Include="Configuration\Hocon\HoconParser.cs" />
<Compile Include="Configuration\Hocon\HoconRoot.cs" />
<Compile Include="Configuration\Hocon\HoconSubstitution.cs" />
<Compile Include="Configuration\Hocon\HoconToken.cs" />
<Compile Include="Configuration\Hocon\HoconTokenizer.cs" />
<Compile Include="Configuration\Hocon\HoconTokenizerException.cs" />
<Compile Include="Configuration\Hocon\HoconValue.cs" />
<Compile Include="Configuration\Hocon\IHoconElement.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</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 Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.6</TargetFrameworks>
<Version>0.3.1</Version>
<Copyright>Copyright © 2013-2017 Akka.NET Team</Copyright>
<Authors>Akka.NET Team</Authors>
<PackageIconUrl>http://getakka.net/images/AkkaNetLogo.Normal.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/akkadotnet/akka.net</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</PackageLicenseUrl>
<Description>C# implementation of Typesafe's HOCON (Human-Optimized Object Configuration Notation)</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Configuration" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/core/Hocon/Configuration/ConfigurationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public ConfigurationException(string message, Exception exception): base(message
{
}

#if NET45
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationException"/> class.
/// </summary>
Expand All @@ -41,6 +42,7 @@ protected ConfigurationException(SerializationInfo info, StreamingContext contex
: base(info, context)
{
}
#endif
}
}

14 changes: 9 additions & 5 deletions src/core/Hocon/Configuration/ConfigurationFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
//-----------------------------------------------------------------------

using System;
#if NET45
using System.Configuration;
#endif
using System.Diagnostics;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -55,6 +57,7 @@ public static Config ParseString(string hocon)
return ParseString(hocon, null);
}

#if NET45
/// <summary>
/// Loads a configuration named "akka" defined in the current application's
/// configuration file, e.g. app.config or web.config.
Expand Down Expand Up @@ -84,7 +87,8 @@ public static Config Load(string sectionName)

return config;
}

#endif

/// <summary>
/// Retrieves the default configuration that Akka.NET uses
/// when no configuration has been defined.
Expand All @@ -103,7 +107,7 @@ public static Config Default()
/// <returns>The configuration defined in the current executing assembly.</returns>
internal static Config FromResource(string resourceName)
{
Assembly assembly = Assembly.GetExecutingAssembly();
Assembly assembly = typeof(ConfigurationFactory).GetTypeInfo().Assembly;

return FromResource(resourceName, assembly);
}
Expand All @@ -119,11 +123,11 @@ public static Config FromResource(string resourceName, object instanceInAssembly
{
var type = instanceInAssembly as Type;
if(type != null)
return FromResource(resourceName, type.Assembly);
return FromResource(resourceName, type.GetTypeInfo().Assembly);
var assembly = instanceInAssembly as Assembly;
if(assembly != null)
return FromResource(resourceName, assembly);
return FromResource(resourceName, instanceInAssembly.GetType().Assembly);
return FromResource(resourceName, instanceInAssembly.GetType().GetTypeInfo().Assembly);
}

/// <summary>
Expand All @@ -135,7 +139,7 @@ public static Config FromResource(string resourceName, object instanceInAssembly
/// <returns>The configuration defined in the assembly that contains the type <typeparamref name="TAssembly"/>.</returns>
public static Config FromResource<TAssembly>(string resourceName)
{
return FromResource(resourceName, typeof(TAssembly).Assembly);
return FromResource(resourceName, typeof(TAssembly).GetTypeInfo().Assembly);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET45
using System.Configuration;
using System.Xml;

Expand Down Expand Up @@ -60,3 +61,4 @@ protected override void DeserializeElement(XmlReader reader, bool serializeColle
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET45
using System.Configuration;

namespace Akka.Configuration.Hocon
Expand Down Expand Up @@ -41,4 +42,4 @@ public string Content
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET45
using System.Configuration;

namespace Akka.Configuration.Hocon
Expand Down Expand Up @@ -63,4 +64,5 @@ public HoconConfigurationElement Hocon
set { base[ConfigurationPropertyName] = value; }
}
}
}
}
#endif
2 changes: 1 addition & 1 deletion src/core/Hocon/Configuration/Hocon/HoconTokenizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ private string PullEscapeSequence()
case 'u':
string hex = "0x" + Take(4);
int j = Convert.ToInt32(hex, 16);
return ((char) j).ToString(CultureInfo.InvariantCulture);
return ((char) j).ToString();
default:
throw new HoconTokenizerException(string.Format("Unknown escape code `{0}` {1}", escaped,GetHelpTextAtIndex(start)));
}
Expand Down
Loading

0 comments on commit 2a68abd

Please sign in to comment.