diff --git a/BeefBuild/src/BuildApp.bf b/BeefBuild/src/BuildApp.bf index ee3c3878..b150c4f2 100644 --- a/BeefBuild/src/BuildApp.bf +++ b/BeefBuild/src/BuildApp.bf @@ -15,6 +15,7 @@ namespace BeefBuild public bool mIsTest; public bool mTestIncludeIgnored; public bool mDidRun; + public bool mWantsGenerate = false; /*void Test() { @@ -101,12 +102,26 @@ namespace BeefBuild WorkspaceLoaded(); - if (mIsTest) + if (mWantsGenerate) { - RunTests(mTestIncludeIgnored, false); + if (mWorkspace.mStartupProject != null) + { + if (mWorkspace.mStartupProject.IsEmpty) + AutoGenerateStartupCode(mWorkspace.mStartupProject); + else + OutputErrorLine("The project '{}' is not empty, but '-generate' was specified.", mWorkspace.mStartupProject.mProjectName); + } + } + + if (!mFailed) + { + if (mIsTest) + { + RunTests(mTestIncludeIgnored, false); + } + else if (mVerb != .New) + Compile(.Normal, null); } - else if (mVerb != .New) - Compile(.Normal, null); } public override bool HandleCommandLineParam(String key, String value) @@ -121,6 +136,9 @@ namespace BeefBuild case "-new": mVerb = .New; return true; + case "-generate": + mWantsGenerate = true; + return true; case "-run": if (mVerbosity == .Default) mVerbosity = .Minimal; @@ -268,7 +286,7 @@ namespace BeefBuild if ((!IsCompiling) && (!AreTestsRunning())) { - if ((mVerb == .Run) && (!mDidRun)) + if ((mVerb == .Run) && (!mDidRun) && (!mFailed)) { let curPath = scope String(); Directory.GetCurrentDirectory(curPath); diff --git a/BeefBuild/src/Program.bf b/BeefBuild/src/Program.bf index 2c045cf9..98b077dc 100644 --- a/BeefBuild/src/Program.bf +++ b/BeefBuild/src/Program.bf @@ -17,12 +17,13 @@ namespace BeefBuild BeefBuild [args] If no arguments are specified, a build will occur using current working directory as the workspace. -config= Sets the config (defaults to Debug) + -generate Generates startup code for an empty project -new Creates a new workspace and project -platform= Sets the platform (defaults to system platform) -run Compile and run the startup project in the workspace -test= Executes test script -verbosity= Set verbosity level to: quiet/minimal/normal/detailed/diagnostic - -version Get version + -version Get version -workspace= Sets workspace path (defaults to current working directory) """); return 0;