pub async fn build(&mut self) -> anyhow::Result<()> {
        self.build_modules().await?;
        let solutions = self.build_solutions().await?;
        let testgen_launch_info = self.build_testgens().await?;

        let checker_ref = self
            .build_checkers()
            .await
            .context("failed to build checker")?;

        let checker_cmd = self.cfg.check_options.args.clone();

        let tests = {
            let gen_answers = match &self.cfg.check {
                crate::manifest::Check::Custom(cs) => cs.pass_correct,
                crate::manifest::Check::Builtin(_) => true,
            };
            let gen_answers = if gen_answers {
                let primary_solution_name = self.cfg.primary_solution.as_ref().context(
                    "primary-solution must be specified in order to generate tests correct answers",
                )?;
                let sol_data = match solutions.get(primary_solution_name.as_str()) {
                    Some(d) => d,
                    None => {
                        eprint!("Following solutions are defined: ");
                        for sol_name in solutions.keys() {
                            eprint!("{} ", sol_name);
                        }
                        anyhow::bail!("Unknown solution {}", primary_solution_name)
                    }
                };
                Some(sol_data)
            } else {
                None
            };
            self.build_tests(&testgen_launch_info, gen_answers).await?
        };
        self.copy_raw().await?;

        let valuer_exe = {
            let src = self.jtl_dir.join("bin/jjs-svaluer");
            let dest = self.out_dir.join("assets/valuer");
            tokio::fs::copy(&src, &dest)
                .await
                .context("failed to copy valuer binary")?;
            FileRef {
                root: FileRefRoot::Problem,
                path: "valuer".to_string(),
            }
        };

        let valuer_cfg = FileRef {
            root: FileRefRoot::Problem,
            path: "valuer-cfg".to_string(),
        };

        let problem = pom::Problem {
            title: self.cfg.title.clone(),
            name: self.cfg.name.clone(),
            checker_exe: checker_ref,
            checker_cmd,
            valuer_exe,
            tests,
            valuer_cfg,
        };
        let manifest_path = format!("{}/manifest.json", self.out_dir.display());
        let manifest_data =
            serde_json::to_string(&problem).context("couldn't serialize manifest")?;
        std::fs::write(manifest_path, manifest_data).context("couldn't emit manifest")
    }
/// Main method, which actually builds the problem into
/// redistributable package.
Main method, which actually builds the problem into
redistributable package.
Main method which actually builds the problem into redistributable package .
pub async fn build(&mut self) -> anyhow::Result<()> {
        self.build_modules().await?;
        let solutions = self.build_solutions().await?;
        let testgen_launch_info = self.build_testgens().await?;
        let checker_ref = self
            .build_checkers()
            .await
            .context("failed to build checker")?;
        let checker_cmd = self.cfg.check_options.args.clone();
        let tests = {
            let gen_answers = match &self.cfg.check {
                crate::manifest::Check::Custom(cs) => cs.pass_correct,
                crate::manifest::Check::Builtin(_) => true,
            };
            let gen_answers = if gen_answers {
                let primary_solution_name = self.cfg.primary_solution.as_ref().context(
                    "primary-solution must be specified in order to generate tests correct answers",
                )?;
                let sol_data = match solutions.get(primary_solution_name.as_str()) {
                    Some(d) => d,
                    None => {
                        eprint!("Following solutions are defined: ");
                        for sol_name in solutions.keys() {
                            eprint!("{} ", sol_name);
                        }
                        anyhow::bail!("Unknown solution {}", primary_solution_name)
                    }
                };
                Some(sol_data)
            } else {
                None
            };
            self.build_tests(&testgen_launch_info, gen_answers).await?
        };
        self.copy_raw().await?;
        let valuer_exe = {
            let src = self.jtl_dir.join("bin/jjs-svaluer");
            let dest = self.out_dir.join("assets/valuer");
            tokio::fs::copy(&src, &dest)
                .await
                .context("failed to copy valuer binary")?;
            FileRef {
                root: FileRefRoot::Problem,
                path: "valuer".to_string(),
            }
        };
        let valuer_cfg = FileRef {
            root: FileRefRoot::Problem,
            path: "valuer-cfg".to_string(),
        };
        let problem = pom::Problem {
            title: self.cfg.title.clone(),
            name: self.cfg.name.clone(),
            checker_exe: checker_ref,
            checker_cmd,
            valuer_exe,
            tests,
            valuer_cfg,
        };
        let manifest_path = format!("{}/manifest.json", self.out_dir.display());
        let manifest_data =
            serde_json::to_string(&problem).context("couldn't serialize manifest")?;
        std::fs::write(manifest_path, manifest_data).context("couldn't emit manifest")
    }
pub async fn build ( & mut self ) -> anyhow :: Result < ( ) > { self . build_modules ( ) . await ? ; let solutions = self . build_solutions ( ) . await ? ; let testgen_launch_info = self . build_testgens ( ) . await ? ; let checker_ref = self . build_checkers ( ) . await . context ( " " ) ? ; let checker_cmd = self . cfg . check_options . args . clone ( ) ; let tests = { let gen_answers = match & self . cfg . check { crate :: manifest :: Check :: Custom ( cs ) => cs . pass_correct , crate :: manifest :: Check :: Builtin ( _ ) => true , } ; let gen_answers = if gen_answers { let primary_solution_name = self . cfg . primary_solution . as_ref ( ) . context ( " " , ) ? ; let sol_data = match solutions . get ( primary_solution_name . as_str ( ) ) { Some ( d ) => d , None => { eprint ! ( " " ) ; for sol_name in solutions . keys ( ) { eprint ! ( " " sol_name ) ; } anyhow :: bail ! ( " " primary_solution_name ) } } ; Some ( sol_data ) } else { None } ; self . build_tests ( & testgen_launch_info , gen_answers ) . await ? } ; self . copy_raw ( ) . await ? ; let valuer_exe = { let src = self . jtl_dir . join ( " " ) ; let dest = self . out_dir . join ( " " ) ; tokio :: fs :: copy ( & src , & dest ) . await . context ( " " ) ? ; FileRef { root : FileRefRoot :: Problem , path : " " . to_string ( ) , } } ; let valuer_cfg = FileRef { root : FileRefRoot :: Problem , path : " " . to_string ( ) , } ; let problem = pom :: Problem { title : self . cfg . title . clone ( ) , name : self . cfg . name . clone ( ) , checker_exe : checker_ref , checker_cmd , valuer_exe , tests , valuer_cfg , } ; let manifest_path = format ! ( " " self out_dir display ( ) ) ; let manifest_data = serde_json :: to_string ( & problem ) . context ( " " ) ? ; std :: fs :: write ( manifest_path , manifest_data ) . context ( " " ) }
Main method, which actually builds the problem into
redistributable package.
Main method which actually builds the problem into redistributable package .
&mut self