public static void ReplaceStringsInFile(IIgorModule ModuleInst, string FilePath, string OriginalString, string NewString) { string FullFilePath = FilePath; if (!File.Exists(FullFilePath)) { FullFilePath = Path.Combine(Path.GetFullPath("."), FilePath); } if (File.Exists(FullFilePath)) { File.SetAttributes(FullFilePath, System.IO.FileAttributes.Normal); } if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(FullFilePath), "Replace string in file failed because " + FullFilePath + " doesn't exist.")) { string FileContents = File.ReadAllText(FilePath); FileContents = FileContents.Replace(OriginalString, NewString); IgorRuntimeUtils.DeleteFile(FileContents); File.WriteAllText(FilePath, FileContents); } }
public static void Cleanup() { if (File.Exists(IgorJobConfigPath)) { IgorRuntimeUtils.DeleteFile(IgorJobConfigPath); } }
public static void AddRequiredDeviceCapability(IIgorModule ModuleInst, string PlistPath, string NewRequiredDeviceCapability) { if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(PlistPath), "Plist " + PlistPath + " doesn't exist!")) { FileInfo PlistFileInfo = new FileInfo(PlistPath); NSObject PlistRoot = PropertyListParser.Parse(PlistFileInfo); if (IgorAssert.EnsureTrue(ModuleInst, PlistRoot != null, "Plist " + PlistPath + " could not be parsed!")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(PlistRoot.GetType()), "Plist " + PlistPath + " root object is not a dictionary.")) { NSDictionary RootDictionary = (NSDictionary)PlistRoot; if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary != null, "Plist root is not a dictionary.")) { if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary.ContainsKey("UIRequiredDeviceCapabilities"), "Can't find UIRequiredDeviceCapabilities in plist.")) { NSObject DeviceCapabilities = RootDictionary.Get("UIRequiredDeviceCapabilities"); if (IgorAssert.EnsureTrue(ModuleInst, DeviceCapabilities != null, "Plist does not contain UIRequiredDeviceCapabilities.")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(DeviceCapabilities.GetType()), "Plist UIRequiredDeviceCapabilities is not an array.")) { NSArray CapabilitiesArray = (NSArray)DeviceCapabilities; if (IgorAssert.EnsureTrue(ModuleInst, CapabilitiesArray != null, "UIRequiredDeviceCapabilities is not an array.")) { if (CapabilitiesArray.ContainsObject(new NSString(NewRequiredDeviceCapability))) { IgorDebug.Log(ModuleInst, "UIRequiredDeviceCapabilities already contains " + NewRequiredDeviceCapability); } else { NSSet NewCapabilitiesSet = new NSSet(CapabilitiesArray.GetArray()); NewCapabilitiesSet.AddObject(new NSString(NewRequiredDeviceCapability)); NSArray NewCapabilitiesArray = new NSArray(NewCapabilitiesSet.AllObjects()); RootDictionary["UIRequiredDeviceCapabilities"] = NewCapabilitiesArray; IgorRuntimeUtils.DeleteFile(PlistPath); PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo); IgorDebug.Log(ModuleInst, NewRequiredDeviceCapability + " added to UIRequiredDeviceCapabilities."); } } } } } } } } } }
public virtual bool Build() { string BuiltName = GetBuiltNameForTarget(JobBuildTarget); string BuiltBaseName = BuiltName; if (BuiltBaseName.Contains(".")) { BuiltBaseName = BuiltName.Substring(0, BuiltBaseName.LastIndexOf('.')); } string DataFolderName = BuiltBaseName + "_Data"; if (File.Exists(BuiltName)) { IgorRuntimeUtils.DeleteFile(BuiltName); } if (Directory.Exists(DataFolderName)) { IgorRuntimeUtils.DeleteDirectory(DataFolderName); } #if !UNITY_4_3 BuiltName = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), BuiltName); #endif BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), BuiltName, JobBuildTarget, IgorBuildCommon.GetBuildOptions()); Log("Destination file is: " + BuiltName); List <string> BuiltFiles = new List <string>(); if (Directory.Exists(DataFolderName)) { if (IgorAssert.EnsureTrue(this, File.Exists(BuiltName), "The built file " + BuiltName + " doesn't exist. Something went wrong during the build step. Please check the logs!")) { BuiltFiles.Add(BuiltName); } if (IgorAssert.EnsureTrue(this, Directory.Exists(DataFolderName), "The built data directory for the Windows build " + DataFolderName + " doesn't exist. Something went wrong during the build step. Please check the logs!")) { BuiltFiles.Add(DataFolderName); } } else { if (IgorAssert.EnsureTrue(this, Directory.Exists(BuiltName), "The built app directory for the Mac build " + BuiltName + " doesn't exist. Something went wrong during the build step. Please check the logs!")) { BuiltFiles.Add(BuiltName); } } IgorCore.SetNewModuleProducts(BuiltFiles); return(true); }
public virtual bool Cleanup() { string DestinationFile = GetParamOrConfigString(UploadToFTPFlag, "Destination file for JenkinsFTP isn't set so we can't clean it up."); if (File.Exists(DestinationFile)) { IgorRuntimeUtils.DeleteFile(DestinationFile); } return(true); }
public void Save(string path) { XmlSerializer serializer = new XmlSerializer(typeof(IgorConfig)); IgorRuntimeUtils.DeleteFile(path); using (FileStream stream = new FileStream(path, FileMode.Create)) { serializer.Serialize(stream, this); } }
public virtual void CopyLauncherToProjectPath(BuildTarget TargetTestPlatform, string TempPath, string LocalPath) { if (TargetTestPlatform == BuildTarget.StandaloneOSXIntel64) { string ZipPath = Path.Combine(TempPath, "MonsterLauncherOSX.zip"); List <string> ZipFileList = new List <string>(); foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher.app"), true, false, true)) { ZipFileList.Add("MonsterLauncher.app/" + FilePath); } IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath); string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherOSX.zip"); if (File.Exists(ZipLocalPath)) { IgorRuntimeUtils.DeleteFile(ZipLocalPath); } IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath); } else if (TargetTestPlatform == BuildTarget.StandaloneWindows64) { string ZipPath = Path.Combine(TempPath, "MonsterLauncherWindows.zip"); List <string> ZipFileList = new List <string>(); foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher_Data"), true, false, true)) { ZipFileList.Add("MonsterLauncher_Data/" + FilePath); } ZipFileList.Add("MonsterLauncher.exe"); IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath); string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherWindows.zip"); if (File.Exists(ZipLocalPath)) { IgorRuntimeUtils.DeleteFile(ZipLocalPath); } IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath); } }
public static void ZipFilesCrossPlatform(IIgorModule ModuleInst, List <string> FilesToZip, string ZipFilename, bool bUpdateBuildProducts = true, string RootDir = ".") { if (File.Exists(ZipFilename)) { IgorRuntimeUtils.DeleteFile(ZipFilename); } IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform(); if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX) { ZipFilesMac(ModuleInst, FilesToZip, ZipFilename, bUpdateBuildProducts, RootDir); } else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows) { ZipFilesWindows(ModuleInst, FilesToZip, ZipFilename, bUpdateBuildProducts, RootDir); } }
public static void SetStringValue(IIgorModule ModuleInst, string PlistPath, string StringKey, string Value) { if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(PlistPath), "Plist " + PlistPath + " doesn't exist!")) { FileInfo PlistFileInfo = new FileInfo(PlistPath); NSObject PlistRoot = PropertyListParser.Parse(PlistFileInfo); if (IgorAssert.EnsureTrue(ModuleInst, PlistRoot != null, "Plist " + PlistPath + " could not be parsed!")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(PlistRoot.GetType()), "Plist " + PlistPath + " root object is not a dictionary.")) { NSDictionary RootDictionary = (NSDictionary)PlistRoot; if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary != null, "Plist root is not a dictionary.")) { if (RootDictionary.ContainsKey(StringKey)) { RootDictionary[StringKey] = new NSString(Value); IgorRuntimeUtils.DeleteFile(PlistPath); PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo); IgorDebug.Log(ModuleInst, "Plist key " + StringKey + " updated to " + Value); } else { RootDictionary.Add(StringKey, new NSString(Value)); IgorRuntimeUtils.DeleteFile(PlistPath); PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo); IgorDebug.Log(ModuleInst, "Plist key " + StringKey + " added with value of " + Value); } } } } } }
public virtual bool CopyToFromSync(bool bToSync) { string LocalFile = ""; if (bToSync) { List <string> BuiltProducts = IgorCore.GetModuleProducts(); IgorAssert.EnsureTrue(this, BuiltProducts.Count == 1, "This module requires exactly one built file, but we found " + BuiltProducts.Count + " instead. Please make sure you've enabled a package step prior to this one."); if (BuiltProducts.Count > 0) { LocalFile = BuiltProducts[0]; } } else { LocalFile = GetParamOrConfigString(CopyToLocalDirFlag, "", Path.GetFullPath("."), false); } if (IgorAssert.EnsureTrue(this, !bToSync || File.Exists(LocalFile), "BitTorrent Sync copy was told to copy file " + LocalFile + ", but the file doesn't exist!")) { string SyncFile = ""; if (IgorJobConfig.IsBoolParamSet(CopyToSyncExpEnabledFlag)) { SyncFile = GetParamOrConfigString(CopyToSyncExplicitFlag, "BitTorrent Sync copy to sync explicit is enabled, but the path isn't set."); } if (SyncFile == "" && IgorJobConfig.IsBoolParamSet(CopyToSyncEnvEnabledFlag)) { string EnvVariable = GetParamOrConfigString(CopyToSyncEnvFlag, "BitTorrent Sync copy to sync based on environment variable is enabled, but the env variable name isn't set."); if (EnvVariable == "") { return(true); } SyncFile = IgorRuntimeUtils.GetEnvVariable(EnvVariable); if (!IgorAssert.EnsureTrue(this, SyncFile != "", "The BitTorrent Sync root path environment variable " + EnvVariable + " isn't set.")) { return(true); } } string SyncFilename = GetParamOrConfigString(CopyToSyncFilenameFlag, (bToSync ? "BitTorrent Sync copy to sync destination filename isn't set." : "BitTorrent Sync copy from sync source filename isn't set.")); if (SyncFilename == "") { return(true); } SyncFile = Path.Combine(SyncFile, SyncFilename); if (bToSync) { if (File.Exists(SyncFile)) { IgorRuntimeUtils.DeleteFile(SyncFile); } IgorRuntimeUtils.CopyFile(LocalFile, SyncFile); Log("File " + LocalFile + " copied to requested location " + SyncFile + " for BitTorrent Sync uploading."); } else { LocalFile = Path.Combine(LocalFile, Path.GetFileName(SyncFile)); if (File.Exists(LocalFile)) { IgorRuntimeUtils.DeleteFile(LocalFile); } IgorRuntimeUtils.CopyFile(SyncFile, LocalFile); Log("File " + SyncFile + " copied from the BitTorrent Sync share to requested location " + LocalFile + "."); List <string> NewProducts = new List <string>(); NewProducts.Add(LocalFile); IgorCore.SetNewModuleProducts(NewProducts); } } return(true); }
public virtual void BuildLauncher(BuildTarget TargetTestPlatform) { MonsterDebug.Log("Building launcher for platform " + TargetTestPlatform); string MethodName = GetBuildMethodName(TargetTestPlatform); if (MethodName == "") { MonsterDebug.LogError("Test platform " + TargetTestPlatform + " is not supported yet. Please add support for it!"); } string MonsterLauncherProjectPath = Path.Combine(Application.temporaryCachePath, "MonsterLauncher"); MonsterDebug.Log("Creating new project at " + MonsterLauncherProjectPath); if (Directory.Exists(MonsterLauncherProjectPath)) { MonsterDebug.Log("Cleaning up old project first!"); IgorRuntimeUtils.DeleteDirectory(MonsterLauncherProjectPath); } Directory.CreateDirectory(MonsterLauncherProjectPath); string LauncherProjectAssetsIgorFolder = Path.Combine(MonsterLauncherProjectPath, Path.Combine("Assets", "Igor")); Directory.CreateDirectory(LauncherProjectAssetsIgorFolder); MonsterDebug.Log("Copying project files."); IgorRuntimeUtils.DirectoryCopy(Path.Combine(Path.GetFullPath("."), Path.Combine("Assets", "Igor")), LauncherProjectAssetsIgorFolder, true); string OldLaunchersFolder = Path.Combine(LauncherProjectAssetsIgorFolder, Path.Combine("Monster", "Launchers")); IgorRuntimeUtils.DeleteDirectory(OldLaunchersFolder); MonsterDebug.Log("Copying Igor config."); string StreamingAssetsFolder = Path.Combine(MonsterLauncherProjectPath, Path.Combine("Assets", Path.Combine("StreamingAssets", "Igor"))); Directory.CreateDirectory(StreamingAssetsFolder); if (File.Exists(IgorConfig.DefaultConfigPath)) { IgorRuntimeUtils.CopyFile(IgorConfig.DefaultConfigPath, Path.Combine(StreamingAssetsFolder, IgorConfig.IgorConfigFilename)); } string BuildLauncherOutput = ""; string BuildLauncherError = ""; MonsterDebug.Log("Attempting to build launcher."); int ReturnCode = IgorRuntimeUtils.RunProcessCrossPlatform(EditorApplication.applicationPath + "/Contents/MacOS/Unity", EditorApplication.applicationPath, "-projectPath \"" + MonsterLauncherProjectPath + "\" -buildmachine -executeMethod " + MethodName + " -logfile Monster.log", MonsterLauncherProjectPath, ref BuildLauncherOutput, ref BuildLauncherError); if (ReturnCode != 0) { MonsterDebug.LogError("Something went wrong with the build! Returned error code " + ReturnCode + "\n\nOutput:\n" + BuildLauncherOutput + "\n\nError:\n" + BuildLauncherError); return; } MonsterDebug.Log("Launcher successfully built!"); string MonsterLauncherPath = Path.Combine(MonsterTestCore.MonsterLocalDirectoryRoot, "Launchers"); if (!Directory.Exists(MonsterLauncherPath)) { Directory.CreateDirectory(MonsterLauncherPath); } MonsterDebug.Log("Copying launcher back to project."); CopyLauncherToProjectPath(TargetTestPlatform, MonsterLauncherProjectPath, MonsterLauncherPath); IgorRuntimeUtils.DeleteDirectory(MonsterLauncherProjectPath); string MonsterRunPyFile = Path.Combine(MonsterLauncherPath, "MonsterRun.py"); if (File.Exists(MonsterRunPyFile)) { IgorRuntimeUtils.DeleteFile(MonsterRunPyFile); } string MonsterRunPyFileLatest = Path.Combine(IgorUpdater.LocalModuleRoot, Path.Combine("MonsterTest", Path.Combine("Core", Path.Combine("Runtime", "MonsterRun.py")))); if (File.Exists(MonsterRunPyFileLatest)) { MonsterDebug.Log("Copying latest MonsterRun.py to the Launchers folder."); IgorRuntimeUtils.CopyFile(MonsterRunPyFileLatest, MonsterRunPyFile); } MonsterDebug.Log("Done building launcher for platform " + TargetTestPlatform); }
public static void AddBundleURLType(IIgorModule ModuleInst, string PlistPath, string NewURLScheme) { if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(PlistPath), "Plist " + PlistPath + " doesn't exist!")) { FileInfo PlistFileInfo = new FileInfo(PlistPath); NSObject PlistRoot = PropertyListParser.Parse(PlistFileInfo); if (IgorAssert.EnsureTrue(ModuleInst, PlistRoot != null, "Plist " + PlistPath + " could not be parsed!")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(PlistRoot.GetType()), "Plist " + PlistPath + " root object is not a dictionary.")) { NSDictionary RootDictionary = (NSDictionary)PlistRoot; if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary != null, "Plist root is not a dictionary.")) { NSSet BundleURLTypes = null; if (RootDictionary.ContainsKey("CFBundleURLTypes")) { NSObject BundleURLTypesObj = RootDictionary.Get("CFBundleURLTypes"); if (IgorAssert.EnsureTrue(ModuleInst, BundleURLTypesObj != null, "CFBundleURLTypes wasn't found in the root dictionary even though the key exists.")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(BundleURLTypesObj.GetType()), "CFBundleURLTypes isn't an NSArray.")) { BundleURLTypes = new NSSet(((NSArray)BundleURLTypesObj).GetArray()); } } } if (BundleURLTypes == null) { BundleURLTypes = new NSSet(); } bool bAlreadyExists = false; foreach (NSObject CurrentURLType in BundleURLTypes) { if (bAlreadyExists) { break; } if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(CurrentURLType.GetType()), "One of the CFBundleURLTypes isn't an NSDictionary.")) { NSDictionary CurrentURLTypeDict = (NSDictionary)CurrentURLType; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLTypeDict != null, "One of the CFBundleURLTypes didn't cast to NSDictionary correctly.")) { if (CurrentURLTypeDict.ContainsKey("CFBundleURLSchemes")) { NSObject CurrentURLSchemesArrayObj = CurrentURLTypeDict.Get("CFBundleURLSchemes"); if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(CurrentURLSchemesArrayObj.GetType()), "A CFBundleURLSchemes key exists for a given CFBundleURLType, but it's not an NSArray type.")) { NSArray CurrentURLSchemesArray = (NSArray)CurrentURLSchemesArrayObj; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLSchemesArray != null, "The CFBundleURLSchemes object didn't cast to NSDictionary correctly.")) { NSSet CurrentURLSchemesSet = new NSSet(CurrentURLSchemesArray.GetArray()); foreach (NSObject CurrentURLSchemeObj in CurrentURLSchemesSet) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSString).IsAssignableFrom(CurrentURLSchemeObj.GetType()), "One of the CFBundleURLSchemes is not an NSString.")) { NSString CurrentURLScheme = (NSString)CurrentURLSchemeObj; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLScheme != null, "A CFBundleURLScheme entry didn't cast to NSString correctly.")) { if (CurrentURLScheme.GetContent() == NewURLScheme) { bAlreadyExists = true; IgorDebug.Log(ModuleInst, "URL scheme " + NewURLScheme + " is already in " + PlistPath); break; } } } } } } } } } } if (!bAlreadyExists) { NSString NewSchemeString = new NSString(NewURLScheme); NSArray NewSchemeArray = new NSArray(1); NewSchemeArray.SetValue(0, NewSchemeString); NSDictionary NewTypeDictionary = new NSDictionary(); NewTypeDictionary.Add("CFBundleURLSchemes", NewSchemeArray); BundleURLTypes.AddObject(NewTypeDictionary); NSArray BundleURLTypesArray = new NSArray(BundleURLTypes.AllObjects()); if (RootDictionary.ContainsKey("CFBundleURLTypes")) { RootDictionary["CFBundleURLTypes"] = BundleURLTypesArray; IgorDebug.Log(ModuleInst, "Updated CFBundleURLTypes to add " + NewURLScheme + "."); } else { RootDictionary.Add("CFBundleURLTypes", BundleURLTypesArray); IgorDebug.Log(ModuleInst, "Added CFBundleURLTypes to add " + NewURLScheme + "."); } IgorRuntimeUtils.DeleteFile(PlistPath); PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo); } } } } } }
public virtual bool BuildAndroidProj() { List <string> BuildProducts = IgorCore.GetModuleProducts(); if (IgorAssert.EnsureTrue(this, BuildProducts.Count > 0, "Building the Android project, but there were no previous built products.")) { Log("Project should be saved to " + EditorUserBuildSettings.GetBuildLocation(BuildTarget.Android)); string BuiltProjectDir = Path.Combine(BuildProducts[0], PlayerSettings.productName); if (!RunAndroidCommandLineUtility(this, BuiltProjectDir, "update project --path ." + AndroidProjectUpdateAdditionalArgs)) { return(true); } string BuildXML = Path.Combine(BuiltProjectDir, "build.xml"); if (!IgorAssert.EnsureTrue(this, File.Exists(BuildXML), "Can't check " + BuildXML + " for APK name because it doesn't exist.")) { return(false); } string BuildXMLFileContents = File.ReadAllText(BuildXML); int ProjectNameParamStart = BuildXMLFileContents.IndexOf("<project name=\"") + "<project name=\"".Length; int ProjectNameParamEnd = BuildXMLFileContents.IndexOf("\"", ProjectNameParamStart); string APKName = BuildXMLFileContents.Substring(ProjectNameParamStart, ProjectNameParamEnd - ProjectNameParamStart); if (!RunAnt(this, BuiltProjectDir, "clean debug")) { return(true); } Log("Debug APK built!"); string DebugSignedAPK = Path.Combine(BuiltProjectDir, Path.Combine("bin", APKName + "-debug.apk")); string AppropriatelySignedAPK = DebugSignedAPK; if (IgorJobConfig.IsBoolParamSet(AndroidResignInReleaseFlag)) { Log("Re-signing the APK for release."); string RepackageDir = Path.Combine(BuildProducts[0], "Repackage"); if (!ResignAPK(this, DebugSignedAPK, RepackageDir, ref AppropriatelySignedAPK, GetParamOrConfigString(AndroidKeystoreFilenameFlag, "Android Keystore filename isn't set, but you want to re-sign the APK!"), GetParamOrConfigString(AndroidKeystorePassFlag, "Android Keystore password isn't set, but you want to re-sign the APK!"), GetParamOrConfigString(AndroidKeyAliasFlag, "Android Key Alias isn't set, but you want to re-sign the APK!"), GetParamOrConfigString(AndroidKeyAliasPassFlag, "Android Key Alias password isn't set, but you want to re-sign the APK!"))) { return(true); } Log("Re-signing the APK succeeded!"); } string FinalBuildProductName = GetBuiltNameForTarget(BuildTarget.Android); if (File.Exists(FinalBuildProductName)) { IgorRuntimeUtils.DeleteFile(FinalBuildProductName); } IgorRuntimeUtils.CopyFile(AppropriatelySignedAPK, FinalBuildProductName); List <string> NewBuildProducts = new List <string>(); if (IgorAssert.EnsureTrue(this, File.Exists(AppropriatelySignedAPK), "The built APK " + AppropriatelySignedAPK + " doesn't exist. Something went wrong during the build step. Please check the logs!")) { NewBuildProducts.Add(AppropriatelySignedAPK); } IgorCore.SetNewModuleProducts(NewBuildProducts); Log("APK built and renamed to " + AppropriatelySignedAPK + "."); } return(true); }
public virtual bool Build(BuildOptions PlatformSpecificOptions) { if (!IgorAssert.EnsureTrue(this, GetAndroidSDKPath(this) != "", "Android SDK path is not set!")) { return(true); } PlayerSettings.Android.keystorePass = GetParamOrConfigString(AndroidKeystorePassFlag, "Your Android Keystore Password isn't set! We won't be able to sign your application!"); PlayerSettings.Android.keyaliasPass = GetParamOrConfigString(AndroidKeyAliasPassFlag, "Your Android Key Alias Password isn't set! We won't be able to sign your application!"); if (PlayerSettings.Android.keystorePass == "" || PlayerSettings.Android.keyaliasPass == "") { return(true); } FixReadOnlyFilesIn3rdPartyLibs(); string AndroidProjDirectory = Path.Combine(Path.GetFullPath("."), "Android"); if (AndroidProjDirectory.Contains(" ")) { AndroidProjDirectory = Path.Combine(Path.GetTempPath() + PlayerSettings.productName, "Android"); } if (Directory.Exists(AndroidProjDirectory)) { IgorRuntimeUtils.DeleteDirectory(AndroidProjDirectory); } string FullBuiltPath = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), GetBuiltNameForTarget(BuildTarget.Android)); if (File.Exists(FullBuiltPath)) { IgorRuntimeUtils.DeleteFile(FullBuiltPath); } // We need to force create the directory before we use it or it will prompt us for a path to build to Directory.CreateDirectory(AndroidProjDirectory); Log("Android project destination directory is: " + AndroidProjDirectory); EditorUserBuildSettings.symlinkLibraries = true; EditorUserBuildSettings.exportAsGoogleAndroidProject = true; EditorUserBuildSettings.SetBuildLocation(BuildTarget.Android, AndroidProjDirectory); BuildOptions AllOptions = PlatformSpecificOptions | BuildOptions.AcceptExternalModificationsToPlayer; AllOptions |= GetExternalBuildOptions(JobBuildTarget); BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), AndroidProjDirectory, BuildTarget.Android, AllOptions); CopyActivityOverrideSourceFiles(AndroidProjDirectory); List <string> BuiltFiles = new List <string>(); BuiltFiles.Add(AndroidProjDirectory); IgorCore.SetNewModuleProducts(BuiltFiles); Log("Android Eclipse project has been created."); return(true); }