build clrmagic.dll using csc or mcs
421464
def build_extension(self, ext):
        
        if sys.platform == "win32":
            _clr_compiler = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe"
        else:
            _clr_compiler = "mcs"
        cmd = [ 
            _clr_compiler,
            "/target:library",
            "clrmagic.cs"
        ]
        check_call(" ".join(cmd), shell=True)
1141006
def build(filenames, uri, cl_args, link_args, x64, native):
    
    logging.info(_('This is source file building mode.'))
    logging.debug(_('filenames: %s'), filenames)
    logging.debug(_('uri: %s'), uri)
    logging.debug(_('cl_args: %s'), cl_args)
    logging.debug(_('link_args: %s'), link_args)
    logging.debug(_('native: %s'), native)
    logging.debug(_('x64: %s'), x64)

    if is_windows():
        pass
        # ret = msbuild(uri, native, list(filenames), x64=x64,
        #               cl_args=cl_args, link_args=link_args)
    else:
        builder = LinuxBuilder()
        ret = builder.build(filenames, x64, 'src', 'out')
    sys.exit(ret)
1296587
function tsc(projectPath, done) {
  const path = require('path');
  const platformScriptPath = require('./platform-script-path');
  const childProcess = require('child_process');

  childProcess
      .spawn(
          path.join(__dirname, platformScriptPath('../../node_modules/.bin/tsc')),
          ['-p', path.join(__dirname, '../..', projectPath)], {stdio: 'inherit'})
      .on('close', done);
}
795561
function _getNodeCompiler(
  nodeFileDir,
  nodeConfigureArgs,
  nodeMakeArgs,
  nodeVCBuildArgs,
  complete,
  type,
) {
  var dir = _getFirstDirectory(nodeFileDir);

  // standard
  var executable = 'node.exe';
  var binary = 'node';

  // iojs specifics.
  if (framework === 'iojs') {
    executable = 'iojs.exe';
    binary = 'iojs';
  }

  if (dir) {
    if (isWin) {
      complete(null, {
        dir: dir,
        version: path.basename(nodeFileDir),
        releasePath: path.join(dir, 'Release', executable),
        make: function(next) {
          // create a new env with minimal impact on old one
          var newEnv = process.env;

          if (isPy !== 'python') {
            // add the dir of the suposed python exe to path
            newEnv.path = process.env.PATH + ';' + path.dirname(isPy);
          }

          if (!nodeVCBuildArgs || !nodeVCBuildArgs.length) {
            nodeVCBuildArgs = ['nosign']; // "release" is already the default config value in VCBuild.bat
          }

          // spawn a vcbuild process with our custom enviroment.
          var vcbuild = spawn('vcbuild.bat', nodeVCBuildArgs, {
            cwd: dir,
            env: newEnv,
          });
          vcbuild.stdout.pipe(process.stdout);
          vcbuild.stderr.pipe(process.stderr);
          vcbuild.on('close', function() {
            next();
          });
        },
      });
    } else {
      complete(null, {
        dir: dir,
        version: path.basename(nodeFileDir),
        releasePath: path.join(dir, 'out', 'Release', binary),
        make: function(next) {
          var cfg = './configure',
            configure;

          var conf = [cfg];

          /* add all nodeConfigureArgs to the ./configure argument array */
          conf = [conf].concat(nodeConfigureArgs);

          // should work for all use cases now.
          configure = spawn(isPy, conf, {
            cwd: dir.toString('ascii'),
          });

          // local function, move to top eventually
          function _loop(dir) {
            /* eventually try every python file */
            var pdir = fs.readdirSync(dir);

            pdir.forEach(function(v, i) {
              var stat = fs.statSync(dir + '/' + v);
              if (stat.isFile()) {
                // only process Makefiles and .mk targets.
                if (v !== 'Makefile' && path.extname(v) !== '.mk') {
                  return;
                }

                _log('patching ' + v);

                /* patch the file */
                var py = fs.readFileSync(dir + '/' + v, {
                  encoding: 'utf8',
                });
                py = py.replace(/([a-z]|\/)*python(\w|)/gm, isPy); // this is definently needed
                fs.writeFileSync(dir + '/' + v, py, {
                  encoding: 'utf8',
                }); // write to file
              } else if (stat.isDirectory()) {
                // must be dir?
                // skip tests because we don't need them here
                if (v !== 'test') {
                  _loop(dir + '/' + v);
                }
              }
            });
          }

          configure.stdout.pipe(process.stdout);
          configure.stderr.pipe(process.stderr);

          // on error
          configure.on('error', function(err) {
            console.log('Error:', err);
            console.log('');
            console.log('Details:');
            console.log('command =', isPy, cfg, conf_args || '');
            console.log('cwd =', dir);

            var configure_path = path.join(dir, 'configure');
            var contains_configure = fs.existsSync(configure_path);

            console.log(
              'cwd contains configure,',
              contains_configure ? colors.green('yes') : colors.red('no'),
            );

            var configure_size = fs.statSync(configure_path).size;

            console.log(
              'configure is non-zero size,',
              configure_size > 0 ? colors.green('yes') : colors.red('no'),
            );

            _log('error', 'failed to launch configure.');
            process.exit(1);
          });

          // when it's finished
          configure.on('close', function() {
            if (isPy !== 'python') {
              /**
               * Originally I thought this only applied to io.js,
               * however I soon found out this affects node.js,
               * so it is now mainstream.
               */
              _log('preparing python');

              // loop over depends
              _loop(dir);
            }

            if (nodeMakeArgs === undefined) {
              nodeMakeArgs = [];
            }

            var platformMake = 'make';
            if (os.platform().match(/bsd$/) != null) {
              platformMake = 'gmake';
            }

            var make = spawn(platformMake, nodeMakeArgs, {
              cwd: dir,
            });
            make.stdout.pipe(process.stdout);
            make.stderr.pipe(process.stderr);
            make.on('error', function(err) {
              console.log(err);
              _log('error', 'failed to run make.');
              process.exit(1);
            });
            make.on('close', function() {
              next();
            });
          });
        },
      });
    }
    return true;
  }

  return false;
}
1182940
async function build() {
    const clientConfig = await webpackConfig({target: 'web', env: 'prod'});
    const serverConfig = await webpackConfig({target: 'node', env: 'prod'});

    return new Promise((resolve, reject) => {
        console.log('Compiling client...');

        // eslint-disable-next-line consistent-return
        webpack(clientConfig, (clientError, clientStats) => {
            if (clientError) {
                return reject(clientError);
            }

            const clientMessages = formatWebpackMessages(clientStats.toJson({}, true));
            if (clientMessages.errors.length) {
                return reject(new Error(clientMessages.errors.join('\n\n')));
            }

            if (
                process.env.CI &&
                (typeof process.env.CI !== 'string' || process.env.CI.toLowerCase() !== 'false') &&
                clientMessages.warnings.length
            ) {
                console.log(
                    chalk.yellow(
                        '\nTreating warnings as errors because process.env.CI = true.\n' +
                            'Most CI servers set it automatically.\n'
                    )
                );
                return reject(new Error(clientMessages.warnings.join('\n\n')));
            }

            console.log(chalk.green('Compiled client successfully.'), '\n');
            console.log('Compiling server...');
            webpack(serverConfig, (serverError, serverStats) => {
                if (serverError) {
                    return reject(serverError);
                }

                const serverMessages = formatWebpackMessages(serverStats.toJson({}, true));
                if (serverMessages.errors.length) {
                    return reject(new Error(serverMessages.errors.join('\n\n')));
                }

                if (
                    process.env.CI &&
                    (typeof process.env.CI !== 'string' || process.env.CI.toLowerCase() !== 'false') &&
                    serverMessages.warnings.length
                ) {
                    console.log(
                        chalk.yellow(
                            '\nTreating warnings as errors because process.env.CI = true.\n' +
                                'Most CI servers set it automatically.\n'
                        )
                    );
                    return reject(new Error(serverMessages.warnings.join('\n\n')));
                }

                console.log(chalk.green('Compiled server successfully.'), '\n');
                return resolve({
                    stats: clientStats,
                    warnings: Object.assign({}, clientMessages.warnings, serverMessages.warnings),
                });
            });
        });
    });
}
278236
def build_library(tile, libname, chip):
    """"""

    dirs = chip.build_dirs()

    output_name = '%s_%s.a' % (libname, chip.arch_name())

    # Support both firmware/src and just src locations for source code
    if os.path.exists('firmware'):
        VariantDir(dirs['build'], os.path.join('firmware', 'src'), duplicate=0)
    else:
        VariantDir(dirs['build'], 'src', duplicate=0)

    library_env = setup_environment(chip)
    library_env['OUTPUT'] = output_name
    library_env['OUTPUT_PATH'] = os.path.join(dirs['build'], output_name)
    library_env['BUILD_DIR'] = dirs['build']

    # Check for any dependencies this library has
    tilebus_defs = setup_dependencies(tile, library_env)

    # Create header files for all tilebus config variables and commands that are defined in ourselves
    # or in our dependencies
    tilebus_defs += tile.find_products('tilebus_definitions')
    compile_tilebus(tilebus_defs, library_env, header_only=True)

    SConscript(os.path.join(dirs['build'], 'SConscript'), exports='library_env')

    library_env.InstallAs(os.path.join(dirs['output'], output_name), os.path.join(dirs['build'], output_name))

    # See if we should copy any files over to the output:
    for src, dst in chip.property('copy_files', []):
        srcpath = os.path.join(*src)
        destpath = os.path.join(dirs['output'], dst)
        library_env.InstallAs(destpath, srcpath)

    return os.path.join(dirs['output'], output_name)
