public override void End() { switch (FoundMainClasses.Count) { case 1: Data.SetMainClass(FoundMainClasses[0]); break; case 0: // Auto-generate main-class when building a library. if (Environment.IsDefined("LIBRARY")) { var type = new ClassType(Package.Source, Data.IL, null, Modifiers.Generated | Modifiers.Public, Package.Name.ToIdentifier() + "_app"); type.SetBase(Essentials.Application); type.Constructors.Add(new Constructor(Package.Source, type, null, Modifiers.Generated | Modifiers.Public, new Parameter[0], new Scope())); Data.IL.Types.Add(type); Data.SetMainClass(type); break; } var extraMsg = Package.Name.EndsWith("Test") ? ". If this is a test project, it cannot be started directly, but must be run with a test runner." : ""; Log.Error(Package.Source, ErrorCode.E3503, "No non-abstract application classes found in project" + extraMsg); break; default: var mainClass = BestMainClassSelector.GetBestMainClass(FoundMainClasses, Log, Package, Essentials.MainClassAttribute); if (mainClass != null) { Data.SetMainClass(mainClass); } break; } }
public override void End() { switch (FoundMainClasses.Count) { case 1: Data.SetMainClass(FoundMainClasses[0]); break; case 0: var extraMsg = Package.Name.EndsWith("Test") ? ". If this is a test project, it cannot be started directly, but must be run with a test runner." : ""; Log.Error(Package.Source, ErrorCode.E3503, "No non-abstract application classes found in project" + extraMsg); break; default: var mainClass = BestMainClassSelector.GetBestMainClass(FoundMainClasses, Log, Package, Essentials.MainClassAttribute); if (mainClass != null) { Data.SetMainClass(mainClass); } break; } }