/// <summary>
        /// Loads project into metadata model
        /// </summary>
        /// <param name="projectPathList"></param>
        /// <returns></returns>
        Dictionary <string, SdkProjectMetadata> LoadProjectData(List <string> projectPathList)
        {
            Dictionary <string, SdkProjectMetadata> d_msbp = new Dictionary <string, SdkProjectMetadata>();
            DateTime startTime = DateTime.Now;

            foreach (string projPath in projectPathList)
            {
                SdkProjectMetadata msbp = new SdkProjectMetadata(projPath, BaseLineSdkTargetFx, BaseLineTestTargetFx);
                if (!d_msbp.ContainsKey(projPath))
                {
                    d_msbp.Add(projPath, msbp);
                }
            }
            DateTime endTime = DateTime.Now;

            TaskLogger.LogInfo(MessageImportance.Low, "Total time for loading '{0}' projects:'{1}'", d_msbp.Count.ToString(), (endTime - startTime).TotalSeconds.ToString());

            return(d_msbp);
        }
Ejemplo n.º 2
0
 internal SDKMSBTaskItem(SdkProjectMetadata sdkProjMetadata)
 {
     InternalSdkProjMD = sdkProjMetadata;
     Init();
 }
        /// <summary>
        ///
        /// </summary>
        void Categorize()
        {
            TaskLogger.LogInfo("Categorizing Projects.....");
            List <SdkProjectMetadata> sdkProjList                     = new List <SdkProjectMetadata>();
            List <SdkProjectMetadata> testProjList                    = new List <SdkProjectMetadata>();
            List <SdkProjectMetadata> unsupportedProjList             = new List <SdkProjectMetadata>();
            List <SdkProjectMetadata> testToBeRunProjList             = new List <SdkProjectMetadata>();
            List <SdkProjectMetadata> platformSpecificSkippedProjList = new List <SdkProjectMetadata>();

            List <string> searchedProjects = new List <string>();

            ProjectSearchUtility psu = null;
            Dictionary <string, SdkProjectMetadata> allProj = null;

            psu = new ProjectSearchUtility(RepositoryRootDirPath, MultipleScopes, BuildScope, FullyQualifiedBuildScopeDirPath, CmdLineExcludeScope, CmdLineIncludeScope, ProjType, ProjCat);
            psu.UseLegacyDirs = UseLegacyDirStructure;

            searchedProjects = psu.FindProjects();
            allProj          = LoadProjectData(searchedProjects);

            foreach (KeyValuePair <string, SdkProjectMetadata> kv in allProj)
            {
                SdkProjectMetadata pmd = kv.Value;

                switch (pmd.ProjectType)
                {
                    #region SDK
                case SdkProjectType.Sdk:
                {
                    if (!pmd.Fx.IsTargetFxMatch)
                    {
                        if (!pmd.Fx.IsApplicableForCurrentPlatform)
                        {
                            platformSpecificSkippedProjList.Add(pmd);
                        }
                        else
                        {
                            unsupportedProjList.Add(pmd);
                        }
                    }
                    else if (!pmd.Fx.IsApplicableForCurrentPlatform)
                    {
                        platformSpecificSkippedProjList.Add(pmd);
                    }
                    else
                    {
                        if (!pmd.ExcludeFromBuild)
                        {
                            sdkProjList.Add(pmd);
                        }
                    }

                    break;
                }
                    #endregion

                    #region Test
                case SdkProjectType.Test:
                {
                    // WE HAVE INTENTIONALLY SKIPPED CHECKING THIS PROPERTY, BASICALLY WE WILL NOT BE VERIFYING BASELINE TARGETFX FOR TEST PROJECTS
                    // IF WE EVER DECIDE TO DO IT, SIMPLY ENABLE THE BELOW CODE

                    //    if (!pmd.Fx.IsTargetFxMatch)
                    //    {
                    //        if (!pmd.Fx.IsApplicableForCurrentPlatform)
                    //        {
                    //            platformSpecificSkippedProjList.Add(pmd);
                    //        }
                    //        else
                    //        {
                    //            unsupportedProjList.Add(pmd);
                    //        }
                    //    }

                    if (!pmd.Fx.IsApplicableForCurrentPlatform)
                    {
                        platformSpecificSkippedProjList.Add(pmd);
                    }
                    else
                    {
                        if (!pmd.ExcludeFromBuild)
                        {
                            testProjList.Add(pmd);
                        }

                        if (!pmd.ExcludeFromTest)
                        {
                            testToBeRunProjList.Add(pmd);
                        }
                    }
                    break;
                }
                    #endregion
                }
            }

            SDK_Projects                    = sdkProjList.Select <SdkProjectMetadata, SDKMSBTaskItem>((item) => new SDKMSBTaskItem(item)).ToArray <SDKMSBTaskItem>();
            Test_Projects                   = testProjList.Select <SdkProjectMetadata, SDKMSBTaskItem>((item) => new SDKMSBTaskItem(item)).ToArray <SDKMSBTaskItem>();
            UnSupportedProjects             = unsupportedProjList.Select <SdkProjectMetadata, SDKMSBTaskItem>((item) => new SDKMSBTaskItem(item)).ToArray <SDKMSBTaskItem>();
            Test_ToBe_Run                   = testToBeRunProjList.Select <SdkProjectMetadata, SDKMSBTaskItem>((item) => new SDKMSBTaskItem(item)).ToArray <SDKMSBTaskItem>();
            PlatformSpecificSkippedProjects = platformSpecificSkippedProjList.Select <SdkProjectMetadata, SDKMSBTaskItem>((item) => new SDKMSBTaskItem(item)).ToArray <SDKMSBTaskItem>();
            SdkPkgReferenceList             = GetNormalizedPkgRefList();

            TaskLogger.LogInfo("SDK Project(s) found:'{0}'", SDK_Projects.Count().ToString());
            TaskLogger.LogInfo(MessageImportance.Low, SDK_Projects, "File Paths for SDK Projects");

            TaskLogger.LogInfo("Test Project(s) found:'{0}'", Test_Projects.Count().ToString());
            TaskLogger.LogInfo(MessageImportance.Low, Test_Projects, "File Paths for Test Projects");

            TaskLogger.LogInfo("Test Project(s) whose tests will be executed are:'{0}'", Test_ToBe_Run.Count().ToString());
            TaskLogger.LogInfo(MessageImportance.Low, Test_ToBe_Run, "File Paths for Test Projects whose tests will be executed");

            if (UnSupportedProjects.NotNullOrAny <SDKMSBTaskItem>())
            {
                TaskLogger.LogInfo("Project(s) whose target framework is not currently supported:'{0}'", UnSupportedProjects.Count().ToString());
                TaskLogger.LogInfo(MessageImportance.Low, UnSupportedProjects, "File Paths for Unsupported Projects");
            }

            //if (Test_ToBe_Run.NotNullOrAny<SDKMSBTaskItem>())
            //{
            //    TaskLogger.LogInfo("Test Project(s) whose tests will be executed are:'{0}'", Test_ToBe_Run.Count().ToString());
            //    TaskLogger.LogInfo(MessageImportance.Low, Test_ToBe_Run, "File Paths for Test Projects whose tests will be executed");
            //}

            if (PlatformSpecificSkippedProjects.NotNullOrAny <SDKMSBTaskItem>())
            {
                TaskLogger.LogInfo("Test Project(s) that will be skipped from building/executing tests are:'{0}'", PlatformSpecificSkippedProjects.Count().ToString());
                TaskLogger.LogInfo(MessageImportance.Low, PlatformSpecificSkippedProjects, "File Paths for Projects that will be skipped that are platform specific");
            }

            if (SdkPkgReferenceList != null)
            {
                TaskLogger.LogInfo("PackageReferences count:'{0}'", SdkPkgReferenceList.Count().ToString());
                TaskLogger.LogInfo(MessageImportance.Low, SdkPkgReferenceList, "Packages References");
            }
        }
Ejemplo n.º 4
0
 SDKMSBTaskItem(string itemSpecFullPath)
 {
     InternalSdkProjMD = new SdkProjectMetadata(itemSpecFullPath);
     Init();
 }