Beispiel #1
0
        /// <exception cref="SocketException" />
        /// <exception cref="UnableToResolveHostNameException" />
        /// <exception cref="BuildFailed" />
        /// <exception cref="RunFailed" />
        public void BuildAndRunExported(PreviewArguments args, IMessagingService client, IFileSystem shell, IFuse fuse)
        {
            var buildEvents = new Subject <IBinaryMessage>();

            var builder = UnoBuildWrapper.Create(
                shell, fuse.Version, buildEvents, false,
                new MissingRequiredPackageReferences(),
                new InstallAndroidRequired());

            var projectId = ProjectIdComputer.IdFor(args.Project);

            using (PushEventsToDaemon.Start(buildEvents, client, args.Project, projectId, GetBuildTarget(args.Target)))
                using (buildEvents.Subscribe(_output.WriteBuildEvent))
                {
                    if (args.Endpoints.Count == 0)
                    {
                        args = args.AddEndpoints(GetProxyEndPoints());
                    }

                    var build = builder
                                .LoadOrBuildRunnable(args, CancellationToken.None)
                                .GetResultAndUnpackExceptions();

                    if (args.CompileOnly == false)
                    {
                        build.Run(buildEvents.ToProgress());
                    }
                }
        }
Beispiel #2
0
        public static async System.Threading.Tasks.Task <ExportBuild> LoadOrBuildRunnable(this UnoBuildWrapper self, PreviewArguments args, CancellationToken cancellationToken)
        {
            var id          = Guid.NewGuid();
            var buildResult = await self.BuildUno(id,
                                                  new BuildProject(
                                                      args.Project.NativePath,
                                                      args.Defines.ToImmutableList(),
                                                      args.BuildLibraries,
                                                      args.IsVerboseBuild),
                                                  args.Target,
                                                  args.DirectToDevice,
                                                  cancellationToken,
                                                  args.QuitAfterApkLaunch);

            return(new ExportBuild(buildResult, id));
        }