public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
 {
     if (Binary.Config.Type == UEBuildBinaryType.DynamicLinkLibrary)
     {
         Receipt.AddBuildProduct(Path.Combine(Binary.Config.IntermediateDirectory, Path.GetFileNameWithoutExtension(Binary.Config.OutputFilePath) + ".lib"), BuildProductType.ImportLibrary);
     }
 }
Exemple #2
0
        /// <summary>
        /// Checks if all the files in a receipt have the same version
        /// </summary>
        /// <returns>
        /// True if all the files are valid.
        /// </returns>
        static bool CheckDynamicLibaryVersionsMatch(BuildReceipt Receipt)
        {
            List <Tuple <string, int> > BinaryVersions = new List <Tuple <string, int> >();

            foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
            {
                if (BuildProduct.Type == BuildProductType.DynamicLibrary)
                {
                    int Version = BuildHostPlatform.Current.GetDllApiVersion(BuildProduct.Path);
                    BinaryVersions.Add(new Tuple <string, int>(BuildProduct.Path, Version));
                }
            }

            bool bMatch = true;

            if (BinaryVersions.Count > 0 && !BinaryVersions.All(x => x.Item2 == BinaryVersions[0].Item2))
            {
                Log.TraceWarning("Detected mismatch in binary versions:");
                foreach (Tuple <string, int> BinaryVersion in BinaryVersions)
                {
                    Log.TraceWarning("  {0} has API version {1}", BinaryVersion.Item1, BinaryVersion.Item2);
                    File.Delete(BinaryVersion.Item1);
                }
                bMatch = false;
            }
            return(bMatch);
        }
 public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
 {
     // we need to include the generated .mem and .symbols file.
     if (Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
     {
         Receipt.AddBuildProduct(Binary.Config.OutputFilePath + ".mem", BuildProductType.RequiredResource);
         Receipt.AddBuildProduct(Binary.Config.OutputFilePath + ".symbols", BuildProductType.RequiredResource);
     }
 }
Exemple #4
0
 public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
 {
     // we need to include the generated .mem and .symbols file.
     if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
     {
         Receipt.AddBuildProduct(Binary.Config.OutputFilePath + ".mem", BuildProductType.RequiredResource);
         Receipt.AddBuildProduct(Binary.Config.OutputFilePath + ".symbols", BuildProductType.RequiredResource);
     }
 }
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="InOther">Receipt to copy from</param>
 public BuildReceipt(BuildReceipt Other)
 {
     foreach (BuildProduct OtherBuildProduct in Other.BuildProducts)
     {
         BuildProducts.Add(new BuildProduct(OtherBuildProduct));
     }
     foreach (RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
     {
         RuntimeDependencies.Add(new RuntimeDependency(OtherRuntimeDependency));
     }
 }
Exemple #6
0
 public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
 {
     // the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest)
     if (Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
     {
         foreach (string BinaryPath in Binary.Config.OutputFilePaths)
         {
             string ApkFile = Path.ChangeExtension(BinaryPath, ".apk");
             Receipt.AddBuildProduct(ApkFile, BuildProductType.Executable);
         }
     }
 }
Exemple #7
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="InOther">Receipt to copy from</param>
 public BuildReceipt(BuildReceipt Other)
 {
     foreach (BuildProduct OtherBuildProduct in Other.BuildProducts)
     {
         BuildProducts.Add(new BuildProduct(OtherBuildProduct));
     }
     foreach (RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
     {
         RuntimeDependencies.Add(new RuntimeDependency(OtherRuntimeDependency));
     }
     AdditionalProperties = new List <ReceiptProperty>(Other.AdditionalProperties);
 }
 /// <summary>
 /// Merges another receipt to this one.
 /// </summary>
 /// <param name="Other">Receipt which should be merged</param>
 public void Merge(BuildReceipt Other)
 {
     foreach (BuildProduct OtherBuildProduct in Other.BuildProducts)
     {
         BuildProducts.Add(OtherBuildProduct);
     }
     foreach (RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
     {
         if (!RuntimeDependencies.Any(x => x.Path == OtherRuntimeDependency.Path && x.StagePath == OtherRuntimeDependency.StagePath))
         {
             RuntimeDependencies.Add(OtherRuntimeDependency);
         }
     }
 }
Exemple #9
0
        /// <summary>
        /// Overrides base class to add module runtime dependencies to the build receipt.
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        public override BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = base.MakeReceipt(ToolChain);

            // Set the IsPrecompiled flag on all the build products if we're not actually building this binary
            if (!Config.bAllowCompilation)
            {
                foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
                {
                    BuildProduct.IsPrecompiled = true;
                }
            }

            // Add the compiled resource file if we're building a static library containing the launch module on Windows
            if (Config.Type == UEBuildBinaryType.StaticLibrary && ModuleNames.Contains("Launch") && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64))
            {
                string ResourceFilePath = Path.Combine(Config.IntermediateDirectory, "Launch", "PCLaunch.rc.res");
                Receipt.AddBuildProduct(ResourceFilePath, BuildProductType.StaticLibrary);
            }

            // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules
            Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>();
            List <UEBuildModule> OrderedModules = new List <UEBuildModule>();

            foreach (string ModuleName in ModuleNames)
            {
                UEBuildModule Module = Target.GetModuleByName(ModuleName);
                foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies)
                {
                    Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                }
                Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true);
            }

            // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it.
            foreach (UEBuildModule OrderedModule in OrderedModules)
            {
                UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule;
                if (ExternalModule != null)
                {
                    foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies)
                    {
                        Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                    }
                }
            }
            return(Receipt);
        }
