Author: sisbell Date: Sun Feb 25 16:54:26 2007 New Revision: 511682 URL: http://svn.apache.org/viewvc?view=rev&rev=511682 Log: 'Better
Added: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/ExecutionException.cs Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs Added: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/ExecutionException.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/ExecutionException.cs?view=auto&rev=511682 ============================================================================== --- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/ExecutionException.cs (added) +++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/ExecutionException.cs Sun Feb 25 16:54:26 2007 @@ -0,0 +1,33 @@ +// +// Copyright 2006 Shane Isbell +// +// Licensed 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.Runtime.Serialization; + +namespace NMaven.Core +{ + [Serializable] + public class ExecutionException : Exception + { + public ExecutionException() : base(){ } + + public ExecutionException(String message) : base(message) { } + + public ExecutionException(String message, Exception exception) : base(message, exception) { } + + public ExecutionException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } +} Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs?view=diff&rev=511682&r1=511681&r2=511682 ============================================================================== --- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs (original) +++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs Sun Feb 25 16:54:26 2007 @@ -97,6 +97,10 @@ string baseIntermediateOutputPath, List<IProjectReference> projectReferences) { + if(model == null || sourceFileDirectory == null || projectGuid == null) + { + throw new ExecutionException("NMAVEN-000-000: Missing required parameter."); + } Engine engine = new Engine(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"); Project project = new Project(engine); @@ -178,19 +182,20 @@ private void addProjectDependencies(Project project, NMaven.Model.Model model, DirectoryInfo sourceFileDirectory) { - BuildItemGroup group = project.AddNewItemGroup(); group.AddNewItem("Reference", "System.Xml"); - - foreach(Dependency dependency in model.dependencies) { - String repoPath = Environment.GetEnvironmentVariable("HOMEDRIVE") - + Environment.GetEnvironmentVariable("HOMEPATH") - + @"\.m2\repository\" + dependency.groupId.Replace(".", "\\") - + "\\" + dependency.artifactId + "\\" + dependency.version + "\\" + dependency.artifactId + ".dll"; - BuildItem buildItem = group.AddNewItem("Reference", dependency.artifactId); - if(!dependency.GetType().Equals("gac")) buildItem.SetMetadata("HintPath", repoPath, false); + if(model.dependencies != null) + { + foreach(Dependency dependency in model.dependencies) { + String repoPath = Environment.GetEnvironmentVariable("HOMEDRIVE") + + Environment.GetEnvironmentVariable("HOMEPATH") + + @"\.m2\repository\" + dependency.groupId.Replace(".", "\\") + + "\\" + dependency.artifactId + "\\" + dependency.version + "\\" + dependency.artifactId + ".dll"; + BuildItem buildItem = group.AddNewItem("Reference", dependency.artifactId); + if(!dependency.GetType().Equals("gac")) buildItem.SetMetadata("HintPath", repoPath, false); + } } - + DirectoryInfo[] directoryInfos = sourceFileDirectory.GetDirectories(); ClassParser classParser = new ClassParser(); Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs?view=diff&rev=511682&r1=511681&r2=511682 ============================================================================== --- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs (original) +++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs Sun Feb 25 16:54:26 2007 @@ -17,12 +17,12 @@ { IProjectGenerator projectGenerator = new ProjectGeneratorImpl(); - NMaven.Model.Model model = projectGenerator.createPomModelFor(@"..\..\..\pom.xml"); + NMaven.Model.Model model = projectGenerator.createPomModelFor(@"..\..\..\NMaven.Plugin.Solution\pom.xml"); Console.WriteLine(model.artifactId); IProjectReference projectReference = projectGenerator.generateProjectFor(model, - new DirectoryInfo(@"C:\Documents and Settings\shane\nmaven-apache\SI_IDE\assemblies\NMaven.Core\src\main\csharp\"), + new DirectoryInfo(@"C:\Documents and Settings\shane\nmaven-apache\SI_IDE\assemblies\NMaven.Plugin.Solution\src\main\csharp\"), model.artifactId + "T1", null); List<IProjectReference> projectReferences = new List<IProjectReference>(); projectReferences.Add(projectReference);