Exemple #1
0
    public override void ExecuteBuild()
    {
        LogInformation("************************* Analyze Third Party Libs");

        // figure out what batch/script to run
        if (UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Win64 &&
            UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac &&
            UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Linux)
        {
            throw new AutomationException("Unknown runtime platform!");
        }

        // go to the third party lib dir
        CommandUtils.PushDir(LibDir);

        // figure out what libraries to evaluate
        string LibsToEvaluateString = ParseParamValue("Libs");

        // Determine which libraries to evaluate
        List <string> LibsToEvaluate = new List <string>();

        if (string.IsNullOrEmpty(LibsToEvaluateString))
        {
            // loop over third party directories looking for the right batch files
            foreach (string Dir in Directory.EnumerateDirectories("."))
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }
        else
        {
            // just split up the param and make sure the batch file exists
            string[] Libs = LibsToEvaluateString.Split('+');
            foreach (string Dir in Libs)
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }

        // Make a list of platforms
        List <PlatformLibraryInfo> Platforms = new List <PlatformLibraryInfo>();

        Platforms.Add(new PlatformLibraryInfo("Windows", "Windows", "Win32", "Win64", "VS20"));
        Platforms.Add(new PlatformLibraryInfo("Mac", "Osx", "Mac"));
        Platforms.Add(new PlatformLibraryInfo("iOS", "IOS"));
        Platforms.Add(new PlatformLibraryInfo("Android", "Android"));
        Platforms.Add(new PlatformLibraryInfo("PS4", "PS4"));
        Platforms.Add(new PlatformLibraryInfo("XB1", "XBoxOne"));
        Platforms.Add(new PlatformLibraryInfo("Linux", "Linux"));

        Platforms.Add(new PlatformLibraryInfo("VS2013", "VS2013", "vs12"));
        Platforms.Add(new PlatformLibraryInfo("VS2015", "VS2015", "vs14"));

        List <long> LastSizes = new List <long>();

        foreach (var Platform in Platforms)
        {
            LastSizes.Add(0);
        }

        // now go through and evaluate each package
        long TotalSize = 0;

        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);

            long Size = Info.GetSize(Platforms);

            LogInformation("Library {0} is {1}", Lib, ToMegabytes(Size));

            long Total = 0;
            for (int Index = 0; Index < Platforms.Count; ++Index)
            {
                PlatformLibraryInfo Platform = Platforms[Index];
                long Growth = Platform.TotalSize - LastSizes[Index];
                LogInformation("  {0} is {1}", Platform.PlatformName, ToMegabytes(Growth));

                LastSizes[Index] = Platform.TotalSize;
                Total           += Growth;
            }
            LogInformation("  Platform neutral is probably {0} (specific sum {1})", ToMegabytes(Size - Total), ToMegabytes(Total));

            TotalSize += Size;
        }


        // Make a list of known large file types
        List <string> LargeFileExtensions = new List <string>();

        LargeFileExtensions.AddRange(new string[] { ".pdb", ".a", ".lib", ".dll", ".dylib", ".bc", ".so" });

        // Hackery, look for big files (re-traverses everything)
        LogInformation("----");
        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);
            Info.FindLargeFiles(LargeFileExtensions, 1024 * 1024);
        }

        LogInformation("----");
        foreach (var Platform in Platforms)
        {
            LogInformation("  {0} is {1} (estimate)", Platform.PlatformName, ToMegabytes(Platform.TotalSize));
        }
        LogInformation("  OVERALL is {0} (accurate)", ToMegabytes(TotalSize));

        // undo the LibDir push
        CommandUtils.PopDir();

        PrintRunTime();
    }
    public override void ExecuteBuild()
    {
        Log("************************* Analyze Third Party Libs");

        // figure out what batch/script to run
        switch (UnrealBuildTool.BuildHostPlatform.Current.Platform)
        {
            case UnrealTargetPlatform.Win64:
            case UnrealTargetPlatform.Mac:
            case UnrealTargetPlatform.Linux:
                break;
            default:
                throw new AutomationException("Unknown runtime platform!");
        }

        // go to the third party lib dir
        CommandUtils.PushDir(LibDir);

        // figure out what libraries to evaluate
        string LibsToEvaluateString = ParseParamValue("Libs");

        // Determine which libraries to evaluate
        List<string> LibsToEvaluate = new List<string>();
        if (string.IsNullOrEmpty(LibsToEvaluateString))
        {
            // loop over third party directories looking for the right batch files
            foreach (string Dir in Directory.EnumerateDirectories("."))
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }
        else
        {
            // just split up the param and make sure the batch file exists
            string[] Libs = LibsToEvaluateString.Split('+');
            foreach (string Dir in Libs)
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }

        // Make a list of platforms
        List<PlatformLibraryInfo> Platforms = new List<PlatformLibraryInfo>();
        Platforms.Add(new PlatformLibraryInfo("Windows", "Windows", "Win32", "Win64", "VS20"));
        Platforms.Add(new PlatformLibraryInfo("Mac", "Osx", "Mac"));
        Platforms.Add(new PlatformLibraryInfo("iOS", "IOS"));
        Platforms.Add(new PlatformLibraryInfo("Android", "Android"));
        Platforms.Add(new PlatformLibraryInfo("PS4", "PS4"));
        Platforms.Add(new PlatformLibraryInfo("XB1", "XBoxOne"));
        Platforms.Add(new PlatformLibraryInfo("HTML5", "HTML5"));
        Platforms.Add(new PlatformLibraryInfo("Linux", "Linux"));
        Platforms.Add(new PlatformLibraryInfo("WinRT", "WinRT"));

        Platforms.Add(new PlatformLibraryInfo("VS2012", "VS2012", "vs11"));
        Platforms.Add(new PlatformLibraryInfo("VS2013", "VS2013", "vs12"));

        List<long> LastSizes = new List<long>();
        foreach (var Platform in Platforms)
        {
            LastSizes.Add(0);
        }

        // now go through and evaluate each package
        long TotalSize = 0;
        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);

            long Size = Info.GetSize(Platforms);

            Log("Library {0} is {1}", Lib, ToMegabytes(Size));

            long Total = 0;
            for (int Index = 0; Index < Platforms.Count; ++Index)
            {
                PlatformLibraryInfo Platform = Platforms[Index];
                long Growth = Platform.TotalSize - LastSizes[Index];
                Log("  {0} is {1}", Platform.PlatformName, ToMegabytes(Growth));

                LastSizes[Index] = Platform.TotalSize;
                Total += Growth;
            }
            Log("  Platform neutral is probably {0} (specific sum {1})", ToMegabytes(Size - Total), ToMegabytes(Total));

            TotalSize += Size;
        }

        // Make a list of known large file types
        List<string> LargeFileExtensions = new List<string>();
        LargeFileExtensions.AddRange(new string[] { ".pdb", ".a", ".lib", ".dll", ".dylib", ".bc", ".so" });

        // Hackery, look for big files (re-traverses everything)
        Log("----");
        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);
            Info.FindLargeFiles(LargeFileExtensions, 1024 * 1024);
        }

        // Hackery, look for VS mixes (re-traverses everything)
        Log("----");
        long TotalShadow12 = 0;

        Log("Listing VS2012 directories that are shadowed by a VS2013 dir");
        foreach (string Lib in LibsToEvaluate)
        {
            string[] Dirs = Directory.GetDirectories(Lib, "*.*", SearchOption.AllDirectories);

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

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long Size = 0;
                DirectoryInfo DI = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

                if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = (LibDir + "/" + Dupe).Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }
        Log("OVERALL {0} of VS2012 files are shadowed by a VS2013 dir", ToMegabytes(TotalShadow12));

        Log("----");
        foreach (var Platform in Platforms)
        {
            Log("  {0} is {1} (estimate)", Platform.PlatformName, ToMegabytes(Platform.TotalSize));
        }
        Log("  OVERALL is {0} (accurate)", ToMegabytes(TotalSize));

        // undo the LibDir push
        CommandUtils.PopDir();

        Log("Listing VS2012 bin directories that are shadowed by a VS2013 dir");
        //string[] BinaryDirs
        //foreach (string Lib in BinaryDirs)
        {
            string BinDir = "Engine/Binaries";

            string[] Dirs = Directory.GetDirectories(BinDir, "*.*", SearchOption.AllDirectories);

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

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long Size = 0;
                DirectoryInfo DI = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

        //				if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = Dupe.Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }

        PrintRunTime();
    }
	public override void ExecuteBuild()
	{
		Log("************************* Analyze Third Party Libs");

		// figure out what batch/script to run
		switch (UnrealBuildTool.BuildHostPlatform.Current.Platform)
		{
			case UnrealTargetPlatform.Win64:
			case UnrealTargetPlatform.Mac:
			case UnrealTargetPlatform.Linux:
				break;
			default:
				throw new AutomationException("Unknown runtime platform!");
		}

		// go to the third party lib dir
		CommandUtils.PushDir(LibDir);

		// figure out what libraries to evaluate
		string LibsToEvaluateString = ParseParamValue("Libs");

		// Determine which libraries to evaluate
		List<string> LibsToEvaluate = new List<string>();
		if (string.IsNullOrEmpty(LibsToEvaluateString))
		{
			// loop over third party directories looking for the right batch files
			foreach (string Dir in Directory.EnumerateDirectories("."))
			{
				LibsToEvaluate.Add(Path.GetFileName(Dir));
			}
		}
		else
		{
			// just split up the param and make sure the batch file exists
			string[] Libs = LibsToEvaluateString.Split('+');
			foreach (string Dir in Libs)
			{
				LibsToEvaluate.Add(Path.GetFileName(Dir));
			}
		}

		// Make a list of platforms
		List<PlatformLibraryInfo> Platforms = new List<PlatformLibraryInfo>();
		Platforms.Add(new PlatformLibraryInfo("Windows", "Windows", "Win32", "Win64", "VS20"));
		Platforms.Add(new PlatformLibraryInfo("Mac", "Osx", "Mac"));
		Platforms.Add(new PlatformLibraryInfo("iOS", "IOS"));
		Platforms.Add(new PlatformLibraryInfo("Android", "Android"));
		Platforms.Add(new PlatformLibraryInfo("PS4", "PS4"));
		Platforms.Add(new PlatformLibraryInfo("XB1", "XBoxOne"));
		Platforms.Add(new PlatformLibraryInfo("HTML5", "HTML5"));
		Platforms.Add(new PlatformLibraryInfo("Linux", "Linux"));

		Platforms.Add(new PlatformLibraryInfo("VS2013", "VS2013", "vs12"));
		Platforms.Add(new PlatformLibraryInfo("VS2015", "VS2015", "vs14"));

		List<long> LastSizes = new List<long>();
		foreach (var Platform in Platforms)
		{
			LastSizes.Add(0);
		}

		// now go through and evaluate each package
		long TotalSize = 0;
		foreach (string Lib in LibsToEvaluate)
		{
			ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);

			long Size = Info.GetSize(Platforms);

			Log("Library {0} is {1}", Lib, ToMegabytes(Size));

			long Total = 0;
			for (int Index = 0; Index < Platforms.Count; ++Index)
			{
				PlatformLibraryInfo Platform = Platforms[Index];
				long Growth = Platform.TotalSize - LastSizes[Index];
				Log("  {0} is {1}", Platform.PlatformName, ToMegabytes(Growth));

				LastSizes[Index] = Platform.TotalSize;
				Total += Growth;
			}
			Log("  Platform neutral is probably {0} (specific sum {1})", ToMegabytes(Size - Total), ToMegabytes(Total));

			TotalSize += Size;
		}


		// Make a list of known large file types
		List<string> LargeFileExtensions = new List<string>();
		LargeFileExtensions.AddRange(new string[] { ".pdb", ".a", ".lib", ".dll", ".dylib", ".bc", ".so" });

		// Hackery, look for big files (re-traverses everything)
		Log("----");
		foreach (string Lib in LibsToEvaluate)
		{
			ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);
			Info.FindLargeFiles(LargeFileExtensions, 1024 * 1024);
		}

		Log("----");
		foreach (var Platform in Platforms)
		{
			Log("  {0} is {1} (estimate)", Platform.PlatformName, ToMegabytes(Platform.TotalSize));
		}
		Log("  OVERALL is {0} (accurate)", ToMegabytes(TotalSize));

		// undo the LibDir push
		CommandUtils.PopDir();

		PrintRunTime();
	}