Exemple #10
0
        /// <summary>
        /// Checks if all the files in a receipt are present and that all the DLLs are at the same version
        /// </summary>
        /// <returns>
        /// True if all the files are valid.
        /// </returns>
        static bool CheckBinariesExist(BuildReceipt Receipt)
        {
            bool bExist = true;

            foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
            {
                if (BuildProduct.Type == BuildProductType.Executable || BuildProduct.Type == BuildProductType.DynamicLibrary)
                {
                    if (!File.Exists(BuildProduct.Path))
                    {
                        Log.TraceWarning("Missing binary: {0}", BuildProduct.Path);
                        bExist = false;
                    }
                }
            }
            return(bExist);
        }
Exemple #11
0
        /// <summary>
        /// Checks if all the files in a receipt are present and that all the DLLs are at the same version
        /// </summary>
        /// <returns>
        /// True if all the files are valid.
        /// </returns>
        static DateTime GetTimestampFromBinaries(BuildReceipt Receipt)
        {
            DateTime LatestWriteTime = DateTime.MinValue;

            foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
            {
                if (BuildProduct.Type == BuildProductType.Executable || BuildProduct.Type == BuildProductType.DynamicLibrary)
                {
                    DateTime WriteTime = File.GetLastWriteTime(BuildProduct.Path);
                    if (WriteTime > LatestWriteTime)
                    {
                        LatestWriteTime = WriteTime;
                    }
                }
            }
            return(LatestWriteTime);
        }
Exemple #12
0
        /// <summary>
        /// Creates a receipt for this binary.
        /// </summary>
        /// <param name="ToolChain">Toolchain for the target platform</param>
        /// <param name="BuildPlatform">Platform that we're building for</param>
        public virtual BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = new BuildReceipt();

            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;

            switch (Config.Type)
            {
            case UEBuildBinaryType.Executable:
                Type = BuildProductType.Executable;
                break;

            case UEBuildBinaryType.DynamicLinkLibrary:
                Type = BuildProductType.DynamicLibrary;
                break;

            case UEBuildBinaryType.StaticLibrary:
                Type = BuildProductType.StaticLibrary;
                break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);

            foreach (string OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, Receipt);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (string OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, Receipt);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.AddFilesToReceipt(Receipt, this);
            return(Receipt);
        }
