You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2012/01/02 07:11:29 UTC
svn commit: r1226358 - in
/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms:
AzurePomConverter.cs AzureWorkerPomConverter.cs
Author: brett
Date: Mon Jan 2 07:11:28 2012
New Revision: 1226358
URL: http://svn.apache.org/viewvc?rev=1226358&view=rev
Log:
[NPANDAY-480] add missing converter classes
Added:
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzurePomConverter.cs
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzureWorkerPomConverter.cs
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzurePomConverter.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzurePomConverter.cs?rev=1226358&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzurePomConverter.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzurePomConverter.cs Mon Jan 2 07:11:28 2012
@@ -0,0 +1,116 @@
+#region Apache License, Version 2.0
+//
+// 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.
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.IO;
+using NPanday.Model.Pom;
+using NPanday.ProjectImporter.Digest.Model;
+using NPanday.Utils;
+
+namespace NPanday.ProjectImporter.Converter.Algorithms
+{
+ public class AzurePomConverter : AbstractPomConverter
+ {
+
+ public AzurePomConverter(ProjectDigest projectDigest, string mainPomFile, NPanday.Model.Pom.Model parent, string groupId)
+ : base(projectDigest,mainPomFile,parent, groupId)
+ {
+ }
+
+ public override void ConvertProjectToPomModel(bool writePom, string scmTag)
+ {
+ GenerateHeader("azure-cloud-service");
+
+ //Add SCM Tag
+ if (scmTag != null && scmTag != string.Empty && Model.parent==null)
+ {
+ Scm scmHolder = new Scm();
+ scmHolder.connection = string.Format("scm:svn:{0}", scmTag);
+ scmHolder.developerConnection = string.Format("scm:svn:{0}", scmTag);
+ scmHolder.url = scmTag;
+
+ Model.scm = scmHolder;
+ }
+
+ // Add Com Reference Dependencies
+ if (projectDigest.ComReferenceList.Length > 0)
+ {
+ AddComReferenceDependency();
+ }
+
+ //Add Project WebReferences
+ AddWebReferences();
+
+ //Add EmbeddedResources maven-resgen-plugin
+ AddEmbeddedResources();
+
+ // Add Project Inter-dependencies
+ foreach (ProjectReference projectRef in projectDigest.ProjectReferences)
+ {
+ AddProjectReference(projectRef);
+ }
+
+ // Add Project Reference Dependencies
+ // override the one from the parent to add new types for Azure
+ AddProjectReferenceDependenciesToList();
+
+ AddPlugin("org.apache.npanday.plugins", "azure-maven-plugin");
+
+ if (writePom)
+ {
+ PomHelperUtility.WriteModelToPom(new FileInfo(Path.Combine(projectDigest.FullDirectoryName, "pom.xml")), Model);
+ }
+ }
+
+ private void AddProjectReference(ProjectReference projectRef)
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.artifactId = projectRef.Name;
+ dependency.groupId = !string.IsNullOrEmpty(groupId) ? groupId : projectRef.Name;
+ dependency.version = string.IsNullOrEmpty(version) ? "1.0-SNAPSHOT" : version;
+
+ dependency.type = "dotnet-library";
+ if (projectRef.ProjectReferenceDigest != null
+ && !string.IsNullOrEmpty(projectRef.ProjectReferenceDigest.OutputType))
+ {
+ dependency.type = projectRef.ProjectReferenceDigest.OutputType.ToLower();
+ }
+ if (projectRef.RoleType != null)
+ {
+ switch (projectRef.RoleType)
+ {
+ case "Web":
+ dependency.type = "msdeploy-package";
+ break;
+ case "Worker":
+ dependency.type = "dotnet-application";
+ break;
+ default:
+ Console.WriteLine("Unknown role type '" + projectRef.RoleType + "' - treating as a dotnet-library");
+ break;
+ }
+ }
+
+ AddDependency(dependency);
+ }
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzureWorkerPomConverter.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzureWorkerPomConverter.cs?rev=1226358&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzureWorkerPomConverter.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Converter/Algorithms/AzureWorkerPomConverter.cs Mon Jan 2 07:11:28 2012
@@ -0,0 +1,61 @@
+#region Apache License, Version 2.0
+//
+// 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.
+//
+#endregion
+using System.IO;
+using NPanday.Model.Pom;
+using NPanday.ProjectImporter.Digest.Model;
+using NPanday.Utils;
+using System.Collections.Generic;
+
+namespace NPanday.ProjectImporter.Converter.Algorithms
+{
+ public class AzureWorkerPomConverter : NormalPomConverter
+ {
+ public AzureWorkerPomConverter(ProjectDigest projectDigest, string mainPomFile, NPanday.Model.Pom.Model parent, string groupId)
+ : base(projectDigest, mainPomFile, parent, groupId)
+ {
+ }
+
+ public override void ConvertProjectToPomModel(bool writePom, string scmTag)
+ {
+ // just call the base, but dont write it we still need some minor adjustments for it
+ base.ConvertProjectToPomModel(false, scmTag);
+
+ List<string> goals = new List<string>();
+ goals.Add("assemble-package-files");
+ foreach (Content content in projectDigest.Contents)
+ {
+ if (content.IncludePath.Equals("app.package.config", System.StringComparison.InvariantCultureIgnoreCase))
+ {
+ goals.Add("process-app-config");
+ }
+ }
+ goals.Add("package");
+
+ Plugin plugin = AddPlugin("org.apache.npanday.plugins", "application-maven-plugin", null, false);
+ AddPluginExecution(plugin, "package-application", goals.ToArray(), null);
+
+ if (writePom)
+ {
+ PomHelperUtility.WriteModelToPom(new FileInfo(Path.GetDirectoryName(projectDigest.FullFileName) + @"\pom.xml"), Model);
+ }
+ }
+ }
+}