Exemple #1
0
    public void UploadToS3(DeploymentContext SC)
    {
        ConfigCacheIni Ini    = ConfigCacheIni.CreateConfigCacheIni(SC.StageTargetPlatform.PlatformType, "Engine", DirectoryReference.FromFile(SC.RawProjectPath));
        bool           Upload = false;

        string KeyId      = "";
        string AccessKey  = "";
        string BucketName = "";
        string FolderName = "";

        if (Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "UploadToS3", out Upload))
        {
            if (!Upload)
            {
                return;
            }
        }
        else
        {
            return;
        }
        bool AmazonIdentity = Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3KeyID", out KeyId) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3SecretAccessKey", out AccessKey) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3BucketName", out BucketName) &&
                              Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3FolderName", out FolderName);

        if (!AmazonIdentity)
        {
            Log("Amazon S3 Incorrectly configured");
            return;
        }

        if (FolderName == "")
        {
            FolderName = SC.ShortProjectName;
        }

        List <Task> UploadTasks = new List <Task>();

        foreach (KeyValuePair <string, string> Entry in SC.ArchivedFiles)
        {
            FileInfo Info = new FileInfo(Entry.Key);
            UploadTasks.Add(Task.Factory.StartNew(() => UploadToS3Worker(Info, KeyId, AccessKey, BucketName, FolderName)));
        }

        Task.WaitAll(UploadTasks.ToArray());

        string URL = "http://" + BucketName + ".s3.amazonaws.com/" + FolderName + "/" + SC.ShortProjectName + ".html";

        Log("Your project's shareable link is: " + URL);

        Log("Upload Tasks finished.");
    }
        public AmazonServices(TargetInfo Target)
        {
            Definitions.Add("AMAZONSERVICES_PACKAGE=1");

            PrivateIncludePaths.AddRange(
                new string[] {
                "AmazonServices/Private",
            });

            PrivateDependencyModuleNames.AddRange(
                new string[] {
                "Core",
                "CoreUObject",
                "Engine",
                "Sockets",
                "OnlineSubsystem",
                "Http",
                "AndroidRuntimeSettings",
            }
                );

            // Get Settings from Config Cache
            ConfigCacheIni Ini = ConfigCacheIni.CreateConfigCacheIni(Target.Platform, "Engine", new DirectoryReference(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../../../"))));
            bool           bEnableAmazonSupport = false;

            if (!Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableAmazonSupport", out bEnableAmazonSupport))
            {
                bEnableAmazonSupport = false;
            }

            // Additional Frameworks and Libraries for Android
            if (Target.Platform == UnrealTargetPlatform.Android)
            {
                PrivateDependencyModuleNames.AddRange(new string[] { "Launch" });
                string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, BuildConfiguration.RelativeEnginePath);
                AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", Path.Combine(PluginPath, "AmazonServices_APL.xml")));
            }
        }
Exemple #3
0
    public DeploymentContext(
        FileReference RawProjectPathOrName,
        string InLocalRoot,
        string BaseStageDirectory,
        string BaseArchiveDirectory,
        Platform InSourcePlatform,
        Platform InTargetPlatform,
        List <UnrealTargetConfiguration> InTargetConfigurations,
        IEnumerable <StageTarget> InStageTargets,
        List <String> InStageExecutables,
        bool InServer,
        bool InCooked,
        bool InStageCrashReporter,
        bool InStage,
        bool InCookOnTheFly,
        bool InArchive,
        bool InProgram,
        bool IsClientInsteadOfNoEditor,
        bool InForceChunkManifests,
        bool bInUseWebsocketNetDriver = false
        )
    {
        bStageCrashReporter       = InStageCrashReporter;
        RawProjectPath            = RawProjectPathOrName;
        DedicatedServer           = InServer;
        LocalRoot                 = CommandUtils.CombinePaths(InLocalRoot);
        CookSourcePlatform        = InSourcePlatform;
        StageTargetPlatform       = InTargetPlatform;
        StageTargetConfigurations = new List <UnrealTargetConfiguration>(InTargetConfigurations);
        StageTargets              = new List <StageTarget>(InStageTargets);
        StageExecutables          = InStageExecutables;
        IsCodeBasedProject        = ProjectUtils.IsCodeBasedUProjectFile(RawProjectPath);
        ShortProjectName          = ProjectUtils.GetShortProjectName(RawProjectPath);
        Stage   = InStage;
        Archive = InArchive;
        bUseWebsocketNetDriver = bInUseWebsocketNetDriver;

        if (CookSourcePlatform != null && InCooked)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (CookSourcePlatform != null && InProgram)
        {
            CookPlatform = CookSourcePlatform.GetCookPlatform(false, false);
        }
        else
        {
            CookPlatform = "";
        }

        if (StageTargetPlatform != null && InCooked)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(DedicatedServer, IsClientInsteadOfNoEditor);
        }
        else if (StageTargetPlatform != null && InProgram)
        {
            FinalCookPlatform = StageTargetPlatform.GetCookPlatform(false, false);
        }
        else
        {
            FinalCookPlatform = "";
        }

        PlatformDir = StageTargetPlatform.PlatformType.ToString();

        StageDirectory   = CommandUtils.CombinePaths(BaseStageDirectory, FinalCookPlatform);
        ArchiveDirectory = CommandUtils.CombinePaths(BaseArchiveDirectory, FinalCookPlatform);

        if (!CommandUtils.FileExists(RawProjectPath.FullName))
        {
            throw new AutomationException("Can't find uproject file {0}.", RawProjectPathOrName);
        }

        ProjectRoot = CommandUtils.CombinePaths(CommandUtils.GetDirectoryName(RawProjectPath.FullName));

        if (!CommandUtils.DirectoryExists(ProjectRoot))
        {
            throw new AutomationException("Project Directory {0} doesn't exist.", ProjectRoot);
        }

        RelativeProjectRootForStage = ShortProjectName;

        ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(RawProjectPath.FullName);
        CookSourceRuntimeRootDir  = RuntimeRootDir = LocalRoot;
        RuntimeProjectRootDir     = ProjectRoot;

        RelativeProjectRootForUnrealPak = CommandUtils.CombinePaths(RelativeProjectRootForStage).Replace("\\", "/");
        if (RelativeProjectRootForUnrealPak.StartsWith("/"))
        {
            RelativeProjectRootForUnrealPak = RelativeProjectRootForUnrealPak.Substring(1);
            RelativeProjectRootForStage     = RelativeProjectRootForStage.Substring(1);
        }

        SourceRelativeProjectRoot = RelativeProjectRootForStage; // for foreign projects this doesn't make much sense, but it turns into a noop on staging files
        if (ProjectRoot.StartsWith(LocalRoot, StringComparison.InvariantCultureIgnoreCase))
        {
            SourceRelativeProjectRoot = ProjectRoot.Substring(LocalRoot.Length);
        }
        if (SourceRelativeProjectRoot.StartsWith("/") || SourceRelativeProjectRoot.StartsWith("\\"))
        {
            SourceRelativeProjectRoot = SourceRelativeProjectRoot.Substring(1);
        }

        if (Stage)
        {
            CommandUtils.CreateDirectory(StageDirectory);
            StageProjectRoot = CommandUtils.CombinePaths(StageDirectory, RelativeProjectRootForStage);

            RuntimeRootDir            = StageDirectory;
            CookSourceRuntimeRootDir  = CommandUtils.CombinePaths(BaseStageDirectory, CookPlatform);
            RuntimeProjectRootDir     = StageProjectRoot;
            ProjectArgForCommandLines = CommandUtils.MakePathSafeToUseWithCommandLine(UProjectCommandLineArgInternalRoot + RelativeProjectRootForStage + "/" + ShortProjectName + ".uproject");
        }
        if (Archive)
        {
            CommandUtils.CreateDirectory(ArchiveDirectory);
        }
        ProjectArgForCommandLines = ProjectArgForCommandLines.Replace("\\", "/");
        ProjectBinariesFolder     = CommandUtils.CombinePaths(ProjectUtils.GetClientProjectBinariesRootPath(RawProjectPath, TargetRules.TargetType.Game, IsCodeBasedProject), PlatformDir);

        // If we were configured to use manifests across the whole project, then this platform should use manifests.
        // Otherwise, read whether we are generating chunks from the ProjectPackagingSettings ini.
        if (InForceChunkManifests)
        {
            PlatformUsesChunkManifests = true;
        }
        else
        {
            ConfigCacheIni GameIni  = ConfigCacheIni.CreateConfigCacheIni(InTargetPlatform.PlatformType, "Game", RawProjectPath.Directory);
            String         IniPath  = "/Script/UnrealEd.ProjectPackagingSettings";
            bool           bSetting = false;
            if (GameIni.GetBool(IniPath, "bGenerateChunks", out bSetting))
            {
                PlatformUsesChunkManifests = bSetting;
            }
        }
    }
Exemple #4
0
        /// <summary>
        /// Attempts to autodetect project properties.
        /// </summary>
        /// <param name="RawProjectPath">Full project path.</param>
        /// <returns>Project properties.</returns>
        private static ProjectProperties DetectProjectProperties(FileReference RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms, bool AssetNativizationRequested)
        {
            var Properties = new ProjectProperties();

            Properties.RawProjectPath = RawProjectPath;

            // detect if the project is content only, but has non-default build settings
            List <string> ExtraSearchPaths = null;

            if (RawProjectPath != null)
            {
                if (RequiresTempTarget(RawProjectPath, ClientTargetPlatforms, AssetNativizationRequested))
                {
                    GenerateTempTarget(RawProjectPath);
                    Properties.bWasGenerated = true;
                    ExtraSearchPaths         = new List <string>();

                    string TempTargetDir = CommandUtils.CombinePaths(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source");
                    ExtraSearchPaths.Add(TempTargetDir);

                    // in case the RulesCompiler (what we use to find all the
                    // Target.cs files) has already cached the contents of this
                    // directory, then we need to invalidate that cache (so
                    // it'll find/use the new Target.cs file)
                    RulesCompiler.InvalidateRulesFileCache(TempTargetDir);
                }
                else if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source", Path.GetFileNameWithoutExtension(RawProjectPath.FullName) + ".Target.cs")))
                {
                    File.Delete(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source", Path.GetFileNameWithoutExtension(RawProjectPath.FullName) + ".Target.cs"));
                }
            }

            if (CommandUtils.CmdEnv.HasCapabilityToCompile)
            {
                DetectTargetsForProject(Properties, ExtraSearchPaths);
                Properties.bIsCodeBasedProject = !CommandUtils.IsNullOrEmpty(Properties.Targets) || !CommandUtils.IsNullOrEmpty(Properties.Programs);
            }
            else
            {
                // should never ask for engine targets if we can't compile
                if (RawProjectPath == null)
                {
                    throw new AutomationException("Cannot determine engine targets if we can't compile.");
                }

                Properties.bIsCodeBasedProject = Properties.bWasGenerated;
                // if there's a Source directory with source code in it, then mark us as having source code
                string SourceDir = CommandUtils.CombinePaths(Path.GetDirectoryName(RawProjectPath.FullName), "Source");
                if (Directory.Exists(SourceDir))
                {
                    string[] CppFiles = Directory.GetFiles(SourceDir, "*.cpp", SearchOption.AllDirectories);
                    string[] HFiles   = Directory.GetFiles(SourceDir, "*.h", SearchOption.AllDirectories);
                    Properties.bIsCodeBasedProject |= (CppFiles.Length > 0 || HFiles.Length > 0);
                }
            }

            // check to see if the uproject loads modules, only if we haven't already determined it is a code based project
            if (!Properties.bIsCodeBasedProject && RawProjectPath != null)
            {
                string uprojectStr = File.ReadAllText(RawProjectPath.FullName);
                Properties.bIsCodeBasedProject = uprojectStr.Contains("\"Modules\"");
            }

            // Get all ini files
            if (RawProjectPath != null)
            {
                CommandUtils.LogVerbose("Loading ini files for {0}", RawProjectPath);

                var EngineDirectory = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine");
                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        var Config = ConfigCacheIni.CreateConfigCacheIni(TargetPlatformType, "Engine", RawProjectPath.Directory, new DirectoryReference(EngineDirectory));
                        Properties.EngineConfigs.Add(TargetPlatformType, Config);
                    }
                }

                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        var Config = ConfigCacheIni.CreateConfigCacheIni(TargetPlatformType, "Game", RawProjectPath.Directory);
                        Properties.GameConfigs.Add(TargetPlatformType, Config);
                    }
                }
            }

            return(Properties);
        }