Exemple #13
0
        /// <summary>
        /// Overrides base class to add module runtime dependencies to the build receipt.
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        public override BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = base.MakeReceipt(ToolChain);

            // Set the IsPrecompiled flag on all the build products if we're not actually building this binary
            if (!Config.bAllowCompilation)
            {
                foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
                {
                    BuildProduct.IsPrecompiled = true;
                }
            }

            // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules
            Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>();
            List <UEBuildModule> OrderedModules = new List <UEBuildModule>();

            foreach (string ModuleName in ModuleNames)
            {
                UEBuildModule Module = Target.GetModuleByName(ModuleName);
                foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies)
                {
                    Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                }
                Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true);
            }

            // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it.
            foreach (UEBuildModule OrderedModule in OrderedModules)
            {
                UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule;
                if (ExternalModule != null)
                {
                    foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies)
                    {
                        Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                    }
                }
            }
            return(Receipt);
        }
Exemple #14
0
        /// <summary>
        /// Gets the latest write time of any of the UnrealHeaderTool binaries (including DLLs and Plugins) or DateTime.MaxValue if UnrealHeaderTool does not exist
        /// </summary>
        /// <returns>
        /// Latest timestamp of UHT binaries or DateTime.MaxValue if UnrealHeaderTool is out of date and needs to be rebuilt.
        /// </returns>
        static bool GetHeaderToolTimestamp(out DateTime Timestamp)
        {
            using (var TimestampTimer = new ScopedTimer("GetHeaderToolTimestamp"))
            {
                // Try to read the receipt for UHT.
                string ReceiptPath = BuildReceipt.GetDefaultPath(BuildConfiguration.RelativeEnginePath, "UnrealHeaderTool", BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, null);
                if (!File.Exists(ReceiptPath))
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }

                BuildReceipt Receipt;
                try
                {
                    Receipt = BuildReceipt.Read(ReceiptPath);
                }
                catch (Exception)
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }
                Receipt.ExpandPathVariables(BuildConfiguration.RelativeEnginePath, BuildConfiguration.RelativeEnginePath);

                // Check all the binaries exist, and that all the DLLs are built against the right version
                if (!CheckBinariesExist(Receipt) || !CheckDynamicLibaryVersionsMatch(Receipt))
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }

                // Return the timestamp for all the binaries
                Timestamp = GetTimestampFromBinaries(Receipt);
                return(true);
            }
        }
        /// <summary>
        /// Checks if all the files in a receipt have the same version
        /// </summary>
        /// <returns>
        /// True if all the files are valid.
        /// </returns>
        static bool CheckDynamicLibaryVersionsMatch(BuildReceipt Receipt)
        {
            List<Tuple<string, int>> BinaryVersions = new List<Tuple<string,int>>();
            foreach(BuildProduct BuildProduct in Receipt.BuildProducts)
            {
                if(BuildProduct.Type == BuildProductType.DynamicLibrary)
                {
                    int Version = BuildHostPlatform.Current.GetDllApiVersion(BuildProduct.Path);
                    BinaryVersions.Add(new Tuple<string,int>(BuildProduct.Path, Version));
                }
            }

            bool bMatch = true;
            if(BinaryVersions.Count > 0 && !BinaryVersions.All(x => x.Item2 == BinaryVersions[0].Item2))
            {
                Log.TraceWarning("Detected mismatch in binary versions:");
                foreach(Tuple<string, int> BinaryVersion in BinaryVersions)
                {
                    Log.TraceWarning("  {0} has API version {1}", BinaryVersion.Item1, BinaryVersion.Item2);
                    File.Delete(BinaryVersion.Item1);
                }
                bMatch = false;
            }
            return bMatch;
        }
 /// <summary>
 /// Checks if all the files in a receipt are present and that all the DLLs are at the same version
 /// </summary>
 /// <returns>
 /// True if all the files are valid.
 /// </returns>
 static bool CheckBinariesExist(BuildReceipt Receipt)
 {
     bool bExist = true;
     foreach(BuildProduct BuildProduct in Receipt.BuildProducts)
     {
         if(BuildProduct.Type == BuildProductType.Executable || BuildProduct.Type == BuildProductType.DynamicLibrary)
         {
             if(!File.Exists(BuildProduct.Path))
             {
                 Log.TraceWarning("Missing binary: {0}", BuildProduct.Path);
                 bExist = false;
             }
         }
     }
     return bExist;
 }