1076929
def run_vcs_tool(path, action):
    """"""
    info = get_vcs_info(get_vcs_root(path))
    tools = info['actions'][action]
    for tool, args in tools:
        if programs.find_program(tool):
            if not running_under_pytest():
                programs.run_program(tool, args, cwd=path)
            else:
                return True
            return
    else:
        cmdnames = [name for name, args in tools]
        raise ActionToolNotFound(info['name'], action, cmdnames)
1318921
def _windowsLdmodSources(target, source, env, for_signature):
    """"""
    return _dllSources(target, source, env, for_signature, 'LDMODULE')
231098
def main(arguments=None):
    

    # setup the command-line util settings
    su = tools(
        arguments=arguments,
        docString=__doc__,
        logLevel="WARNING",
        options_first=False,
        projectName=False
    )
    arguments, settings, log, dbConn = su.setup()

    # unpack remaining cl arguments using `exec` to setup the variable names
    # automatically
    for arg, val in arguments.iteritems():
        if arg[0] == "-":
            varname = arg.replace("-", "") + "Flag"
        else:
            varname = arg.replace("<", "").replace(">", "")
        if isinstance(val, str) or isinstance(val, unicode):
            exec(varname + " = '%s'" % (val,))
        else:
            exec(varname + " = %s" % (val,))
        if arg == "--dbConn":
            dbConn = val
        log.debug('%s = %s' % (varname, val,))

    if os.path.isfile(pathToYaml):
        from fundamentals.mysql import yaml_to_database
        # PARSE YAML FILE CONTENTS AND ADD TO DATABASE
        yaml2db = yaml_to_database(
            log=log,
            settings=settings,
            dbConn=dbConn
        )
        yaml2db.add_yaml_file_content_to_database(
            filepath=pathToYaml,
            deleteFile=deleteFlag
        )
        basename = os.path.basename(pathToYaml)
        print "Content of %(basename)s added to database" % locals()

    else:
        from fundamentals.mysql import yaml_to_database
        yaml2db = yaml_to_database(
            log=log,
            settings=settings,
            dbConn=dbConn,
            pathToInputDir=pathToYaml,
            deleteFiles=deleteFlag
        )
        yaml2db.ingest()
        print "Content of %(pathToYaml)s directory added to database" % locals()

    return
