public RemoveArtifactsForm(Project project, ArtifactContext container) { this.project = project; InitializeForm(); InitializeComponent(); artifactsListView.View = View.Details; artifactContext = container; }
public AddArtifactsForm(Project project, ArtifactContext container, FileInfo pom) { this.project = project; InitializeForm(); InitializeComponent(); addArtifact.Visible = true; localListView.View = View.Details; artifactContext = container; this.pom = pom; }
public NPandaySignAssembly(Project project, ArtifactContext container, FileInfo pom) { this.project = project; this.artifactContext = container; InitializeComponent(); this.pom = pom; this.pomUtility = new PomHelperUtility(pom); this.txtBrowseAssemblySignKey.Text = pomUtility.CompilerPluginConfigurationKeyfile; }
// TODO: belongs in another utility classs public static bool downloadArtifactFromRemoteRepository(Artifact.Artifact artifact, string ext) { try { Dictionary <string, string> repos = SettingsUtil.GetSettingsRepositories(); foreach (string id in repos.Keys) { string url = repos[id]; ArtifactContext artifactContext = new ArtifactContext(); if (artifact.Version.Contains("SNAPSHOT")) { string newVersion = GetSnapshotVersion(artifact, url); if (newVersion != null) { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, artifact.Version.Replace("SNAPSHOT", newVersion), url, ext); } else { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, url, ext); } } else { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, url, ext); } if (downloadArtifact(artifact)) { return(true); } } return(false); } catch (Exception e) { log.Error("Cannot add reference of " + artifact.ArtifactId + ", an exception occurred trying to download it: " + e.Message); return(false); } }
public static void createDefaultColours() { ArtifactContext db = new ArtifactContext(); db.CardColours.Add(new CardColour() { Name = "red" }); db.CardColours.Add(new CardColour() { Name = "green" }); db.CardColours.Add(new CardColour() { Name = "blue" }); db.CardColours.Add(new CardColour() { Name = "black" }); db.SaveChanges(); }
public AbstractPomConverter(ProjectDigest projectDigest, string mainPomFile, NPanday.Model.Pom.Model parent, string groupId) { artifactContext = new ArtifactContext(); this.projectDigest = projectDigest; this.mainPomFile = mainPomFile; this.parent = parent; this.groupId = FilterID(groupId); this.version = parent != null ? parent.version : null; this.rspUtil = new RspUtility(); this.model = new NPanday.Model.Pom.Model(); // Add build Tag this.model.build = new NPanday.Model.Pom.Build(); this.missingReferences = new List <Reference>(); // TODO: this is a hack because of bad design. The things that talk to the local repository should be pulled out of here, and able to be stubbed/mocked instead if (testingArtifacts != null) { this.localArtifacts = testingArtifacts; } }
public override void Execute() { ArtifactContext artifactContext = new ArtifactContext(); FileInfo artifactFileInfo = PathUtil.GetPrivateApplicationBaseFileFor(artifactContext.GetArtifactFor(mavenProject), new FileInfo(localRepository).Directory, Directory.GetCurrentDirectory()); Console.WriteLine("Artifact Path = " + artifactFileInfo.FullName); object[] extensibilityItems = new object[2]; //Host Application ExtensibilityHostApplication hostApplication = new ExtensibilityHostApplication(); List <ItemsChoiceType> itemsChoiceTypes = new List <ItemsChoiceType>(); List <String> itemsChoiceTypeValues = new List <string>(); itemsChoiceTypes.Add(ItemsChoiceType.Name); itemsChoiceTypeValues.Add("Microsoft Visual Studio"); itemsChoiceTypes.Add(ItemsChoiceType.Version); itemsChoiceTypeValues.Add("8.0"); hostApplication.Items = itemsChoiceTypeValues.ToArray(); hostApplication.ItemsElementName = itemsChoiceTypes.ToArray(); extensibilityItems[0] = hostApplication; //Addin ExtensibilityAddin addin = new ExtensibilityAddin(); List <ItemsChoiceType1> itemNames = new List <ItemsChoiceType1>(); List <string> itemValues = new List <string>(); itemNames.Add(ItemsChoiceType1.Assembly); itemValues.Add(artifactFileInfo.FullName); itemNames.Add(ItemsChoiceType1.FullClassName); itemValues.Add(mavenProject.artifactId + ".Connect"); itemNames.Add(ItemsChoiceType1.FriendlyName); itemValues.Add(mavenProject.name); itemNames.Add(ItemsChoiceType1.Description); itemValues.Add(mavenProject.description); itemNames.Add(ItemsChoiceType1.LoadBehavior); itemValues.Add("0"); itemNames.Add(ItemsChoiceType1.CommandLineSafe); itemValues.Add("0"); itemNames.Add(ItemsChoiceType1.CommandPreload); itemValues.Add("1"); addin.Items = itemValues.ToArray(); addin.ItemsElementName = itemNames.ToArray(); extensibilityItems[1] = addin; Extensibility extensibility = new Extensibility(); extensibility.Items = extensibilityItems; //write XML XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Extensibility)); XmlTextWriter xmlWriter = new XmlTextWriter(Environment.GetEnvironmentVariable("TMP") + @"\NPandayBuild.AddIn", System.Text.Encoding.Unicode); xmlWriter.Formatting = Formatting.Indented; serializer.Serialize(xmlWriter, extensibility); }
// TODO: belongs in another utility class private static void SetReferenceFromFile(FileInfo dll, Reference reference) { Assembly asm = null; string path = string.Empty; //if (dll.Exists) if (dll.Exists) { //asm = Assembly.ReflectionOnlyLoadFrom(dll.FullName); path = dll.FullName; } else { ArtifactContext artifactContext = new ArtifactContext(); Artifact.Artifact a = artifactContext.GetArtifactRepository().GetArtifact(dll); if (a != null) { if (!a.FileInfo.Exists) { if (!a.FileInfo.Directory.Exists) { a.FileInfo.Directory.Create(); } string localRepoPath = artifactContext.GetArtifactRepository().GetLocalRepositoryPath(a, dll.Extension); if (File.Exists(localRepoPath)) { File.Copy(localRepoPath, a.FileInfo.FullName); //asm = Assembly.ReflectionOnlyLoadFrom(); path = a.FileInfo.FullName; } else { if (Reference.downloadArtifactFromRemoteRepository(a, dll.Extension, null)) { //asm = Assembly.ReflectionOnlyLoadFrom(a.FileInfo.FullName); path = a.FileInfo.FullName; } else { path = reference.getBinReference(dll.Name); if (!string.IsNullOrEmpty(path)) { File.Copy(path, a.FileInfo.FullName); } } //copy assembly to repo if not found. if (!string.IsNullOrEmpty(path) && !File.Exists(localRepoPath)) { if (!Directory.Exists(Path.GetDirectoryName(localRepoPath))) { Directory.CreateDirectory(Path.GetDirectoryName(localRepoPath)); } File.Copy(path, localRepoPath); } } } else { path = a.FileInfo.FullName; } } if (a == null || string.IsNullOrEmpty(path)) { Console.WriteLine("Cannot find or download the artifact " + dll.Name + ", project may not build properly."); return; } } bool asmNotLoaded = true; foreach (Assembly asmm in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()) { // compare the assembly name to the filename of the reference to determine if it is a match // as the location might not be set // TODO: why do we need to load the assembly? // added StringComparison.OrdinalIgnoreCase to assembly name compratison in order to avoid errors with // already loaded assemblies like nunit.framework and NUnit.Framework etc (note this can be reconsidered) if (asmm.GetName().Name.Equals(Path.GetFileNameWithoutExtension(path), StringComparison.OrdinalIgnoreCase)) { asm = asmm; asmNotLoaded = false; break; } } if (asmNotLoaded) { asm = Assembly.ReflectionOnlyLoadFrom(path); } reference.SetAssemblyInfoValues(asm.ToString()); //asm = null; }
// TODO: belongs in another utility class private static void SetReferenceFromFile(FileInfo dll, Reference reference) { string path = string.Empty; if (dll.Exists) { path = dll.FullName; } else { ArtifactContext artifactContext = new ArtifactContext(); Artifact.Artifact a = artifactContext.GetArtifactRepository().GetArtifact(dll); if (a != null) { if (!a.FileInfo.Exists) { if (!a.FileInfo.Directory.Exists) { a.FileInfo.Directory.Create(); } string localRepoPath = artifactContext.GetArtifactRepository().GetLocalRepositoryPath(a, dll.Extension); if (File.Exists(localRepoPath)) { File.Copy(localRepoPath, a.FileInfo.FullName); path = a.FileInfo.FullName; } else { if (Reference.downloadArtifactFromRemoteRepository(a, dll.Extension)) { path = a.FileInfo.FullName; } else { path = reference.getBinReference(dll.Name); if (!string.IsNullOrEmpty(path)) { File.Copy(path, a.FileInfo.FullName); } } //copy assembly to repo if not found. if (!string.IsNullOrEmpty(path) && !File.Exists(localRepoPath)) { if (!Directory.Exists(Path.GetDirectoryName(localRepoPath))) { Directory.CreateDirectory(Path.GetDirectoryName(localRepoPath)); } File.Copy(path, localRepoPath); } } } else { path = a.FileInfo.FullName; } } if (a == null || string.IsNullOrEmpty(path)) { log.Warn("Cannot find or download the artifact " + dll.Name + ", project may not build properly."); return; } } reference.SetAssemblyInfoValues(AssemblyName.GetAssemblyName(path).FullName); }
public static void createDefaultLanguages() { ArtifactContext db = new ArtifactContext(); db.Languages.Add(new Language() { iso2 = "en", Name = "english" }); db.Languages.Add(new Language() { iso2 = "es", Name = "spanish" }); db.Languages.Add(new Language() { iso2 = "de", Name = "german" }); db.Languages.Add(new Language() { iso2 = "fr", Name = "french" }); db.Languages.Add(new Language() { iso2 = "it", Name = "italian" }); db.Languages.Add(new Language() { iso2 = "ko", Name = "koreana" }); db.Languages.Add(new Language() { iso2 = "zh", Name = "schinese" }); db.Languages.Add(new Language() { iso2 = "zh2", Name = "tchinese" }); db.Languages.Add(new Language() { iso2 = "ru", Name = "russian" }); db.Languages.Add(new Language() { iso2 = "ja", Name = "japanese" }); db.Languages.Add(new Language() { iso2 = "br", Name = "brazilian" }); db.Languages.Add(new Language() { iso2 = "la", Name = "latam" }); db.Languages.Add(new Language() { iso2 = "th", Name = "thai" }); db.Languages.Add(new Language() { iso2 = "pt", Name = "portuguese" }); db.Languages.Add(new Language() { iso2 = "pl", Name = "polish" }); db.Languages.Add(new Language() { iso2 = "da", Name = "danish" }); db.Languages.Add(new Language() { iso2 = "nl", Name = "dutch" }); db.Languages.Add(new Language() { iso2 = "fi", Name = "finnish" }); db.Languages.Add(new Language() { iso2 = "no", Name = "norwegian" }); db.Languages.Add(new Language() { iso2 = "sv", Name = "swedish" }); db.Languages.Add(new Language() { iso2 = "hu", Name = "hungarian" }); db.Languages.Add(new Language() { iso2 = "cs", Name = "czech" }); db.Languages.Add(new Language() { iso2 = "ro", Name = "romanian" }); db.Languages.Add(new Language() { iso2 = "tr", Name = "turkish" }); db.Languages.Add(new Language() { iso2 = "bg", Name = "bulgarian" }); db.Languages.Add(new Language() { iso2 = "el", Name = "greek" }); db.Languages.Add(new Language() { iso2 = "uk", Name = "ukrainian" }); db.Languages.Add(new Language() { iso2 = "vi", Name = "vietnamese" }); db.SaveChanges(); }