Beispiel #1
0
#pragma warning disable CS1998
        protected virtual async Task <bool> DetermineCurrentVersion()
        {
            if (String.IsNullOrEmpty(Name))
            {
                Log.DebugLine("Program name not specified, unable to check version");
                return(false);
            }

            bool   success;
            string version;
            string programName = ExecutableName?.Trim() ?? String.Empty;

            if (String.IsNullOrEmpty(programName))
            {
                programName = Name;
            }

            (success, version) = Utilities.GetProgramVersion(programName);
            if (success)
            {
                CurrentVersion = version;
            }

            return(success);
        }
        string GetVersion()
        {
            if (!String.IsNullOrEmpty(programVersion))
            {
                return(programVersion);
            }

            (bool success, string version) = Utilities.GetProgramVersion(FullToolPath);
            if (!success)
            {
                return(null);
            }

            programVersion = version;
            return(version);
        }
Beispiel #3
0
        protected override bool InitOS()
        {
            if (!base.InitOS())
            {
                return(false);
            }

            string brewPath = Which("brew", false);

            if (String.IsNullOrEmpty(brewPath))
            {
                Log.ErrorLine("Could not find Homebrew on this system, please install it from https://brew.sh/");
                return(false);
            }

            Context.MonoOptions.Add("--arch=64");
            Context.Instance.Tools.BrewPath = brewPath;
            HomebrewPrefix = Utilities.GetStringFromStdout(brewPath, "--prefix");

            (bool success, string bv) = Utilities.GetProgramVersion(brewPath);
            if (!success || !Version.TryParse(bv, out Version brewVersion))
            {
                Log.ErrorLine("Failed to obtain Homebrew version");
                return(false);
            }

            HomebrewVersion = brewVersion;

            // This is a hack since we have a chicken-and-egg problem. On mac, Configuration.props uses the
            // `HostHomebrewPrefix` property which is defined in `Configuration.OperatingSystem.props` but we're here to
            // *generate* the latter file, so when the bootstrapper is built `HostHomebrewPrefix` is empty and we can't
            // access mingw utilities. So, we need to cheat here.
            string mxePath = Context.Instance.Properties.GetValue(KnownProperties.AndroidMxeFullPath);

            if (String.IsNullOrEmpty(mxePath))
            {
                Context.Instance.Properties.Set(KnownProperties.AndroidMxeFullPath, HomebrewPrefix);
            }

            AntDirectory = HomebrewPrefix;
            return(true);
        }