예제 #1
0
        public override bool Execute()
        {
            Log.LogMessage(MessageImportance.Low, $"Task {nameof (AcceptAndroidSdkLicenses)}");
            Log.LogMessage(MessageImportance.Low, $"  {nameof (AndroidSdkDirectory)}: {AndroidSdkDirectory}");
            Log.LogMessage(MessageImportance.Low, $"  {nameof (JavaSdkDirectory)}: {JavaSdkDirectory}");

            var licdir = Path.Combine(Path.Combine(AndroidSdkDirectory, "licenses"));

            Directory.CreateDirectory(licdir);

            if (!string.IsNullOrEmpty(JavaSdkDirectory))
            {
                Environment.SetEnvironmentVariable("JAVA_HOME", JavaSdkDirectory);
            }

            string _;
            var    path = Which.GetProgramLocation("sdkmanager", out _, new [] { Path.Combine(AndroidSdkDirectory, "tools", "bin") });
            var    psi  = new ProcessStartInfo(path, "--licenses")
            {
                UseShellExecute = false, RedirectStandardInput = true
            };
            var proc = Process.Start(psi);

            for (int i = 0; i < 10; i++)
            {
                proc.StandardInput.WriteLine('y');
            }
            proc.WaitForExit();

            return(true);
        }
예제 #2
0
        void SetSudo()
        {
            if (!UseSudo || string.Equals("Windows", HostOS, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            Sudo = "sudo ";

            if (!string.Equals("Darwin", HostOS, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            string brewFilename;
            var    brewPath = Which.GetProgramLocation("brew", out brewFilename);

            if (string.IsNullOrEmpty(brewPath))
            {
                return;
            }
            var brewVersion = Which.GetProgramVersion(HostOS, $"{brewPath} --version");

            if (brewVersion < new Version(1, 1))
            {
                SudoBrew = "sudo ";
                return;
            }
        }
예제 #3
0
        protected override string GenerateFullPathToTool()
        {
            var dirs = string.IsNullOrEmpty(ToolPath)
                                ? null
                                : new [] { ToolPath };
            string filename;
            var    path = Which.GetProgramLocation(ToolBaseName, out filename, dirs);

            return(path);
        }
예제 #4
0
        public override bool Execute()
        {
            var licdir = Path.Combine(Path.Combine(AndroidSdkDirectory, "licenses"));

            Directory.CreateDirectory(licdir);

            string _;
            var    path = Which.GetProgramLocation("sdkmanager", out _, new [] { Path.Combine(AndroidSdkDirectory, "tools", "bin") });
            var    psi  = new ProcessStartInfo(path, "--licenses")
            {
                UseShellExecute = false, RedirectStandardInput = true
            };
            var proc = Process.Start(psi);

            for (int i = 0; i < 10; i++)
            {
                proc.StandardInput.WriteLine('y');
            }
            proc.WaitForExit();

            return(true);
        }