public override System.Threading.Tasks.Task RunTaskAsync() { resourceDirectory = ResourceDirectory.TrimEnd('\\'); if (!Path.IsPathRooted(resourceDirectory)) { resourceDirectory = Path.Combine(WorkingDirectory, resourceDirectory); } assemblyMap.Load(Path.Combine(WorkingDirectory, AssemblyIdentityMapFile)); return(this.WhenAll(ManifestFiles, ProcessManifest)); }
public override System.Threading.Tasks.Task RunTaskAsync() { resourceDirectory = ResourceDirectory.TrimEnd('\\'); if (!Path.IsPathRooted(resourceDirectory)) { resourceDirectory = Path.Combine(WorkingDirectory, resourceDirectory); } resource_name_case_map = MonoAndroidHelper.LoadResourceCaseMap(ResourceNameCaseMap); assemblyMap.Load(Path.Combine(WorkingDirectory, AssemblyIdentityMapFile)); return(this.WhenAll(ManifestFiles, ProcessManifest)); }
public override bool Execute() { Log.LogDebugMessage("Aapt Task"); Log.LogDebugMessage(" AssetDirectory: {0}", AssetDirectory); Log.LogDebugTaskItems(" ManifestFiles: ", ManifestFiles); Log.LogDebugMessage(" ResourceDirectory: {0}", ResourceDirectory); Log.LogDebugMessage(" JavaDesignerOutputDirectory: {0}", JavaDesignerOutputDirectory); Log.LogDebugMessage(" PackageName: {0}", PackageName); Log.LogDebugMessage(" UncompressedFileExtensions: {0}", UncompressedFileExtensions); Log.LogDebugMessage(" ExtraPackages: {0}", ExtraPackages); Log.LogDebugTaskItems(" AdditionalResourceDirectories: ", AdditionalResourceDirectories); Log.LogDebugTaskItems(" AdditionalAndroidResourcePaths: ", AdditionalAndroidResourcePaths); Log.LogDebugTaskItems(" LibraryProjectJars: ", LibraryProjectJars); Log.LogDebugMessage(" ExtraArgs: {0}", ExtraArgs); Log.LogDebugMessage(" CreatePackagePerAbi: {0}", CreatePackagePerAbi); Log.LogDebugMessage(" ResourceNameCaseMap: {0}", ResourceNameCaseMap); Log.LogDebugMessage(" VersionCodePattern: {0}", VersionCodePattern); Log.LogDebugMessage(" VersionCodeProperties: {0}", VersionCodeProperties); if (CreatePackagePerAbi) { Log.LogDebugMessage(" SupportedAbis: {0}", SupportedAbis); } resourceDirectory = ResourceDirectory.TrimEnd('\\'); if (!Path.IsPathRooted(resourceDirectory)) { resourceDirectory = Path.Combine(WorkingDirectory, resourceDirectory); } Yield(); try { var task = ThreadingTasks.Task.Run(() => { DoExecute(); }, Token); task.ContinueWith(Complete); base.Execute(); } finally { Reacquire(); } return(!Log.HasLoggedErrors); }
public override bool Execute() { resourceDirectory = ResourceDirectory.TrimEnd('\\'); if (!Path.IsPathRooted(resourceDirectory)) { resourceDirectory = Path.Combine(WorkingDirectory, resourceDirectory); } Yield(); try { var task = this.RunTask(DoExecute); task.ContinueWith(Complete); base.Execute(); } finally { Reacquire(); } return(!Log.HasLoggedErrors); }
protected string GenerateCommandLineCommands(string ManifestFile, string currentAbi, string currentResourceOutputFile) { // For creating Resource.Designer.cs: // Running command: C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt // "package" // "-M" "C:\Users\Jonathan\AppData\Local\Temp\ryob4gaw.way\AndroidManifest.xml" // "-J" "C:\Users\Jonathan\AppData\Local\Temp\ryob4gaw.way" // "-F" "C:\Users\Jonathan\AppData\Local\Temp\ryob4gaw.way\resources.apk" // "-S" "c:\users\jonathan\documents\visual studio 2010\Projects\MonoAndroidApplication4\MonoAndroidApplication4\obj\Debug\res" // "-I" "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-8\android.jar" // "--max-res-version" "10" // For packaging: // Running command: C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt // "package" // "-f" // "-m" // "-M" "AndroidManifest.xml" // "-J" "src" // "--custom-package" "androidmsbuildtest.androidmsbuildtest" // "-F" "bin\packaged_resources" // "-S" "C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\AndroidMSBuildTest\AndroidMSBuildTest\obj\Debug\res" // "-I" "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-8\android.jar" // "--extra-packages" "com.facebook.android:my.another.library" var cmd = new CommandLineBuilder(); cmd.AppendSwitch("package"); if (MonoAndroidHelper.LogInternalExceptions) { cmd.AppendSwitch("-v"); } if (NonConstantId) { cmd.AppendSwitch("--non-constant-id"); } cmd.AppendSwitch("-f"); cmd.AppendSwitch("-m"); string manifestFile; string manifestDir = Path.Combine(Path.GetDirectoryName(ManifestFile), currentAbi != null ? currentAbi : "manifest"); Directory.CreateDirectory(manifestDir); manifestFile = Path.Combine(manifestDir, Path.GetFileName(ManifestFile)); ManifestDocument manifest = new ManifestDocument(ManifestFile, this.Log); if (currentAbi != null) { manifest.SetAbi(currentAbi); } manifest.ApplicationName = ApplicationName; manifest.Save(manifestFile); cmd.AppendSwitchIfNotNull("-M ", manifestFile); Directory.CreateDirectory(JavaDesignerOutputDirectory); cmd.AppendSwitchIfNotNull("-J ", JavaDesignerOutputDirectory); if (PackageName != null) { cmd.AppendSwitchIfNotNull("--custom-package ", PackageName.ToLowerInvariant()); } if (!string.IsNullOrEmpty(currentResourceOutputFile)) { cmd.AppendSwitchIfNotNull("-F ", currentResourceOutputFile + ".bk"); } // The order of -S arguments is *important*, always make sure this one comes FIRST cmd.AppendSwitchIfNotNull("-S ", ResourceDirectory.TrimEnd('\\')); if (AdditionalResourceDirectories != null) { foreach (var resdir in AdditionalResourceDirectories) { cmd.AppendSwitchIfNotNull("-S ", resdir.ItemSpec.TrimEnd('\\')); } } if (AdditionalAndroidResourcePaths != null) { foreach (var dir in AdditionalAndroidResourcePaths) { cmd.AppendSwitchIfNotNull("-S ", Path.Combine(dir.ItemSpec.TrimEnd(System.IO.Path.DirectorySeparatorChar), "res")); } } if (LibraryProjectJars != null) { foreach (var jar in LibraryProjectJars) { cmd.AppendSwitchIfNotNull("-j ", jar); } } cmd.AppendSwitchIfNotNull("-I ", JavaPlatformJarPath); // Add asset directory if it exists if (!string.IsNullOrWhiteSpace(AssetDirectory) && Directory.Exists(AssetDirectory)) { cmd.AppendSwitchIfNotNull("-A ", AssetDirectory.TrimEnd('\\')); } if (!string.IsNullOrWhiteSpace(UncompressedFileExtensions)) { foreach (var ext in UncompressedFileExtensions.Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries)) { cmd.AppendSwitchIfNotNull("-0 ", ext); } } if (!string.IsNullOrEmpty(ExtraPackages)) { cmd.AppendSwitchIfNotNull("--extra-packages ", ExtraPackages); } // TODO: handle resource names if (ExplicitCrunch) { cmd.AppendSwitch("--no-crunch"); } cmd.AppendSwitch("--auto-add-overlay"); var extraArgsExpanded = ExpandString(ExtraArgs); if (extraArgsExpanded != ExtraArgs) { Log.LogDebugMessage(" ExtraArgs expanded: {0}", extraArgsExpanded); } if (!string.IsNullOrWhiteSpace(extraArgsExpanded)) { cmd.AppendSwitch(extraArgsExpanded); } if (!AndroidUseLatestPlatformSdk) { cmd.AppendSwitchIfNotNull("--max-res-version ", ApiLevel); } return(cmd.ToString()); }