-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from VATSIM-UK/184-skip-compilation
feat: runtime options
- Loading branch information
Showing
13 changed files
with
270 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
|
||
namespace Compiler.Argument | ||
{ | ||
[Flags] | ||
public enum RunMode : ushort | ||
{ | ||
CHECK_CONFIG = 1, | ||
LINT = 2, | ||
VALIDATE = 4, | ||
COMPILE = 8 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Compiler.Argument; | ||
|
||
namespace CompilerCli.Compiler | ||
{ | ||
public class CheckConfigCompilerArgument : AbstractCompilerArgument | ||
{ | ||
public override void Parse(List<string> values, CompilerArguments compilerSettings) | ||
{ | ||
if (values.Count != 0) | ||
{ | ||
throw new ArgumentException("Check config argument does not take any options"); | ||
} | ||
|
||
compilerSettings.Mode = RunMode.CHECK_CONFIG; | ||
} | ||
|
||
public override string GetSpecifier() | ||
{ | ||
return "--check-config"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Compiler.Argument; | ||
|
||
namespace CompilerCli.Compiler | ||
{ | ||
public class LintCompilerArgument : AbstractCompilerArgument | ||
{ | ||
public override void Parse(List<string> values, CompilerArguments compilerSettings) | ||
{ | ||
if (values.Count != 0) | ||
{ | ||
throw new ArgumentException("Lint argument does not take any options"); | ||
} | ||
|
||
compilerSettings.Mode = RunMode.LINT; | ||
} | ||
|
||
public override string GetSpecifier() | ||
{ | ||
return "--lint"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Compiler.Argument; | ||
|
||
namespace CompilerCli.Compiler | ||
{ | ||
public class ValidateCompilerArgument : AbstractCompilerArgument | ||
{ | ||
public override void Parse(List<string> values, CompilerArguments compilerSettings) | ||
{ | ||
if (values.Count != 0) | ||
{ | ||
throw new ArgumentException("Validate argument does not take any options"); | ||
} | ||
|
||
compilerSettings.Mode = RunMode.VALIDATE; | ||
} | ||
|
||
public override string GetSpecifier() | ||
{ | ||
return "--validate"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/CompilerCliTest/Compiler/CheckConfigCompilerArgumentTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Compiler.Argument; | ||
using CompilerCli.Compiler; | ||
using Xunit; | ||
|
||
namespace CompilerCliTest.Compiler | ||
{ | ||
public class CheckConfigCompilerArgumentTest | ||
{ | ||
private CompilerArguments arguments; | ||
private CheckConfigCompilerArgument checkConfigCompilerArgument; | ||
|
||
public CheckConfigCompilerArgumentTest() | ||
{ | ||
arguments = new CompilerArguments(); | ||
checkConfigCompilerArgument = new CheckConfigCompilerArgument(); | ||
} | ||
|
||
[Fact] | ||
public void TestItSetsCompileOnlyAsMode() | ||
{ | ||
checkConfigCompilerArgument.Parse(new List<string>(), arguments); | ||
Assert.Equal(RunMode.CHECK_CONFIG, arguments.Mode); | ||
} | ||
|
||
[Fact] | ||
public void TestItThrowsExceptionOnValues() | ||
{ | ||
Assert.Throws<ArgumentException>( | ||
() => checkConfigCompilerArgument.Parse(new List<string>(new[] { "a"}), arguments) | ||
); | ||
} | ||
|
||
[Fact] | ||
public void TestItReturnsASpecifier() | ||
{ | ||
Assert.Equal("--check-config", checkConfigCompilerArgument.GetSpecifier()); | ||
} | ||
} | ||
} |
Oops, something went wrong.