Author: brett Date: Mon Mar 3 00:15:11 2014 New Revision: 1573411 URL: http://svn.apache.org/r1573411 Log: [NPANDAY-612] add support for parsing VS 2013 projects
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/VS2013SolutionTest.cs incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013.sln incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Class1.cs incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ClassLibraryVS2013.csproj incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/AssemblyInfo.cs incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/pom.test incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/pom.test Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/Model/Solution.cs incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionFactory.cs incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/NPanday.ProjectImporterEngine-Test.csproj Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/Model/Solution.cs URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/Model/Solution.cs?rev=1573411&r1=1573410&r2=1573411&view=diff ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/Model/Solution.cs (original) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/Model/Solution.cs Mon Mar 3 00:15:11 2014 @@ -56,8 +56,22 @@ namespace NPanday.ProjectImporter.Parser get { return vsVersion; } set { vsVersion = value; } } - + // New property introduced in VS 2013 + string visualStudioVersion; + public string VisualStudioVersion + { + get { return visualStudioVersion; } + set { visualStudioVersion = value; } + } + + // New property introduced in VS 2013 + string minimumVisualStudioVersion; + public string MinimumVisualStudioVersion + { + get { return minimumVisualStudioVersion; } + set { minimumVisualStudioVersion = value; } + } List<Project> projects = new List<Project>(); @@ -84,6 +98,8 @@ namespace NPanday.ProjectImporter.Parser sb.AppendLine("Header: " + Header); sb.AppendLine("FormatVersion: " + FormatVersion); sb.AppendLine("VsVersion: " + VsVersion); + sb.AppendLine("VisualStudioVersion: " + VisualStudioVersion); + sb.AppendLine("MinimumVisualStudioVersion: " + MinimumVisualStudioVersion); sb.AppendLine(string.Format("\n\nProject Entries({0}):", projects.Count)); foreach (Project project in projects) @@ -148,6 +164,5 @@ namespace NPanday.ProjectImporter.Parser return sb.ToString(); } - } } Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionFactory.cs URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionFactory.cs?rev=1573411&r1=1573410&r2=1573411&view=diff ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionFactory.cs (original) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionFactory.cs Mon Mar 3 00:15:11 2014 @@ -79,9 +79,17 @@ namespace NPanday.ProjectImporter.Parser case Semantics.EOL: break; case Semantics.STRING_VALUE: + if (lexan.Current.Value.Trim().Equals("VisualStudioVersion")) + { + solution.VisualStudioVersion = GetProperty(lexan); + } + else if (lexan.Current.Value.Trim().Equals("MinimumVisualStudioVersion")) + { + solution.MinimumVisualStudioVersion = GetProperty(lexan); + } break; default: - throw new Exception("Mal-formed Solution File!"); + throw new Exception("Unknown Solution token: " + lexan.Current.Token); } } @@ -89,6 +97,21 @@ namespace NPanday.ProjectImporter.Parser return solution; } + private static string GetProperty(LexicalAnalizer lexan) + { + lexan.MoveNext(); + lexan.Expect(Semantics.EQUALS); + + lexan.MoveNext(); + lexan.Expect(Semantics.STRING_VALUE); + string propertyValue = lexan.Current.Value; + + lexan.MoveNext(); + lexan.Expect(Semantics.EOL); + + return propertyValue; + } + public static Solution GetSolution(string solutionFile) { return GetSolution(new FileInfo(solutionFile)); Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/VS2013SolutionTest.cs URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/VS2013SolutionTest.cs?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/VS2013SolutionTest.cs (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/VS2013SolutionTest.cs Mon Mar 3 00:15:11 2014 @@ -0,0 +1,53 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +using System; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; + +namespace NPanday.ProjectImporter.ImporterTests +{ + [TestFixture] + public class VS2013SolutionTest : AbstractProjectImportTest + { + public override void CheckFrameworkVersion() + { + if (Environment.Version.Major < 4) + { + Assert.Ignore("Test only runs on .NET 4.0, but is: " + Environment.Version.ToString()); + } + } + + public override string SolutionFileRelativePath + { + get { return @"ClassLibraryVS2013\ClassLibraryVS2013.sln"; } + } + + [Test] + public override void ShouldGenerateTheExpectedNumberOfPoms() + { + ProjectImporterAssertions.AssertPomCount(2, GeneratedPomFiles); + } + + public override string TestResourcePath + { + get { return @"src\test\resource\ClassLibraryVS2013 \"; } + } + } +} Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/NPanday.ProjectImporterEngine-Test.csproj URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/NPanday.ProjectImporterEngine-Test.csproj?rev=1573411&r1=1573410&r2=1573411&view=diff ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/NPanday.ProjectImporterEngine-Test.csproj (original) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/NPanday.ProjectImporterEngine-Test.csproj Mon Mar 3 00:15:11 2014 @@ -55,6 +55,7 @@ <Compile Include="ImporterTests\AzureImportOneWebRoleTest.cs" /> <Compile Include="ImporterTests\AzureImportWorkerRoleTest.cs" /> <Compile Include="ImporterTests\AzureImportMultipleRolesTest.cs" /> + <Compile Include="ImporterTests\VS2013SolutionTest.cs" /> <Compile Include="ImporterTests\PortableClassLibraryTest.cs" /> <Compile Include="ImporterTests\WpfBrowserApplicationTest.cs" /> <Compile Include="ImporterTests\WebAppWithCultureResTest.cs" /> Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013.sln URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013.sln?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013.sln (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013.sln Mon Mar 3 00:15:11 2014 @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibraryVS2013", "ClassLibraryVS2013\ClassLibraryVS2013.csproj", "{C8BC2199-CD34-4149-8329-8018C18144D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C8BC2199-CD34-4149-8329-8018C18144D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8BC2199-CD34-4149-8329-8018C18144D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8BC2199-CD34-4149-8329-8018C18144D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8BC2199-CD34-4149-8329-8018C18144D0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Class1.cs URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Class1.cs?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Class1.cs (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Class1.cs Mon Mar 3 00:15:11 2014 @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibraryVS2013 +{ + public class Class1 + { + } +} Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ClassLibraryVS2013.csproj URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ClassLibraryVS2013.csproj?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ClassLibraryVS2013.csproj (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/ClassLibraryVS2013.csproj Mon Mar 3 00:15:11 2014 @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.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>{C8BC2199-CD34-4149-8329-8018C18144D0}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ClassLibraryVS2013</RootNamespace> + <AssemblyName>ClassLibraryVS2013</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> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <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.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Class1.cs" /> + <Compile Include="Properties\AssemblyInfo.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> \ No newline at end of file Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/AssemblyInfo.cs URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/AssemblyInfo.cs?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/AssemblyInfo.cs (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/Properties/AssemblyInfo.cs Mon Mar 3 00:15:11 2014 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ClassLibraryVS2013")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ClassLibraryVS2013")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("74487720-a0a9-4476-871b-1ccc619261b7")] + +// 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")] Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/pom.test URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/pom.test?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/pom.test (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/ClassLibraryVS2013/pom.test Mon Mar 3 00:15:11 2014 @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0"> + <parent> + <artifactId>test-parent</artifactId> + <groupId>test.group</groupId> + <version>1.2.3-SNAPSHOT</version> + <relativePath>..\pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>ClassLibraryVS2013</artifactId> + <packaging>dotnet-library</packaging> + <name>test.group : ClassLibraryVS2013</name> + <build> + <sourceDirectory>./</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.npanday.plugins</groupId> + <artifactId>maven-compile-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <frameworkVersion>4.5</frameworkVersion> + <define>DEBUG;TRACE</define> + <includeSources> + <includeSource>Class1.cs</includeSource> + <includeSource>Properties\AssemblyInfo.cs</includeSource> + </includeSources> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/pom.test URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/pom.test?rev=1573411&view=auto ============================================================================== --- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/pom.test (added) +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/ClassLibraryVS2013/pom.test Mon Mar 3 00:15:11 2014 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0"> + <modelVersion>4.0.0</modelVersion> + <groupId>test.group</groupId> + <artifactId>test-parent</artifactId> + <packaging>pom</packaging> + <name>test.group : test-parent</name> + <version>1.2.3-SNAPSHOT</version> + <modules> + <module>ClassLibraryVS2013</module> + </modules> +</project>