Exemple #4
0
    public override void ExecuteBuild()
    {
        Log("************************* Analyze Third Party Libs");

        // figure out what batch/script to run
        switch (UnrealBuildTool.BuildHostPlatform.Current.Platform)
        {
        case UnrealTargetPlatform.Win64:
        case UnrealTargetPlatform.Mac:
        case UnrealTargetPlatform.Linux:
            break;

        default:
            throw new AutomationException("Unknown runtime platform!");
        }

        // go to the third party lib dir
        CommandUtils.PushDir(LibDir);

        // figure out what libraries to evaluate
        string LibsToEvaluateString = ParseParamValue("Libs");

        // Determine which libraries to evaluate
        List <string> LibsToEvaluate = new List <string>();

        if (string.IsNullOrEmpty(LibsToEvaluateString))
        {
            // loop over third party directories looking for the right batch files
            foreach (string Dir in Directory.EnumerateDirectories("."))
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }
        else
        {
            // just split up the param and make sure the batch file exists
            string[] Libs = LibsToEvaluateString.Split('+');
            foreach (string Dir in Libs)
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }

        // Make a list of platforms
        List <PlatformLibraryInfo> Platforms = new List <PlatformLibraryInfo>();

        Platforms.Add(new PlatformLibraryInfo("Windows", "Windows", "Win32", "Win64", "VS20"));
        Platforms.Add(new PlatformLibraryInfo("Mac", "Osx", "Mac"));
        Platforms.Add(new PlatformLibraryInfo("iOS", "IOS"));
        Platforms.Add(new PlatformLibraryInfo("Android", "Android"));
        Platforms.Add(new PlatformLibraryInfo("PS4", "PS4"));
        Platforms.Add(new PlatformLibraryInfo("XB1", "XBoxOne"));
        Platforms.Add(new PlatformLibraryInfo("HTML5", "HTML5"));
        Platforms.Add(new PlatformLibraryInfo("Linux", "Linux"));
        Platforms.Add(new PlatformLibraryInfo("WinRT", "WinRT"));

        Platforms.Add(new PlatformLibraryInfo("VS2012", "VS2012", "vs11"));
        Platforms.Add(new PlatformLibraryInfo("VS2013", "VS2013", "vs12"));

        List <long> LastSizes = new List <long>();

        foreach (var Platform in Platforms)
        {
            LastSizes.Add(0);
        }

        // now go through and evaluate each package
        long TotalSize = 0;

        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);

            long Size = Info.GetSize(Platforms);

            Log("Library {0} is {1}", Lib, ToMegabytes(Size));

            long Total = 0;
            for (int Index = 0; Index < Platforms.Count; ++Index)
            {
                PlatformLibraryInfo Platform = Platforms[Index];
                long Growth = Platform.TotalSize - LastSizes[Index];
                Log("  {0} is {1}", Platform.PlatformName, ToMegabytes(Growth));

                LastSizes[Index] = Platform.TotalSize;
                Total           += Growth;
            }
            Log("  Platform neutral is probably {0} (specific sum {1})", ToMegabytes(Size - Total), ToMegabytes(Total));

            TotalSize += Size;
        }


        // Make a list of known large file types
        List <string> LargeFileExtensions = new List <string>();

        LargeFileExtensions.AddRange(new string[] { ".pdb", ".a", ".lib", ".dll", ".dylib", ".bc", ".so" });

        // Hackery, look for big files (re-traverses everything)
        Log("----");
        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);
            Info.FindLargeFiles(LargeFileExtensions, 1024 * 1024);
        }

        // Hackery, look for VS mixes (re-traverses everything)
        Log("----");
        long TotalShadow12 = 0;

        Log("Listing VS2012 directories that are shadowed by a VS2013 dir");
        foreach (string Lib in LibsToEvaluate)
        {
            string[] Dirs = Directory.GetDirectories(Lib, "*.*", SearchOption.AllDirectories);

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

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long          Size = 0;
                DirectoryInfo DI   = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

                if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = (LibDir + "/" + Dupe).Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }
        Log("OVERALL {0} of VS2012 files are shadowed by a VS2013 dir", ToMegabytes(TotalShadow12));

        Log("----");
        foreach (var Platform in Platforms)
        {
            Log("  {0} is {1} (estimate)", Platform.PlatformName, ToMegabytes(Platform.TotalSize));
        }
        Log("  OVERALL is {0} (accurate)", ToMegabytes(TotalSize));

        // undo the LibDir push
        CommandUtils.PopDir();


        Log("Listing VS2012 bin directories that are shadowed by a VS2013 dir");
        //string[] BinaryDirs
        //foreach (string Lib in BinaryDirs)
        {
            string BinDir = "Engine/Binaries";

            string[] Dirs = Directory.GetDirectories(BinDir, "*.*", SearchOption.AllDirectories);

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

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long          Size = 0;
                DirectoryInfo DI   = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

//				if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = Dupe.Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }

        PrintRunTime();
    }