//Bad... does way too many things, should be moved to respective classes. protected override void ExecuteTask() { if (macrodefs.Contains(_name)) { if (GetUniqueIdentifier() != ((MacroDefTask)macrodefs[_name]).GetUniqueIdentifier()) { throw new BuildException("Different MacroDef with the name : " + _name + " already exists. Cannot redefine.", Location); } Log(Level.Info, string.Format("macrodef \"{0}\" already included.", _name)); return; } macrodefs[_name] = this; SimpleCSharpCompiler simpleCSharpCompiler = new SimpleCSharpCompiler(GetUniqueIdentifier()); if (simpleCSharpCompiler.PrecompiledDllExists()) { TypeFactory.ScanAssembly(simpleCSharpCompiler.PreCompiledDllPath, this); } else { Log(Level.Info, string.Format("\"{0}\" New or Modified. Compiling.", _name)); CodeCompileUnit compileUnit = GenerateCode(); compiledAssembly = simpleCSharpCompiler.CompileAssembly(compileUnit); LogGeneratedCode(simpleCSharpCompiler, compileUnit); TypeFactory.ScanAssembly(compiledAssembly, this); } }
protected override void ExecuteTask() { if (!macrodefs.Contains(this.name)) { macrodefs.Add(_name, this); CodeCompileUnit compileUnit = GenerateCode(); SimpleCSharpCompiler simpleCSharpCompiler = new SimpleCSharpCompiler(); compiledAssembly = simpleCSharpCompiler.CompileAssembly(compileUnit); LogGeneratedCode(simpleCSharpCompiler, compileUnit); TypeFactory.ScanAssembly(compiledAssembly, this); } }
// Bad... does way too many things, should be moved to respective classes. protected override void ExecuteTask() { if (Macrodefs.Contains(TaskName)) { Log(Level.Info, "macrodef \"{0}\" already included.", TaskName); return; } Macrodefs[TaskName] = this; var simpleCSharpCompiler = new SimpleCSharpCompiler(); var compileUnit = GenerateCode(); _compiledAssembly = simpleCSharpCompiler.CompileAssembly(compileUnit); LogGeneratedCode(simpleCSharpCompiler, compileUnit); TypeFactory.ScanAssembly(_compiledAssembly, this); }
//Bad... does way too many things, should be moved to respective classes. protected override void ExecuteTask() { if(macrodefs.Contains(_name)) { if (GetUniqueIdentifier() != ((MacroDefTask)macrodefs[_name]).GetUniqueIdentifier()) throw new BuildException("Different MacroDef with the name : " + _name + " already exists. Cannot redefine.", Location); Log(Level.Info, string.Format("macrodef \"{0}\" already included.", _name)); return; } macrodefs[_name] = this; SimpleCSharpCompiler simpleCSharpCompiler = new SimpleCSharpCompiler(GetUniqueIdentifier()); if(simpleCSharpCompiler.PrecompiledDllExists()) { TypeFactory.ScanAssembly(simpleCSharpCompiler.PreCompiledDllPath, this); } else { Log(Level.Info, string.Format("\"{0}\" New or Modified. Compiling.", _name)); CodeCompileUnit compileUnit = GenerateCode(); compiledAssembly = simpleCSharpCompiler.CompileAssembly(compileUnit); LogGeneratedCode(simpleCSharpCompiler, compileUnit); TypeFactory.ScanAssembly(compiledAssembly, this); } }