public void repeated_last_versions_are_equal() {
     var lv = fs.GetSourceVersion();
     var newfs = new ExtensionsFileSystemProvider();
     Thread.Sleep(10);
     //check repeated creation
     Assert.AreEqual(lv, newfs.GetSourceVersion());
 }
 public Assembly Execute(ExtensionsCompilerConsoleProgramArgs args) {
     WriteLog("start to process with arguments: " + args);
     var provider = new ExtensionsFileSystemProvider(args.Root, args.Web, args.DllName){WriteLog=s => WriteLog("\tfs:: "+s)};
     if (provider.IsNeedRecompile()) {
         WriteLog("need to recompile, start compiler...");
         new ExtensionsCompilerExecutor(s => WriteLog("\texec:: "+s)).Compile(provider);
         WriteLog("compilation finished");
     }else {
         WriteLog("no recompilation needed");
     }
     WriteLog("start load assembly");
     var result = provider.LoadAssembly();
     WriteLog("assembly loaded");
     return result;
 }
 public void setup() {
     //first cleanup files
     cleanup();
     this.fs = new ExtensionsFileSystemProvider();
     myapp.files.Write("~/extensions/a.boo");
     myapp.files.Write("~/extensions/b.boo");
     myapp.files.Write("~/extensions/c.boo");
     myapp.files.Write("~/extensions/d.boo");
     myapp.files.Write("~/sys/extensions/a.boo");
     myapp.files.Write("~/sys/extensions/b.boo");
     myapp.files.Write("~/sys/extensions/c.boo");
     myapp.files.Write("~/usr/extensions/a.boo");
     myapp.files.Write("~/usr/extensions/b.boo");
     myapp.files.Delete(fs.GetHashPath());
     
     myapp.files.Delete(fs.GetLibraryPath());
 }
 public ApplicationExtensionsLoadTask(string exepath=null,bool web = true, string dllname=null) {
     cleanupOldDlls();
     this.lfs = new ExtensionsFileSystemProvider(null, web, dllname);
     this.tmp = myapp.files.Resolve("~/tmp/lastextcompile.txt", false);
     myapp.files.Write("~/tmp/lastextcompile.txt", "");
     var apppath =Path.Combine( (exepath ?? ""), "extensionscompiler.exe");
     var commandargs = web ? "--web true" : "--web false";
     if(!string.IsNullOrWhiteSpace(dllname)) {
         commandargs += " --dllname " + dllname;
     }
     commandargs += " --root \""+myapp.files.Resolve("~/",false) + "\"";
     commandargs += " --outfile \"" + tmp + "\"";
     var pi = new ProcessStartInfo(apppath, commandargs);
     pi.UseShellExecute = true;
     this.process = new Process();
     process.StartInfo = pi;
     
 }
        public void need_well_formed_registry() {
            myapp.files.Write("~/sys/extensions/zzz.boo", @"
class A :
    pass
registry['a'] = A
");
            myapp.files.Write("~/usr/extensions/aaa.boo", @"
class Z :
    pass
registry['a'] = Z
");
            var efs = new ExtensionsFileSystemProvider();
            var ex = new ExtensionsCompilerExecutor{Pipeline = new CompileToMemory()};
            var a = ex.Compile(efs);
            var result = new ExtensionsLoader().GetRegistry(a);
            Assert.AreEqual("Z",((Type)result["a"]).Name);

        }
 public Assembly Compile(ExtensionsFileSystemProvider provider) {
     var compiler = new BooCompiler();
     var pipeline = Pipeline ??( Pipeline = new CompileToFile());
     ExtensionsPreprocessorCompilerStep.Extend(pipeline);
     compiler.Parameters.Pipeline = pipeline;
     var files = provider.GetFileNames();
     if(files.Length==0) {
         WriteLog("no input files provided");
     }
     foreach (var fileName in files) {
         WriteLog("input added: " + fileName);
         compiler.Parameters.Input.Add(new FileInput(fileName));
     }
     compiler.Parameters.References.Add(typeof (IRegistryLoader).Assembly); //need to use Comdiv.Core
     compiler.Parameters.References.Add(typeof (IDictionary<string, object>).Assembly); //need to use System
     WriteLog("compiler created");
     //loading other dlls:
     foreach (var referencedAssembly in provider.GetReferencedAssemblies()) {
         WriteLog("add assembly " + referencedAssembly.GetName().Name);
         compiler.Parameters.References.Add(referencedAssembly);
     }
     compiler.Parameters.OutputAssembly = provider.GetLibraryPath();
     WriteLog("output is setted : " + provider.GetLibraryPath());
     WriteLog("start compiler");
     var result = compiler.Run();
     LastCompiledContext = result;
     if (result.Errors.Count != 0) {
         WriteLog("error occured!");
         WriteLog(result.Errors.ToString());
         ConsoleLogHost.Current.logerror(result.Errors.ToString());
         throw new CompilerErrorException(result);
     }
     //if (result.Warnings.Count != 0)
     //{
     //    WriteLog("warrnings!");
     //    WriteLog(result.Warnings.ToString());
     //}
     WriteLog("compilation successfull");
     if(Pipeline is CompileToMemory) {
         return result.GeneratedAssembly;
     }else {
         return provider.LoadAssembly();
     }
 }
 public void non_used_file_changes_not_affect_version() {
     var lv = fs.GetSourceVersion();
     var newfs = new ExtensionsFileSystemProvider();
     myapp.files.Write("~/sys/extensions/a.boo","1");
     Assert.AreEqual(lv, newfs.GetSourceVersion());
 }
 public void file_deletion_affected_lastversion() {
     var lv = fs.GetSourceVersion();
     var newfs = new ExtensionsFileSystemProvider();
     File.Delete( myapp.files.Resolve("~/usr/extensions/a.boo"));
     Assert.Less(lv, newfs.GetSourceVersion());
 }
 public void file_creations_affect_version() {
     var lv = fs.GetSourceVersion();
     var newfs = new ExtensionsFileSystemProvider();
     myapp.files.Write("~/sys/extensions/e.boo","1");
     Assert.Less(lv, newfs.GetSourceVersion());
 }