Ejemplo n.º 1
0
        public CompilerTester(string name, params string[] sources)
        {
            var tempPath =
            #if DEBUG
                ".";
            #else
                Path.GetTempPath();
            #endif

            var nonce = "";
            #if !DEBUG
            nonce = "_" + Guid.NewGuid().ToString("D");
            #endif

            var outputPath = Path.Combine(tempPath, string.Format("{0}{1}.dll", name, nonce));

            sourceInfos = sources.Select((s, i) =>
                {

                    var spath = Path.Combine(tempPath, string.Format("{0}{1}_{2}.apterid", name, nonce, i));
                    File.WriteAllText(spath, s);
                    return new FileInfo(spath);
                })
                .ToArray();

            Compiler = new ApteridCompiler(forceRecompile: true);

            Compiler.AddCompileUnit(
                CompileOutputMode.CompileLibrary | CompileOutputMode.EmitSymbols,
                new FileInfo(outputPath),
                sourceInfos.Select(info => new PhysicalSourceFile(info.FullName)));
        }
Ejemplo n.º 2
0
        public CompilerTester(string name, params string[] sources)
        {
            var tempPath =
#if DEBUG
                ".";
#else
                Path.GetTempPath();
#endif

            var nonce = "";
#if !DEBUG
            nonce = "_" + Guid.NewGuid().ToString("D");
#endif

            var outputPath = Path.Combine(tempPath, string.Format("{0}{1}.dll", name, nonce));

            sourceInfos = sources.Select((s, i) =>
            {
                var spath = Path.Combine(tempPath, string.Format("{0}{1}_{2}.apterid", name, nonce, i));
                File.WriteAllText(spath, s);
                return(new FileInfo(spath));
            })
                          .ToArray();

            Compiler = new ApteridCompiler(forceRecompile: true);

            Compiler.AddCompileUnit(
                CompileOutputMode.CompileLibrary | CompileOutputMode.EmitSymbols,
                new FileInfo(outputPath),
                sourceInfos.Select(info => new PhysicalSourceFile(info.FullName)));
        }