1045988
def build_config(ctx, target, config_path, c, extra_path, ignore, verbose, silent, debug):
    
    config_builder = LintConfigBuilder()
    try:
        # Config precedence:
        # First, load default config or config from configfile
        if config_path:
            config_builder.set_from_config_file(config_path)
        elif os.path.exists(DEFAULT_CONFIG_FILE):
            config_builder.set_from_config_file(DEFAULT_CONFIG_FILE)

        # Then process any commandline configuration flags
        config_builder.set_config_from_string_list(c)

        # Finally, overwrite with any convenience commandline flags
        if ignore:
            config_builder.set_option('general', 'ignore', ignore)
        if silent:
            config_builder.set_option('general', 'verbosity', 0)
        elif verbose > 0:
            config_builder.set_option('general', 'verbosity', verbose)

        if extra_path:
            config_builder.set_option('general', 'extra-path', extra_path)

        if target:
            config_builder.set_option('general', 'target', target)

        if debug:
            config_builder.set_option('general', 'debug', debug)

        config = config_builder.build()

        return config, config_builder
    except LintConfigError as e:
        click.echo(u"Config Error: {0}".format(ustr(e)))
    ctx.exit(CONFIG_ERROR_CODE)
1072636
def compile_cc(build_context, compiler_config, buildenv, sources,
               workspace_dir, buildenv_workspace, cmd_env):
    
    objects = []
    for src in sources:
        obj_rel_path = '{}.o'.format(splitext(src)[0])
        obj_file = join(buildenv_workspace, obj_rel_path)
        include_paths = [buildenv_workspace] + compiler_config.include_path
        compile_cmd = (
            [compiler_config.compiler, '-o', obj_file, '-c'] +
            compiler_config.compile_flags +
            ['-I{}'.format(path) for path in include_paths] +
            [join(buildenv_workspace, src)])
        # TODO: capture and transform error messages from compiler so file
        # paths match host paths for smooth(er) editor / IDE integration
        build_context.run_in_buildenv(buildenv, compile_cmd, cmd_env)
        objects.append(
            join(relpath(workspace_dir, build_context.conf.project_root),
                 obj_rel_path))
    return objects
