Beispiel #1
0
        public static int Run()
        {
            if (Utilities.OperatingSystem.IsMacOS())
            {
                string shell1 = GetCurrentLoginShell();
                string shell2 = GetDefaultLoginShell();
                string rc     = GetShellConfigurationFile(shell1);
            }

            string flutterSdkPath = null;

            if (!FlutnetShell.TryLocateFile("flutter", out string path))
            {
                FlutterAssistant.Configure(Utilities.OperatingSystem.IsMacOS()
                    ? DefaultFlutterSdkPath_macOS : DefaultFlutterSdkPath_Windows, string.Empty, string.Empty);

                if (FlutnetShell.TryLocateFile("flutter", out string path2))
                {
                    flutterSdkPath = Path.GetDirectoryName(Path.GetDirectoryName(path2));
                }
            }
            else
            {
                flutterSdkPath = Path.GetDirectoryName(Path.GetDirectoryName(path));
            }

            Console.WriteLine("Flutter bin path: {0}", flutterSdkPath);

            //FlutterTools.GetDoctorReport();

            //string env = GetEnvironmentVariable("ANDROID_SDK_ROOT");

            //FlutterAssistant.DiagnosticResult diag = FlutterAssistant.RunDiagnostic();

            return(0);
        }
Beispiel #2
0
        public override int Execute()
        {
            if (_options.Arguments is NewProjectInArg arg1)
            {
                return(ExecuteCore(() =>
                {
                    NewProjectCreator.Create(ToNewProjectSettings(arg1), _options.Verbose);
                    return new NewProjectOutArg();
                }));
            }

            if (_options.Arguments is UpdateCheckInArg)
            {
                return(ExecuteCore(() =>
                {
                    var check = UpdateManager.CheckForUpdates(_options.Verbose);
                    return new UpdateCheckOutArg
                    {
                        UpToDate = check.UpToDate,
                        NewVersion = check.NewVersion,
                        DownloadUrl = check.DownloadUrl
                    };
                }));
            }

            if (_options.Arguments is FlutterInfoInArg)
            {
                return(ExecuteCore(() =>
                {
                    var check = FlutterAssistant.CheckCompatibility(_options.Verbose);
                    return new FlutterInfoOutArg
                    {
                        InstalledVersion = check.InstalledVersion.Version,
                        Compatibility = (DTO.FlutterCompatibility)(int) check.Compatibility,
                        NextSupportedVersion = check.NextSupportedVersion,
                        LatestSupportedVersion = check.LatestSupportedVersion
                    };
                }));
            }

            if (_options.Arguments is FlutterDiagInArg)
            {
                return(ExecuteCore(() =>
                {
                    var diag = FlutterAssistant.RunDiagnostic(_options.Verbose);
                    return new FlutterDiagOutArg
                    {
                        AndroidSdkLocation = diag.AndroidSdkLocation,
                        FlutterSdkLocation = diag.FlutterSdkLocation,
                        JavaSdkLocation = diag.JavaSdkLocation,
                        Issues = (DTO.FlutterIssues)(int) diag.Issues,

                        InstalledVersion = diag.FlutterCompatibility.InstalledVersion.Version,
                        Compatibility = (DTO.FlutterCompatibility)(int) diag.FlutterCompatibility.Compatibility,
                        NextSupportedVersion = diag.FlutterCompatibility.NextSupportedVersion,
                        LatestSupportedVersion = diag.FlutterCompatibility.LatestSupportedVersion,

                        DoctorErrors = diag.FlutterDoctor.Items.Where(i => i.Type == FlutterDoctorReportItemType.Error).ToDictionary(i => i.Description, i => i.Details),
                        DoctorWarnings = diag.FlutterDoctor.Items.Where(i => i.Type == FlutterDoctorReportItemType.Warning).ToDictionary(i => i.Description, i => i.Details),

                        CurrentShell = FlutnetShell.CurrentShell,
                        CurrentShellConfigurationFile = FlutnetShell.CurrentShellConfigurationFile
                    };
                }));
            }

            if (_options.Arguments is FlutnetSetupInArg arg6)
            {
                return(ExecuteCore(() =>
                {
                    FlutterAssistant.Configure(arg6.FlutterSdkLocation, arg6.AndroidSdkLocation, arg6.JavaSdkLocation, _options.Verbose);
                    return new FlutnetSetupOutArg();
                }));
            }

            return(0);
        }