在Fake中并行运行任务序列

时间:2016-04-26 12:59:19

标签: f# f#-fake

想使用FAKE加速构建。从理论上讲,如果我可以并行(在目标内)运行构建序列,那么它应该会更快。

let buildProject outputDir buildTargets projectName = 
    let setParams p =
        { p with
            Verbosity = Some(Quiet)
            Targets = buildTargets
            Properties =
                [   "DevEnvDir", "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools"
                    "OutputPath", outputDir
                    "Optimize", "True"
                    "DebugSymbols", "True"
                    "Configuration", buildMode ]
            }
    build setParams projectName |> DoNothing

Target "BuildLibs" (fun _ -> 
    !! "**/*.csproj"
    -- "**/*.Tests.csproj"
    //A way to run in parallel??
    |> Seq.iter (buildProject buildOutDir ["ReBuild"])
)

有没有办法并行运行序列迭代?

1 个答案:

答案 0 :(得分:1)

最简单的选择是:

<?php

                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                $args = array('post_type' => 'post','paged' => $paged);
                query_posts($args); 

                if ( have_posts() ) :
                    while ( have_posts() ) : the_post();
                        get_template_part( 'post-format/content', get_post_format() );
                    endwhile;
                else:
                    get_template_part( 'post-format/content', 'none' );
                endif;

                ?>

另一种选择是&#34; F# Parallel Sequences&#34;成分

Target "BuildLibs" (fun _ -> 
    !! "**/*.csproj"
    -- "**/*.Tests.csproj"
    |> Seq.ToArray
    |> Array.Parallel.iter (buildProject buildOutDir ["ReBuild"])
)