Exemplo n.º 1
0
        bool IsMatchingArch(ITypemap tm)
        {
            bool matches;

            switch (tm.MapArchitecture)
            {
            case MapArchitecture.ARM:
                matches = (archFilter & AndroidArch.ARM) == AndroidArch.ARM;
                break;

            case MapArchitecture.ARM64:
                matches = (archFilter & AndroidArch.ARM64) == AndroidArch.ARM64;
                break;

            case MapArchitecture.X86:
                matches = (archFilter & AndroidArch.X86) == AndroidArch.X86;
                break;

            case MapArchitecture.X86_64:
                matches = (archFilter & AndroidArch.X86_64) == AndroidArch.X86_64;
                break;

            case MapArchitecture.FastDev:
                return(true);

            default:
                throw new NotSupportedException($"Type map architecture {tm.Map.Architecture} is not supported");
            }

            return(matches);
        }
Exemplo n.º 2
0
        public void Generate(ITypemap typemap)
        {
            string baseOutputFile = generateFiles ? Utilities.GetOutputFileBaseName(outputDirectory, typemap.FormatVersion, typemap.Map.Kind, typemap.Map.Architecture) : String.Empty;
            Action <StreamWriter, MapEntry, bool, bool> fileGenerator;
            Action <MapEntry, bool> consoleGenerator;
            bool filtering = filterRegex != null;

            if (!onlyManaged)
            {
                typemap.Map.JavaToManaged.Sort((MapEntry left, MapEntry right) => left.JavaType.Name.CompareTo(right.JavaType.Name));
                if (typemap.Map.Kind == MapKind.Release)
                {
                    fileGenerator    = FileGenerateJavaToManagedRelease;
                    consoleGenerator = ConsoleGenerateJavaToManagedRelease;
                }
                else
                {
                    fileGenerator    = FileGenerateJavaToManagedDebug;
                    consoleGenerator = ConsoleGenerateJavaToManagedDebug;
                }

                Generate(
                    filtering ? "Java to Managed" : "Java to Managed output file",
                    Utilities.GetJavaOutputFileName(baseOutputFile, "txt"),
                    typemap.Map.JavaToManaged,
                    full,
                    fileGenerator,
                    consoleGenerator
                    );
            }

            if (!onlyJava)
            {
                typemap.Map.ManagedToJava.Sort((MapEntry left, MapEntry right) => {
                    int result = String.Compare(left.ManagedType.AssemblyName, right.ManagedType.AssemblyName, StringComparison.OrdinalIgnoreCase);
                    if (result != 0)
                    {
                        return(result);
                    }

                    return(left.ManagedType.TypeName.CompareTo(right.ManagedType.TypeName));
                });

                if (typemap.Map.Kind == MapKind.Release)
                {
                    fileGenerator    = FileGenerateManagedToJavaRelease;
                    consoleGenerator = ConsoleGenerateManagedToJavaRelease;
                }
                else
                {
                    fileGenerator    = FileGenerateManagedToJavaDebug;
                    consoleGenerator = ConsoleGenerateManagedToJavaDebug;
                }

                Generate(
                    filtering ? "Managed to Java" : "Managed to Java output file",
                    Utilities.GetManagedOutputFileName(baseOutputFile, "txt"),
                    typemap.Map.ManagedToJava,
                    full,
                    fileGenerator,
                    consoleGenerator
                    );
            }
        }