Пример #1
0
        async Task <bool> DownloadMonoArchive(Context context)
        {
            if (context.ForceRuntimesBuild)
            {
                Log.StatusLine("Mono runtime rebuild forced, Mono Archive download skipped");
                return(false);
            }

            Log.StatusLine("Checking if all runtime files are present");
            var allRuntimes = new Runtimes();

            if (MonoRuntimesHelpers.AreRuntimeItemsInstalled(allRuntimes))
            {
                // User might have changed the set of ABIs to build, we need to check and rebuild if necessary
                if (!Utilities.AbiChoiceChanged(context))
                {
                    Log.StatusLine("Mono runtimes already present and complete. No need to download or build.");
                    return(true);
                }

                Log.StatusLine("Mono already present, but the choice of ABIs changed since previous build, runtime refresh is necessary");
            }
            Log.Instance.StatusLine($"  {Context.Instance.Characters.Bullet} some files are missing, download and extraction required");

            bool result = await DownloadAndUpackIfNeeded(
                context,
                "Mono",
                Configurables.Paths.MonoArchiveLocalPath,
                Configurables.Paths.MonoArchiveFileName,
                Configurables.Paths.MonoSDKSOutputDir
                );

            if (!result)
            {
                return(false);
            }

            return(await DownloadAndUpackIfNeeded(
                       context,
                       "Windows Mono",
                       Configurables.Paths.MonoArchiveWindowsLocalPath,
                       Configurables.Paths.MonoArchiveWindowsFileName,
                       Configurables.Paths.BCLWindowsOutputDir
                       ));
        }
Пример #2
0
        protected override async Task <bool> Execute(Context context)
        {
            List <Runtime> enabledRuntimes = GetEnabledRuntimes(enableLogging: false);

            if (enabledRuntimes.Count == 0)
            {
                Log.StatusLine("No runtimes to build/install");
                return(true);
            }

            if (!context.MonoArchiveDownloaded)
            {
                // https://github.com/xamarin/xamarin-android/pull/3816
                throw new NotImplementedException("Unable to build mono runtimes from sources.");
            }

            Log.StatusLine("Checking if all runtime files are present");
            var allRuntimes = new Runtimes();

            if (MonoRuntimesHelpers.AreRuntimeItemsInstalled(context, allRuntimes))
            {
                // User might have changed the set of ABIs to build, we need to check and rebuild if necessary
                if (!Utilities.AbiChoiceChanged(context))
                {
                    Log.StatusLine("Mono runtimes already present and complete. No need to download or build.");
                    return(true);
                }

                Log.StatusLine("Mono already present, but the choice of ABIs changed since previous build, runtime refresh is necessary");
            }
            Log.Instance.StatusLine($"  {Context.Instance.Characters.Bullet} some files are missing, rebuild/reinstall forced");

            CleanupBeforeInstall();
            Log.StatusLine();

            string managedRuntime     = context.Properties.GetRequiredValue(KnownProperties.ManagedRuntime);
            bool   haveManagedRuntime = !String.IsNullOrEmpty(managedRuntime);

            if (!await ConjureXamarinCecilAndRemapRef(context, haveManagedRuntime, managedRuntime))
            {
                return(false);
            }

            if (!await InstallRuntimes(context, enabledRuntimes))
            {
                return(false);
            }

            if (!InstallBCL(context))
            {
                return(false);
            }

            if (!InstallUtilities(context, haveManagedRuntime, managedRuntime))
            {
                return(false);
            }

            Utilities.PropagateXamarinAndroidCecil(context);

            return(true);
        }
Пример #3
0
        async Task <bool> DownloadMonoArchive(Context context)
        {
            if (context.ForceRuntimesBuild)
            {
                Log.StatusLine("Mono runtime rebuild forced, Mono Archive download skipped");
                return(false);
            }

            Log.StatusLine("Checking if all runtime files are present");
            var allRuntimes = new Runtimes();

            if (MonoRuntimesHelpers.AreRuntimeItemsInstalled(context, allRuntimes))
            {
                // User might have changed the set of ABIs to build, we need to check and rebuild if necessary
                if (!Utilities.AbiChoiceChanged(context))
                {
                    Log.StatusLine("Mono runtimes already present and complete. No need to download or build.");
                    return(true);
                }

                Log.StatusLine("Mono already present, but the choice of ABIs changed since previous build, runtime refresh is necessary");
            }
            Log.Instance.StatusLine($"  {Context.Instance.Characters.Bullet} some files are missing, download and extraction required");

            string localPath, archiveFileName;

            if (string.IsNullOrEmpty(context.MonoArchiveCustomUrl))
            {
                localPath       = Configurables.Paths.MonoArchiveLocalPath;
                archiveFileName = Configurables.Paths.MonoArchiveFileName;
            }
            else
            {
                var uri = new Uri(context.MonoArchiveCustomUrl);
                archiveFileName = Path.GetFileName(uri.LocalPath);
                localPath       = Path.Combine(context.Properties.GetRequiredValue(KnownProperties.AndroidToolchainCacheDirectory), archiveFileName);
            }

            bool result = false;

            for (uint i = 0; i < 3; i++)
            {
                result = await DownloadAndUpackIfNeeded(
                    context,
                    "Mono",
                    context.MonoArchiveCustomUrl,
                    localPath,
                    archiveFileName,
                    Configurables.Paths.MonoSDKSOutputDir
                    );

                if (result)
                {
                    break;
                }
            }

            if (!result)
            {
                return(false);
            }

            for (uint i = 0; i < 3; i++)
            {
                result = await DownloadAndUpackIfNeeded(
                    context,
                    "Windows Mono",
                    customUrl : String.Empty,
                    localPath : Configurables.Paths.MonoArchiveWindowsLocalPath,
                    archiveFileName : Configurables.Paths.MonoArchiveWindowsFileName,
                    destinationDirectory : Configurables.Paths.BCLWindowsOutputDir
                    );

                if (result)
                {
                    break;
                }
            }

            return(result);
        }