示例#1
0
        private void AddGdbservers(ZipArchive apk, ArchiveFileList files, string supportedAbis, AndroidDebugServer debugServer)
        {
            if (string.IsNullOrEmpty(AndroidNdkDirectory))
            {
                return;
            }

            foreach (var sabi in supportedAbis.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries))
            {
                var arch = GdbPaths.GetArchFromAbi(sabi);
                var abi  = GdbPaths.GetAbiFromArch(arch);
                if (abi == null)
                {
                    continue;
                }
                var debugServerFile = GdbPaths.GetDebugServerFileName(debugServer);
                if (files.Any(f => string.Equals(Path.GetFileName(f.Item1), debugServerFile, StringComparison.Ordinal) &&
                              string.Equals(f.Item2, "lib/" + sabi, StringComparison.Ordinal)))
                {
                    continue;
                }
                var entryName       = string.Format("lib/{0}/{1}", sabi, debugServerFile);
                var debugServerPath = GdbPaths.GetDebugServerPath(debugServer, arch, AndroidNdkDirectory, SdkBinDirectory);
                if (!File.Exists(debugServerPath))
                {
                    continue;
                }
                Log.LogDebugMessage("Adding {0} debug server '{1}' to the APK as '{2}'", sabi, debugServerPath, entryName);
                apk.AddEntry(entryName, File.OpenRead(debugServerPath));
            }
        }
示例#2
0
        public override bool Execute()
        {
            Log.LogDebugMessage("BuildApk Task");
            Log.LogDebugMessage("  ApkInputPath: {0}", ApkInputPath);
            Log.LogDebugMessage("  ApkOutputPath: {0}", ApkOutputPath);
            Log.LogDebugMessage("  BundleAssemblies: {0}", BundleAssemblies);
            Log.LogDebugTaskItems("  DalvikClasses:", DalvikClasses);
            Log.LogDebugMessage("  SupportedAbis: {0}", SupportedAbis);
            Log.LogDebugMessage("  UseSharedRuntime: {0}", UseSharedRuntime);
            Log.LogDebugMessage("  Debug: {0}", Debug ?? "no");
            Log.LogDebugMessage("  EmbedAssemblies: {0}", EmbedAssemblies);
            Log.LogDebugMessage("  AndroidAotMode: {0}", AndroidAotMode);
            Log.LogDebugMessage("  AndroidSequencePointsMode: {0}", AndroidSequencePointsMode);
            Log.LogDebugMessage("  CreatePackagePerAbi: {0}", CreatePackagePerAbi);
            Log.LogDebugTaskItems("  Environments:", Environments);
            Log.LogDebugTaskItems("  ResolvedUserAssemblies:", ResolvedUserAssemblies);
            Log.LogDebugTaskItems("  ResolvedFrameworkAssemblies:", ResolvedFrameworkAssemblies);
            Log.LogDebugTaskItems("  NativeLibraries:", NativeLibraries);
            Log.LogDebugTaskItems("  AdditionalNativeLibraryReferences:", AdditionalNativeLibraryReferences);
            Log.LogDebugTaskItems("  BundleNativeLibraries:", BundleNativeLibraries);
            Log.LogDebugTaskItems("  JavaSourceFiles:", JavaSourceFiles);
            Log.LogDebugTaskItems("  JavaLibraries:", JavaLibraries);
            Log.LogDebugTaskItems("  LibraryProjectJars:", LibraryProjectJars);
            Log.LogDebugTaskItems("  AdditionalNativeLibraryReferences:", AdditionalNativeLibraryReferences);
            Log.LogDebugTaskItems("  HttpClientHandlerType:", HttpClientHandlerType);

            Aot.TryGetSequencePointsMode(AndroidSequencePointsMode, out sequencePointsMode);

            var androidDebugServer = GdbPaths.GetAndroidDebugServer(AndroidGdbDebugServer);

            if (!androidDebugServer.HasValue)
            {
                Log.LogError("Unable to determine debug server variant: {0}", AndroidGdbDebugServer);
                return(false);
            }
            debugServer = androidDebugServer.Value;

            if (string.IsNullOrEmpty(AndroidEmbedProfilers) && _Debug)
            {
                AndroidEmbedProfilers = "log";
            }

            var outputFiles = new List <string> ();

            ExecuteWithAbi(SupportedAbis, ApkInputPath, ApkOutputPath);
            outputFiles.Add(ApkOutputPath);
            if (CreatePackagePerAbi)
            {
                var abis = SupportedAbis.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (abis.Length > 1)
                {
                    foreach (var abi in abis)
                    {
                        var path = Path.GetDirectoryName(ApkOutputPath);
                        var apk  = Path.GetFileNameWithoutExtension(ApkOutputPath);
                        ExecuteWithAbi(abi, String.Format("{0}-{1}", ApkInputPath, abi),
                                       Path.Combine(path, String.Format("{0}-{1}.apk", apk, abi)));
                        outputFiles.Add(Path.Combine(path, String.Format("{0}-{1}.apk", apk, abi)));
                    }
                }
            }

            BuildId = buildId.ToString();

            Log.LogDebugMessage("  [Output] BuildId: {0}", BuildId);

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

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

            return(!Log.HasLoggedErrors);
        }