Beispiel #1
0
        public static IEnumerable <object[]> GetVariousBuildDefinitions()
        {
            // simple with legacy names
            yield return(new[]
            {
                new BuildDefinition
                {
                    [ConfigDsc] = "config({});",
                    [PackageConfigDsc] = ModuleConfigurationBuilder.V1Module("MyModule"),
                    [PackageDsc] = "export const x = 42;"
                }
            });

            var myModuleConfigFile  = "MyModule/" + ModuleConfigBm;
            var myModuleProjectFile = "MyModule/build.dsc";
            var myModuleContent     = ModuleConfigurationBuilder.V2Module("MyModule");

            // simple with V2 names
            yield return(new[]
            {
                new BuildDefinition
                {
                    [ConfigBc] = "config({});",
                    [myModuleConfigFile] = myModuleContent,
                    [myModuleProjectFile] = "@@public export const x = 42;"
                }
            });

            // with list file in module config
            yield return(new[]
            {
                new BuildDefinition
                {
                    [ConfigBc] = "config({});",
                    [myModuleConfigFile] = ModuleConfigurationBuilder.V2Module("MyModule").WithExtraFields("projects: importFile(f`prjs.bl`).projects"),
                    ["MyModule/prjs.bl"] = "export const projects = [f`build.bp`];",
                    ["MyModule/build.bp"] = "@@public export const x = 42;"
                }
            });

            // with build list in primary config
            var preludeCfg = SpecEvaluationBuilder.PreludePackageConfigRelativePathDsc;

            yield return(new[]
            {
                new BuildDefinition
                {
                    [ConfigBc] = "config({ modules: importFile(f`cfg.bl`).modules });",
                    ["cfg.bl"] = $"export const modules = [f`{preludeCfg}`, f`{myModuleConfigFile}`];",
                    [myModuleConfigFile] = ModuleConfigurationBuilder.V2Module("MyModule").WithExtraFields("projects: importFile(f`prjs.bl`).projects"),
                    ["MyModule/prjs.bl"] = "export const projects = [f`build.bp`];",
                    ["MyModule/build.bp"] = "@@public export const x = 42;"
                }
            });
        }
        private void PopulateMainConfigAndPrelude()
        {
            FileSystem.WriteAllText(m_configFilePath, "config({});");
            var preludeDir = TestPath.Combine(PathTable, FrontEndHost.PreludeModuleName);

            FileSystem.CreateDirectory(preludeDir);
            var preludeModule = ModuleConfigurationBuilder.V1Module(FrontEndHost.PreludeModuleName, mainFile: "Prelude.dsc");

            FileSystem.WriteAllText(preludeDir.Combine(PathTable, "package.config.dsc"), preludeModule.ToString());
            FileSystem.WriteAllText(preludeDir.Combine(PathTable, "Prelude.dsc"), SpecEvaluationBuilder.FullPreludeContent);
        }