MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / runVbc

Method runVbc

lib/compilers/dotnet.ts:389–459  ·  view source on GitHub ↗
(
        dotnetPath: string,
        compilerInfo: DotNetCompilerInfo,
        inputFilename: string,
        outputFilename: string,
        execOptions: ExecutionOptionsWithEnv,
        compilerOptions: string[],
        buildToBinary?: boolean,
    )

Source from the content-addressed store, hash-verified

387 }
388
389 async runVbc(
390 dotnetPath: string,
391 compilerInfo: DotNetCompilerInfo,
392 inputFilename: string,
393 outputFilename: string,
394 execOptions: ExecutionOptionsWithEnv,
395 compilerOptions: string[],
396 buildToBinary?: boolean,
397 ) {
398 const {refAssemblies, analyzers} = await this.getRefAssembliesAndAnalyzers(dotnetPath, compilerInfo, 'vb');
399 const defines = this.getPreprocessorDefines(compilerInfo.sdkMajorVersion, 'vb');
400 const options = [
401 '-nologo',
402 `-target:${buildToBinary ? 'exe' : 'library'}`,
403 '-filealign:512',
404 `-imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,\
405System.Diagnostics,System.Linq,System.Xml.Linq,System.Threading.Tasks`,
406 '-optioncompare:Binary',
407 '-optionexplicit+',
408 '-optionstrict:custom',
409 '-nowarn:41999,42016,42017,42018,42019,42020,42021,42022,42032,42036',
410 '-nosdkpath',
411 '-optioninfer+',
412 '-nostdlib',
413 '-errorreport:prompt',
414 '-rootnamespace:CompilerExplorer',
415 '-highentropyva+',
416 '-debug:portable',
417 '-optimize+',
418 '-warnaserror-',
419 '-utf8output',
420 '-deterministic+',
421 `-langversion:${this.langVersion}`,
422 '-warnaserror+:NU1605,SYSLIB0011',
423 ...compilerOptions,
424 ];
425 for (const analyzer of analyzers) {
426 options.push(`-analyzer:${analyzer}`);
427 }
428 for (const refAssembly of refAssemblies) {
429 options.push(`-reference:${refAssembly}`);
430 }
431
432 const vbRuntime = refAssemblies.find(f => f.includes('Microsoft.VisualBasic.dll'));
433 if (vbRuntime) {
434 options.push(`-vbruntime:${vbRuntime}`);
435 }
436
437 const assemblyInfo = `Option Strict Off
438Option Explicit On
439
440Imports System
441Imports System.Reflection
442<Assembly: Global.System.Runtime.Versioning.TargetFrameworkAttribute\
443(".NETCoreApp,Version=v${compilerInfo.sdkMajorVersion}.0",\
444 FrameworkDisplayName:=".NET ${compilerInfo.sdkMajorVersion}.0")>
445<Assembly: System.Reflection.AssemblyCompanyAttribute("CompilerExplorer"), _
446 Assembly: System.Reflection.AssemblyConfigurationAttribute("Release"), _

Callers 1

buildToDllMethod · 0.95

Calls 5

pushMethod · 0.80
findMethod · 0.80
runCompilerMethod · 0.45

Tested by

no test coverage detected