예제 #1
0
 static string GetAndroidInputLibDir(Runtime runtime)
 {
     return(Path.Combine(MonoRuntimesHelpers.GetRootDir(runtime), "lib"));
 }
예제 #2
0
        static string GetCrossRuntimeOutputSourcePath(Runtime runtime)
        {
            var crossRuntime = EnsureRuntimeType <MonoCrossRuntime> (runtime, "cross compilation");

            return(Path.Combine(MonoRuntimesHelpers.GetRootDir(runtime), "bin", $"{crossRuntime.ExePrefix}mono-sgen{crossRuntime.ExeSuffix}"));
        }
        void EnsureAllSDKHeadersAreIncluded(Context context, Runtimes allRuntimes)
        {
            string topDirTail = Configurables.Paths.MonoSDKRelativeIncludeSourceDir;

            if (!topDirTail.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
            {
                topDirTail += Path.DirectorySeparatorChar;
            }

            // Find first enabled runtime - all headers are the same across all runtimes, so we don't care
            // where they come from.
            Runtime runtime = MonoRuntimesHelpers.GetEnabledRuntimes(allRuntimes, enableLogging: false)?.FirstOrDefault();

            if (runtime == null)
            {
                Log.WarningLine("No enabled runtimes (?!)");
                return;
            }

            string runtimeIncludeDirRoot        = Path.Combine(Configurables.Paths.MonoSourceFullPath, MonoRuntimesHelpers.GetRootDir(runtime), Configurables.Paths.MonoSDKRelativeIncludeSourceDir);
            IEnumerable <string> sourceIncludes = Directory.EnumerateFiles(runtimeIncludeDirRoot, "*", SearchOption.AllDirectories);
            var destinationIncludes             = new List <string> ();

            foreach (RuntimeFile rf in allRuntimes.RuntimeFilesToInstall.Where(rf => rf.Type == RuntimeFileType.SdkHeader))
            {
                destinationIncludes.Add(Path.Combine(Configurables.Paths.MonoSourceFullPath, rf.Source(runtime)));
            }

            bool haveDifference = false;

            haveDifference &= ReportDifference(sourceIncludes.Except(destinationIncludes).ToList(), "runtime", "bundle");
            haveDifference &= ReportDifference(destinationIncludes.Except(sourceIncludes).ToList(), "bundle", "runtime");

            if (haveDifference)
            {
                throw new InvalidOperationException("Differences found between the Mono SDK header files shipped in Mono archive and included in Xamarin.Android bundle");
            }

            bool ReportDifference(List <string> diff, string foundIn, string notFoundIn)
            {
                if (diff.Count == 0)
                {
                    return(false);
                }

                Log.ErrorLine($"There are files found in the {foundIn} but not in the {notFoundIn}:");
                foreach (string f in diff)
                {
                    Log.ErrorLine($"  {context.Characters.Bullet} {Utilities.GetRelativePath (runtimeIncludeDirRoot, f)}");
                }
                Log.ErrorLine();
                return(true);
            }
        }