5452
def generate_sample_cdk_cs_module(env_root, module_dir=None):
    """"""
    if module_dir is None:
        module_dir = os.path.join(env_root, 'sampleapp.cdk')
    generate_sample_module(module_dir)
    for i in ['add-project.hook.d.ts', 'cdk.json', 'package.json',
              'runway.module.yml', 'README.md']:
        shutil.copyfile(
            os.path.join(ROOT,
                         'templates',
                         'cdk-csharp',
                         i),
            os.path.join(module_dir, i),
        )
    shutil.copyfile(
        os.path.join(ROOT,
                     'templates',
                     'cdk-csharp',
                     'dot_gitignore'),
        os.path.join(module_dir, '.gitignore'),
    )
    os.mkdir(os.path.join(module_dir, 'src'))
    shutil.copyfile(
        os.path.join(ROOT,
                     'templates',
                     'cdk-csharp',
                     'src',
                     'HelloCdk.sln'),
        os.path.join(module_dir, 'src', 'HelloCdk.sln'),
    )
    os.mkdir(os.path.join(module_dir, 'src', 'HelloCdk'))
    for i in ['HelloCdk.csproj', 'HelloConstruct.cs', 'HelloStack.cs',
              'Program.cs']:
        shutil.copyfile(
            os.path.join(ROOT,
                         'templates',
                         'cdk-csharp',
                         'src',
                         'HelloCdk',
                         i),
            os.path.join(module_dir, 'src', 'HelloCdk', i),
        )
    LOGGER.info("Sample C# CDK module created at %s", module_dir)
    LOGGER.info('To finish its setup, change to the %s directory and execute '
                '"npm install" to generate its lockfile.', module_dir)
454647
def make(filenames, x64, cl_args, link_args, output):
    
    from .msbuild import Builder
    builder = Builder()
    builder.build(list(filenames), x64=x64,
                  cl_args=cl_args, link_args=link_args,
                  out_dir=output)
1289331
function Compile(input, options, callback) {

    var output = Path.join(options.cwd, Path.basename(input).slice(0, -4));

    if (options.precompiled) {
        callback(null, output);
    } else {
        CheckCobc(function (exists) {
            if (!exists) {
                return callback(new Error("Couldn't find the cobc executable in the PATH. Make sure you installed Open Cobol."));
            }

            var args = {
                x: true,
                _: input
            };
            Object.assign(args, options.compileargs);

            Exec(OArgv(args, "cobc"), {
                cwd: options.cwd
            }, function (err, stdout, stderr) {
                if (stderr || err) {
                    return callback(stderr || err);
                }
                callback(null, output);
            });
        });
    }
}
447626
def createLoadableModuleBuilder(env):
    

    try:
        ld_module = env['BUILDERS']['LoadableModule']
    except KeyError:
        import SCons.Defaults
        action_list = [ SCons.Defaults.SharedCheck,
                        SCons.Defaults.LdModuleLinkAction,
                        LibSymlinksAction ]
        ld_module = SCons.Builder.Builder(action = action_list,
                                          emitter = "$LDMODULEEMITTER",
                                          prefix = LdModPrefixGenerator,
                                          suffix = LdModSuffixGenerator,
                                          target_scanner = ProgramScanner,
                                          src_suffix = '$SHOBJSUFFIX',
                                          src_builder = 'SharedObject')
        env['BUILDERS']['LoadableModule'] = ld_module

    return ld_module
148694
function compile(
  source,
  filename = '',
  includeModule = false,
  debugMode = false,
) {
  let res
  let resName
  let errors

  try {
    const [moduleName, bsCode, diagnosticErrors] = Retyped.compile(filename, source, debugMode)
    const fmtCode = format(bsCode)
    res = fmtCode
    resName = moduleName
    errors = diagnosticErrors
  } catch (e) {
    console.error(e)
    throw new Error(`${e[0][0]}`)
  }

  if (res.includes('SYNTAX ERROR>')) {
    throw new Error(res)
  }

  if (!includeModule) {
    return res
  } else {
    return {
      moduleName: resName,
      bsCode: res,
      diagnosticErrors: errors
    }
  }
}
1081523
def fromDirectory(buildDir):
        """"""
        errorCode = c_uint()
        try:
            cdb = conf.lib.clang_CompilationDatabase_fromDirectory(buildDir,
                byref(errorCode))
        except CompilationDatabaseError as e:
            raise CompilationDatabaseError(int(errorCode.value),
                                           "CompilationDatabase loading failed")
        return cdb