Exemple #17
0
		public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			if (BuildConfiguration.bCreateStubIPA && Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				string StubFile = Path.Combine (Path.GetDirectoryName (Binary.Config.OutputFilePath), Path.GetFileNameWithoutExtension (Binary.Config.OutputFilePath) + ".stub");
				Receipt.AddBuildProduct(StubFile, BuildProductType.Executable);
			}
		}
Exemple #18
0
        /// <summary>
        /// Adds a build product and its associated debug file to a receipt.
        /// </summary>
        /// <param name="OutputFile">Build product to add</param>
        /// <param name="DebugExtension">Extension for the matching debug file (may be null).</param>
        /// <param name="Receipt">Receipt to add to</param>
        static void AddBuildProductAndDebugFile(string OutputFile, BuildProductType OutputType, string DebugExtension, BuildReceipt Receipt)
        {
            Receipt.AddBuildProduct(OutputFile, OutputType);

            if(!String.IsNullOrEmpty(DebugExtension))
            {
                Receipt.AddBuildProduct(Path.ChangeExtension(OutputFile, DebugExtension), BuildProductType.SymbolFile);
            }
        }
Exemple #19
0
        /// <summary>
        /// Creates a receipt for this binary.
        /// </summary>
        /// <param name="ToolChain">Toolchain for the target platform</param>
        /// <param name="BuildPlatform">Platform that we're building for</param>
        public virtual BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = new BuildReceipt();

            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;
            switch(Config.Type)
            {
                case UEBuildBinaryType.Executable:
                    Type = BuildProductType.Executable;
                    break;
                case UEBuildBinaryType.DynamicLinkLibrary:
                    Type = BuildProductType.DynamicLibrary;
                    break;
                case UEBuildBinaryType.StaticLibrary:
                    Type = BuildProductType.StaticLibrary;
                    break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);
            foreach (string OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, Receipt);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (string OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, Receipt);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.AddFilesToReceipt(Receipt, this);
            return Receipt;
        }
Exemple #20
0
        /** Generates a public manifest file for writing out */
        public void GenerateManifest()
        {
            string ManifestPath;
            if (UnrealBuildTool.RunningRocket() && UnrealBuildTool.HasUProjectFile())
            {
                ManifestPath = Path.Combine(UnrealBuildTool.GetUProjectPath(), BuildConfiguration.BaseIntermediateFolder, "Manifest.xml");
            }
            else
            {
                ManifestPath = "../Intermediate/Build/Manifest.xml";
            }

            BuildManifest Manifest = new BuildManifest();
            if (UEBuildConfiguration.bMergeManifests)
            {
                // Load in existing manifest (if any)
                Manifest = Utils.ReadClass<BuildManifest>(ManifestPath);
            }

            // Expand all the paths in the receipt; they'll currently use variables for the engine and project directories
            BuildReceipt ReceiptWithFullPaths = new BuildReceipt(Receipt);
            ReceiptWithFullPaths.ExpandPathVariables(BuildConfiguration.RelativeEnginePath, ProjectDirectory);

            foreach(BuildProduct BuildProduct in ReceiptWithFullPaths.BuildProducts)
            {
                // If we're cleaning, don't add any precompiled binaries to the manifest. We don't want to delete them.
                if(UEBuildConfiguration.bCleanProject && bUsePrecompiled && BuildProduct.IsPrecompiled)
                {
                    continue;
                }

                // Don't add static libraries into the manifest unless we're explicitly building them; we don't submit them to Perforce.
                if(!UEBuildConfiguration.bCleanProject && !bPrecompile && (BuildProduct.Type == BuildProductType.StaticLibrary || BuildProduct.Type == BuildProductType.ImportLibrary))
                {
                    continue;
                }

                // Otherwise add it
                Manifest.AddBuildProduct(BuildProduct.Path);
            }

            IUEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);
            if(OnlyModules.Count == 0)
            {
                Manifest.AddBuildProduct(BuildReceipt.GetDefaultPath(ProjectDirectory, TargetName, Platform, Configuration, BuildPlatform.GetActiveArchitecture()));
            }

            if (UEBuildConfiguration.bCleanProject)
            {
                CleanTarget(Manifest);
            }
            if (UEBuildConfiguration.bGenerateManifest)
            {
                Utils.WriteClass<BuildManifest>(Manifest, ManifestPath, "");
            }
        }
