diff --git a/Source/Editor/Cooker/Platform/iOS/iOSPlatformTools.cpp b/Source/Editor/Cooker/Platform/iOS/iOSPlatformTools.cpp index 1f8c84551..9f2087cac 100644 --- a/Source/Editor/Cooker/Platform/iOS/iOSPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/iOS/iOSPlatformTools.cpp @@ -69,7 +69,7 @@ void iOSPlatformTools::OnBuildStarted(CookingData& data) { // Adjust the cooking output folders for packaging app const auto appName = GetAppName(); - String contents = appName + TEXT(".app/"); + String contents = String(TEXT("/Payload/")) / appName + TEXT(".app/"); data.DataOutputPath /= contents; data.NativeCodeOutputPath /= contents; data.ManagedCodeOutputPath /= contents; @@ -160,6 +160,13 @@ bool iOSPlatformTools::OnPostProcess(CookingData& data) return true; } FileSystem::DeleteDirectory(tmpFolderPath); + String iTunesArtworkPath = data.OriginalOutputPath / TEXT("iTunesArtwork.png"); + if (EditorUtilities::ExportApplicationImage(iconData, 512, 512, PixelFormat::R8G8B8A8_UNorm, iTunesArtworkPath)) + { + LOG(Error, "Failed to export application icon."); + return true; + } + FileSystem::MoveFile(data.OriginalOutputPath / TEXT("iTunesArtwork"), iTunesArtworkPath, true); } // Create PkgInfo file @@ -238,27 +245,24 @@ bool iOSPlatformTools::OnPostProcess(CookingData& data) } } - // TODO: sign binaries - // TODO: expose event to inject custom post-processing before app packaging (eg. third-party plugins) - + // Package application - /*const auto buildSettings = BuildSettings::Get(); + const auto buildSettings = BuildSettings::Get(); if (buildSettings->SkipPackaging) return false; GameCooker::PackageFiles(); LOG(Info, "Building app package..."); - const String dmgPath = data.OriginalOutputPath / appName + TEXT(".dmg"); - const String dmgCommand = String::Format(TEXT("hdiutil create {0}.dmg -volname {0} -fs HFS+ -srcfolder {0}.app"), appName); - const int32 result = Platform::RunProcess(dmgCommand, data.OriginalOutputPath); + const String ipaPath = data.OriginalOutputPath / appName + TEXT(".ipa"); + const String ipaCommand = String::Format(TEXT("zip -r -X {0}.ipa Payload iTunesArtwork"), appName); + const int32 result = Platform::RunProcess(ipaCommand, data.OriginalOutputPath); if (result != 0) { data.Error(TEXT("Failed to package app (result code: {0}). See log for more info."), result); return true; } - // TODO: sign dmg - LOG(Info, "Output application package: {0} (size: {1} MB)", dmgPath, FileSystem::GetFileSize(dmgPath) / 1024 / 1024); -*/ + LOG(Info, "Output application package: {0} (size: {1} MB)", ipaPath, FileSystem::GetFileSize(ipaPath) / 1024 / 1024); + return false; } diff --git a/Source/Tools/Flax.Build/Build/Assembler.cs b/Source/Tools/Flax.Build/Build/Assembler.cs index da22b3865..be4990087 100644 --- a/Source/Tools/Flax.Build/Build/Assembler.cs +++ b/Source/Tools/Flax.Build/Build/Assembler.cs @@ -20,6 +20,7 @@ namespace Flax.Build /// public class Assembler { + internal static string CacheFileName = "BuilderRules.dll"; private string _cacheFolderPath; /// @@ -70,7 +71,7 @@ namespace Flax.Build string cacheAssemblyPath = null, cacheInfoPath = null, buildInfo = null; if (_cacheFolderPath != null) { - cacheAssemblyPath = Path.Combine(_cacheFolderPath, "BuilderRules.dll"); + cacheAssemblyPath = Path.Combine(_cacheFolderPath, CacheFileName); cacheInfoPath = Path.Combine(_cacheFolderPath, "BuilderRulesInfo.txt"); foreach (var sourceFile in SourceFiles) @@ -162,7 +163,7 @@ namespace Flax.Build syntaxTrees.Add(parsedSyntaxTree); } - var compilation = CSharpCompilation.Create("BuilderRulesCache.dll", syntaxTrees.ToArray(), defaultReferences, defaultCompilationOptions); + var compilation = CSharpCompilation.Create(CacheFileName, syntaxTrees.ToArray(), defaultReferences, defaultCompilationOptions); EmitResult emitResult = compilation.Emit(memoryStream); // Process warnings and errors diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetAOT.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetAOT.cs index a4aa722cc..8a7050c9c 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetAOT.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetAOT.cs @@ -500,7 +500,8 @@ namespace Flax.Build return true; // Skip Flax.Build rules assembly - if (Path.GetFileName(x) == "BuilderRulesCache.dll") + var fileName = Path.GetFileName(x); + if (fileName == Assembler.CacheFileName || fileName == "BuilderRulesCache.dll") return true; // Skip non-C# DLLs diff --git a/Source/Tools/Flax.Build/Program.cs b/Source/Tools/Flax.Build/Program.cs index 17bd2050c..5e7cf926c 100644 --- a/Source/Tools/Flax.Build/Program.cs +++ b/Source/Tools/Flax.Build/Program.cs @@ -172,7 +172,7 @@ namespace Flax.Build catch (Exception ex) { Log.Exception(ex); - return 1; + failed = true; } finally {