private string CreateBaseModule(DirectoryInfo baseWorkingDirectory, out IList <string> bundleMetadata) { DisplayProgress("Creating base module", ProgressCreateBaseModule); var sourceDirectoryInfo = baseWorkingDirectory.CreateSubdirectory("source"); var unzipErrorMessage = _zipUtils.UnzipFile(AndroidPlayerFilePath, sourceDirectoryInfo.FullName); if (unzipErrorMessage != null) { bundleMetadata = null; return(DisplayBuildError("Unzip", unzipErrorMessage)); } bundleMetadata = GetExistingBundleMetadata(sourceDirectoryInfo); var destinationDirectoryInfo = GetDestinationSubdirectory(baseWorkingDirectory); var baseModuleDirectories = sourceDirectoryInfo.GetDirectories(AndroidAppBundle.BaseModuleName); if (baseModuleDirectories.Length != 1) { return(DisplayBuildError("Find base directory", sourceDirectoryInfo.FullName)); } ArrangeFilesForExistingModule(baseModuleDirectories[0], destinationDirectoryInfo); return(null); }
private string CreateBaseModule(DirectoryInfo baseWorkingDirectory, out IList <string> bundleMetadata) { string zipFilePath; var sourceDirectoryInfo = baseWorkingDirectory.CreateSubdirectory("source"); if (UseNativeAppBundleSupport) { DisplayProgress(CreatingBaseModuleMessage, ProgressCreateBaseModule); zipFilePath = AndroidPlayerFilePath; } else { // If this version of Unity natively supports AABs, note that switching the Android Build System // to Gradle will generally speed up the build due to the slow "aapt2 convert" step. var messageSuffix = SuggestNativeAppBundleSupport ? " (switch to Gradle for faster builds)" : " (this may be slow)"; DisplayProgress(CreatingBaseModuleMessage + messageSuffix, ProgressCreateBaseModule); zipFilePath = Path.Combine(baseWorkingDirectory.FullName, "AndroidPlayer.zip"); var aaptErrorMessage = _androidAssetPackagingTool.Convert(AndroidPlayerFilePath, zipFilePath); if (aaptErrorMessage != null) { bundleMetadata = null; return(DisplayBuildError("AAPT2 convert", aaptErrorMessage)); } DisplayProgress("Extracting base module", 0.45f); } var unzipErrorMessage = _zipUtils.UnzipFile(zipFilePath, sourceDirectoryInfo.FullName); if (unzipErrorMessage != null) { bundleMetadata = null; return(DisplayBuildError("Unzip", unzipErrorMessage)); } bundleMetadata = GetExistingBundleMetadata(sourceDirectoryInfo); var destinationDirectoryInfo = GetDestinationSubdirectory(baseWorkingDirectory); if (UseNativeAppBundleSupport) { var baseModuleDirectories = sourceDirectoryInfo.GetDirectories(AndroidAppBundle.BaseModuleName); if (baseModuleDirectories.Length != 1) { return(DisplayBuildError("Find base directory", sourceDirectoryInfo.FullName)); } ArrangeFilesForExistingModule(baseModuleDirectories[0], destinationDirectoryInfo); } else { ArrangeFilesForNewModule(sourceDirectoryInfo, destinationDirectoryInfo); } return(null); }