Exemple #21
0
        /** Creates the receipt for the target */
        private void PrepareReceipt(IUEToolChain ToolChain)
        {
            Receipt = new BuildReceipt();

            // Add the target properties
            Receipt.SetProperty("TargetName", TargetName);
            Receipt.SetProperty("Platform", Platform.ToString());
            Receipt.SetProperty("Configuration", Configuration.ToString());
            Receipt.SetProperty("Precompile", bPrecompile.ToString());

            // Merge all the binary receipts into this
            foreach(UEBuildBinary Binary in AppBinaries)
            {
                BuildReceipt BinaryReceipt = Binary.MakeReceipt(ToolChain);
                if(Binary.Config.Type == UEBuildBinaryType.StaticLibrary)
                {
                    BinaryReceipt.RuntimeDependencies.Clear();
                }
                Receipt.Merge(BinaryReceipt);
            }

            // Convert all the paths to use variables for the engine and project root
            Receipt.InsertStandardPathVariables(BuildConfiguration.RelativeEnginePath, ProjectDirectory);
        }
 public virtual void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
 {
 }
Exemple #23
0
        public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			// The cross-platform code adds .dSYMs for static libraries, which is just wrong, so
			// eliminate them here for now.
			string DebugExtension = UEBuildPlatform.GetBuildPlatform(Binary.Target.Platform).GetDebugInfoExtension(Binary.Config.Type);
			if(DebugExtension == ".dsym")
			{
				for (int i = 0; i < Receipt.BuildProducts.Count; i++)
				{
					if(Path.GetExtension(Receipt.BuildProducts[i].Path) == DebugExtension && Receipt.BuildProducts[i].Path.Contains(".app"))
					{
						Receipt.BuildProducts.RemoveAt(i--);
					}
				}

				for (int i = 0; i < Receipt.BuildProducts.Count; i++)
				{
					if((Receipt.BuildProducts[i].Type == BuildProductType.Executable || Receipt.BuildProducts[i].Type == BuildProductType.DynamicLibrary) && Receipt.BuildProducts[i].Path.Contains(".app"))
					{
						string BinaryPath = Receipt.BuildProducts[i].Path;
						while(BinaryPath.Contains(".app"))
						{
							BinaryPath = Path.GetDirectoryName(BinaryPath);
						}
						BinaryPath = Path.Combine(BinaryPath, Path.GetFileName(Receipt.BuildProducts[i].Path));
						Receipt.AddBuildProduct(Path.ChangeExtension(BinaryPath, DebugExtension), BuildProductType.SymbolFile);
					}
				}
			}

			if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
			{
				return;
			}

			if (BundleContentsDirectory == "" && Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				BundleContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";
			}

			// We need to know what third party dylibs would be copied to the bundle
			if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
				var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy();
				var BinaryDependencies = new List<UEBuildBinary>();
				var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
				foreach (var Module in Modules)
				{
					Module.SetupPrivateLinkEnvironment(Binary, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
				}

				foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
				{
					string LibName = Path.GetFileName(AdditionalLibrary);
					if (LibName.StartsWith("lib"))
					{
						if (Path.GetExtension(AdditionalLibrary) == ".dylib" && !String.IsNullOrEmpty(BundleContentsDirectory))
						{
							string Entry = BundleContentsDirectory + "MacOS/" + LibName;
							Receipt.AddBuildProduct(Entry, BuildProductType.DynamicLibrary);
						}
					}
				}

				foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
				{
					if (Directory.Exists(Resource.ResourcePath))
					{
						foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
						{
							Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)), BuildProductType.RequiredResource);
						}
					}
					else
					{
						Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)), BuildProductType.RequiredResource);
					}
				}
			}

			if (Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				// And we also need all the resources
				Receipt.AddBuildProduct(BundleContentsDirectory + "Info.plist", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "PkgInfo", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UE4.icns", BuildProductType.RequiredResource);

				if (Binary.Target.AppName.StartsWith("UE4Editor"))
				{
					Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UProject.icns", BuildProductType.RequiredResource);
				}
			}
		}
 /// <summary>
 /// Merges another receipt to this one.
 /// </summary>
 /// <param name="Other">Receipt which should be merged</param>
 public void Merge(BuildReceipt Other)
 {
     foreach(BuildProduct OtherBuildProduct in Other.BuildProducts)
     {
         BuildProducts.Add(OtherBuildProduct);
     }
     foreach(RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
     {
         if(!RuntimeDependencies.Any(x => x.Path == OtherRuntimeDependency.Path && x.StagePath == OtherRuntimeDependency.StagePath))
         {
             RuntimeDependencies.Add(OtherRuntimeDependency);
         }
     }
 }
Exemple #25
0
        /// <summary>
        /// Adds a build product and its associated debug file to a receipt.
        /// </summary>
        /// <param name="OutputFile">Build product to add</param>
        /// <param name="DebugExtension">Extension for the matching debug file (may be null).</param>
        /// <param name="Receipt">Receipt to add to</param>
        static void AddBuildProductAndDebugFile(string OutputFile, BuildProductType OutputType, string DebugExtension, BuildReceipt Receipt)
        {
            Receipt.AddBuildProduct(OutputFile, OutputType);

            if (!String.IsNullOrEmpty(DebugExtension))
            {
                Receipt.AddBuildProduct(Path.ChangeExtension(OutputFile, DebugExtension), BuildProductType.SymbolFile);
            }
        }
 /// <summary>
 /// Checks if all the files in a receipt are present and that all the DLLs are at the same version
 /// </summary>
 /// <returns>
 /// True if all the files are valid.
 /// </returns>
 static DateTime GetTimestampFromBinaries(BuildReceipt Receipt)
 {
     DateTime LatestWriteTime = DateTime.MinValue;
     foreach(BuildProduct BuildProduct in Receipt.BuildProducts)
     {
         if(BuildProduct.Type == BuildProductType.Executable || BuildProduct.Type == BuildProductType.DynamicLibrary)
         {
             DateTime WriteTime = File.GetLastWriteTime(BuildProduct.Path);
             if(WriteTime > LatestWriteTime)
             {
                 LatestWriteTime = WriteTime;
             }
         }
     }
     return LatestWriteTime;
 }
Exemple #27
0
		public virtual void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
		}
		public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			// the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest)
			if (Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				foreach (string BinaryPath in Binary.Config.OutputFilePaths)
				{
					string ApkFile = Path.ChangeExtension(BinaryPath, ".apk");
					Receipt.AddBuildProduct(ApkFile, BuildProductType.Executable);
				}
			}
		}
	public void StageBuildProductsFromReceipt(BuildReceipt Receipt)
	{
		// Stage all the build products needed at runtime
		foreach(BuildProduct BuildProduct in Receipt.BuildProducts)
		{
			// allow missing files if needed
			if (Receipt.bRequireDependenciesToExist == false && File.Exists(BuildProduct.Path) == false)
			{
				continue;
			}

			if(BuildProduct.Type == BuildProductType.Executable || BuildProduct.Type == BuildProductType.DynamicLibrary || BuildProduct.Type == BuildProductType.RequiredResource)
			{
				StageFile(StagedFileType.NonUFS, BuildProduct.Path);
			}
			else if(BuildProduct.Type == BuildProductType.SymbolFile)
			{
				StageFile(StagedFileType.DebugNonUFS, BuildProduct.Path);
			}
		}
	}
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="InOther">Receipt to copy from</param>
 public BuildReceipt(BuildReceipt Other)
 {
     foreach(BuildProduct OtherBuildProduct in Other.BuildProducts)
     {
         BuildProducts.Add(new BuildProduct(OtherBuildProduct));
     }
     foreach(RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
     {
         RuntimeDependencies.Add(new RuntimeDependency(OtherRuntimeDependency));
     }
 }
	public void StageRuntimeDependenciesFromReceipt(BuildReceipt Receipt)
	{
		// Also stage any additional runtime dependencies, like ThirdParty DLLs
		foreach(RuntimeDependency RuntimeDependency in Receipt.RuntimeDependencies)
		{
			// allow missing files if needed
			if (Receipt.bRequireDependenciesToExist == false && File.Exists(RuntimeDependency.Path) == false)
			{
				continue;
			}

			StageFile(StagedFileType.NonUFS, RuntimeDependency.Path, RuntimeDependency.StagePath);
		}
	}
        public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
			{
				return;
			}

			if (BundleContentsDirectory == "" && Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				BundleContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";
			}

			// We need to know what third party dylibs would be copied to the bundle
			if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
				var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy();
				var BinaryDependencies = new List<UEBuildBinary>();
				var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
				foreach (var Module in Modules)
				{
					Module.SetupPrivateLinkEnvironment(Binary, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
				}

				foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
				{
					string LibName = Path.GetFileName(AdditionalLibrary);
					if (LibName.StartsWith("lib"))
					{
						if (Path.GetExtension(AdditionalLibrary) == ".dylib" && !String.IsNullOrEmpty(BundleContentsDirectory))
						{
							string Entry = BundleContentsDirectory + "MacOS/" + LibName;
							Receipt.AddBuildProduct(Entry, BuildProductType.DynamicLibrary);
						}
					}
				}

				foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
				{
					if (Directory.Exists(Resource.ResourcePath))
					{
						foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
						{
							Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)), BuildProductType.RequiredResource);
						}
					}
					else
					{
						Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)), BuildProductType.RequiredResource);
					}
				}
			}

			if (Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				// And we also need all the resources
				Receipt.AddBuildProduct(BundleContentsDirectory + "Info.plist", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "PkgInfo", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UE4.icns", BuildProductType.RequiredResource);

				if (Binary.Target.AppName.StartsWith("UE4Editor"))
				{
					Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UProject.icns", BuildProductType.RequiredResource);
				}
			}
		}
Exemple #33
0
		/// <summary>
		/// Copy constructor
		/// </summary>
		/// <param name="InOther">Receipt to copy from</param>
		public BuildReceipt(BuildReceipt Other)
		{ 
			foreach(BuildProduct OtherBuildProduct in Other.BuildProducts)
			{
				BuildProducts.Add(new BuildProduct(OtherBuildProduct));
			}
			foreach(RuntimeDependency OtherRuntimeDependency in Other.RuntimeDependencies)
			{
				RuntimeDependencies.Add(new RuntimeDependency(OtherRuntimeDependency));
			}
			AdditionalProperties = new List<ReceiptProperty>(Other.AdditionalProperties);
		}