File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ public static Options CreateWithEnvironment(string[] arguments)
46
46
var argsList = new List < string > ( arguments ) ;
47
47
48
48
if ( ! string . IsNullOrEmpty ( extractionOptions ) )
49
+ {
49
50
argsList . AddRange ( extractionOptions . Split ( ' ' ) ) ;
51
+ }
50
52
51
53
options . ParseArguments ( argsList ) ;
52
54
return options ;
Original file line number Diff line number Diff line change
1
+ using System ;
1
2
using Semmle . Util . Logging ;
2
3
using Semmle . Util ;
3
4
@@ -49,6 +50,7 @@ public abstract class CommonOptions : ICommandLineOptions
49
50
/// </summary>
50
51
public bool QlTest { get ; private set ; } = false ;
51
52
53
+
52
54
/// <summary>
53
55
/// The compression algorithm used for trap files.
54
56
/// </summary>
@@ -64,6 +66,16 @@ public virtual bool HandleOption(string key, string value)
64
66
case "verbosity" :
65
67
Verbosity = ( Verbosity ) int . Parse ( value ) ;
66
68
return true ;
69
+ case "compression" :
70
+ try
71
+ {
72
+ TrapCompression = ( TrapWriter . CompressionMode ) Enum . Parse ( typeof ( TrapWriter . CompressionMode ) , value , true ) ;
73
+ return true ;
74
+ }
75
+ catch ( ArgumentException )
76
+ {
77
+ return false ;
78
+ }
67
79
default :
68
80
return false ;
69
81
}
Original file line number Diff line number Diff line change
1
+ using System ;
1
2
using System . Collections . Generic ;
2
3
3
4
namespace Semmle . Util
@@ -39,8 +40,26 @@ public interface ICommandLineOptions
39
40
40
41
public static class OptionsExtensions
41
42
{
42
- public static void ParseArguments ( this ICommandLineOptions options , IReadOnlyList < string > arguments )
43
+ private static string ? GetExtractorOption ( string name ) =>
44
+ Environment . GetEnvironmentVariable ( $ "CODEQL_EXTRACTOR_CSHARP_OPTION_{ name . ToUpper ( ) } ") ;
45
+
46
+ private static List < string > GetExtractorOptions ( )
47
+ {
48
+ var extractorOptions = new List < string > ( ) ;
49
+
50
+ var compressionMode = GetExtractorOption ( "compression" ) ;
51
+ if ( ! string . IsNullOrEmpty ( compressionMode ) )
52
+ {
53
+ extractorOptions . Add ( $ "--compression:{ compressionMode } ") ;
54
+ }
55
+
56
+ return extractorOptions ;
57
+ }
58
+
59
+ public static void ParseArguments ( this ICommandLineOptions options , IReadOnlyList < string > providedArguments )
43
60
{
61
+ var arguments = GetExtractorOptions ( ) ;
62
+ arguments . AddRange ( providedArguments ) ;
44
63
for ( var i = 0 ; i < arguments . Count ; ++ i )
45
64
{
46
65
var arg = arguments [ i ] ;
You can’t perform that action at this time.
0 commit comments