Ejemplo n.º 1
0
        public override bool RunTask()
        {
            Aot.TryGetSequencePointsMode(AndroidSequencePointsMode, out sequencePointsMode);

            var outputFiles = new List <string> ();

            uncompressedFileExtensions = UncompressedFileExtensions?.Split(new char [] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries) ?? new string [0];

            existingEntries.Clear();

            bool debug    = _Debug;
            bool compress = !debug && EnableCompression;
            IDictionary <string, CompressedAssemblyInfo> compressedAssembliesInfo = null;

            if (compress)
            {
                string key = CompressedAssemblyInfo.GetKey(ProjectFullPath);
                Log.LogDebugMessage($"Retrieving assembly compression info with key '{key}'");
                compressedAssembliesInfo = BuildEngine4.UnregisterTaskObject(key, RegisteredTaskObjectLifetime.Build) as IDictionary <string, CompressedAssemblyInfo>;
                if (compressedAssembliesInfo == null)
                {
                    throw new InvalidOperationException($"Assembly compression info not found for key '{key}'. Compression will not be performed.");
                }
            }

            ExecuteWithAbi(SupportedAbis, ApkInputPath, ApkOutputPath, debug, compress, compressedAssembliesInfo);
            outputFiles.Add(ApkOutputPath);
            if (CreatePackagePerAbi && SupportedAbis.Length > 1)
            {
                foreach (var abi in SupportedAbis)
                {
                    existingEntries.Clear();
                    var path = Path.GetDirectoryName(ApkOutputPath);
                    var apk  = Path.GetFileNameWithoutExtension(ApkOutputPath);
                    ExecuteWithAbi(new [] { abi }, String.Format("{0}-{1}", ApkInputPath, abi),
                                   Path.Combine(path, String.Format("{0}-{1}.apk", apk, abi)),
                                   debug, compress, compressedAssembliesInfo);
                    outputFiles.Add(Path.Combine(path, String.Format("{0}-{1}.apk", apk, abi)));
                }
            }

            OutputFiles = outputFiles.Select(a => new TaskItem(a)).ToArray();

            Log.LogDebugTaskItems("  [Output] OutputFiles :", OutputFiles);

            return(!Log.HasLoggedErrors);
        }
Ejemplo n.º 2
0
        public override bool Execute()
        {
            var logger = new Logger(Log);

            var sandbox = BuildEngine4.GetRegisteredTaskObject(BuildEngine.ProjectFileOfTaskNode, RegisteredTaskObjectLifetime.Build) as Sanbox;

            if (sandbox == null)
            {
                return(true);
            }

            try
            {
                sandbox.Dispose();
                BuildEngine4.UnregisterTaskObject(BuildEngine.ProjectFileOfTaskNode, RegisteredTaskObjectLifetime.Build);
            }
            catch (Exception e)
            {
                logger.Error($"Failure cleanup task failed. Details: {e.GetBaseException().Message}");
            }

            return(!Log.HasLoggedErrors);
        }