예제 #1
0
 public RemoveArtifactsForm(Project project, ArtifactContext container)
 {
     this.project = project;
     InitializeForm();
     InitializeComponent();
     artifactsListView.View = View.Details;
     artifactContext = container;
 }
예제 #2
0
        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;
        }
예제 #3
0
        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>();
            this.nonPortableReferences = new List<string>();

            // 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;
            }
        }
예제 #4
0
 public void Init(ArtifactContext artifactContext, DirectoryInfo localRepository)
 {
     this.artifactContext = artifactContext;
     this.localRepository = localRepository;
 }
        // 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);
        }
예제 #6
0
 public void Init(ArtifactContext artifactContext, DirectoryInfo localRepository)
 {
     this.artifactContext = artifactContext;
     this.localRepository = localRepository;
 }
예제 #7
0
        // 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 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);
        }