コード例 #1
0
        public static async Task <int> RunBuild(ILauncher launcher, Func <Task <IRecorder> > createRecorder, string outputDir, string workDir)
        {
            await using var recorder = await createRecorder();

            Directory.CreateDirectory(outputDir);
            var artifact = new FSArtifactSaver(outputDir);

            var schema = await recorder.LoadSchema();

            var sdks = await recorder.ListAvailableSdks().ToListAsync();

            var sdkInstallManager = recorder.CreateSdkInstaller();

            var conf = await recorder.LoadRepoConfig();

            var currentPlatform = PlatformInfo.Current;

            await using var launchPropsCleanup = GetDockerLaunchProps(
                            platform: currentPlatform,
                            sdks: sdks,
                            workDir: workDir,
                            currentDir: recorder.CurrentDir,
                            sourcesDir: recorder.SourcesDir,
                            conf,
                            sdkInstallManager,
                            schema
                            );

            var launchProps = await launchPropsCleanup.Value();

            await using var proxyServer = await ProxyServer.Create(
                            Path.Combine(launchProps.SocketDir, "helium.sock"),
                            recorder,
                            conf,
                            artifact
                            );

            var exitCode = await launcher.Run(currentPlatform, launchProps);

            await recorder.RecordMetadata();

            return(exitCode);
        }