Ejemplo n.º 1
0
        public static string GetDebugServerFileName(AndroidDebugServer server)
        {
            switch (server)
            {
            case AndroidDebugServer.Gdb:
                return "libgdbserver.so";
            case AndroidDebugServer.Ds2:
                return "libds2.so";
            case AndroidDebugServer.Llgs:
                throw new NotImplementedException ();
            }

            return null;
        }
Ejemplo n.º 2
0
        public static string GetDebugServerPath(AndroidDebugServer server, AndroidTargetArch arch,
            string AndroidNdkDirectory, string SdkBinDirectory)
        {
            switch (server)
            {
            case AndroidDebugServer.Gdb:
                var abi  = GetAbiFromArch (arch);
                return Path.Combine (AndroidNdkDirectory, "prebuilt", abi, "gdbserver", "gdbserver");
            case AndroidDebugServer.Ds2:
                return Path.Combine (SdkBinDirectory, "ds2-" + arch.ToString ().ToLowerInvariant ());
            case AndroidDebugServer.Llgs:
                throw new NotImplementedException ();
            }

            return null;
        }
Ejemplo n.º 3
0
        public static string GetDebugServerFileName(AndroidDebugServer server)
        {
            switch (server)
            {
            case AndroidDebugServer.Gdb:
                return("libgdbserver.so");

            case AndroidDebugServer.Ds2:
                return("libds2.so");

            case AndroidDebugServer.Llgs:
                throw new NotImplementedException();
            }

            return(null);
        }
Ejemplo n.º 4
0
        public static string GetDebugServerPath(AndroidDebugServer server, AndroidTargetArch arch,
                                                string AndroidNdkDirectory, string SdkBinDirectory)
        {
            switch (server)
            {
            case AndroidDebugServer.Gdb:
                var abi = GetAbiFromArch(arch);
                return(Path.Combine(AndroidNdkDirectory, "prebuilt", abi, "gdbserver", "gdbserver"));

            case AndroidDebugServer.Ds2:
                return(Path.Combine(SdkBinDirectory, "ds2-" + arch.ToString().ToLowerInvariant()));

            case AndroidDebugServer.Llgs:
                throw new NotImplementedException();
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void AddGdbservers(ZipFile 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));
            }
        }
Ejemplo n.º 6
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.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;
        }
Ejemplo n.º 7
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));
            }
        }
Ejemplo n.º 8
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);
        }