Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build,windows: clean lint paths in vcbuild.bat #12278

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ icu_config.gypi
# Xcode workspaces and project folders
*.xcodeproj
*.xcworkspace
/*.log
4 changes: 3 additions & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Support is divided into three tiers:
|--------------|--------------|----------------------------------|----------------------|------------------|
| GNU/Linux | Tier 1 | kernel >= 2.6.18, glibc >= 2.5 | x86, x64, arm, arm64 | |
| macOS | Tier 1 | >= 10.10 | x64 | |
| Windows | Tier 1 | >= Windows 7 or >= Windows2008R2 | x86, x64 | |
| Windows | Tier 1 | >= Windows 7 / 2008 R2 | x86, x64 | vs2015 or vs2017 |
| SmartOS | Tier 2 | >= 15 < 16.4 | x86, x64 | see note1 |
| FreeBSD | Tier 2 | >= 10 | x64 | |
| GNU/Linux | Tier 2 | kernel >= 4.2.0, glibc >= 2.19 | ppc64be | |
Expand Down Expand Up @@ -176,6 +176,8 @@ Prerequisites:
* [Visual Studio 2015 Update 3](https://www.visualstudio.com/), all editions
including the Community edition (remember to select
"Common Tools for Visual C++ 2015" feature during installation).
* [Visual Studio 2017](https://www.visualstudio.com/downloads/), any edition (including the Build Tools SKU).
__Required Components:__ "MSbuild", "VC++ 2017 v141 toolset" and one of the Windows SDKs (10 or 8.1).
* Basic Unix tools required for some tests,
[Git for Windows](http://git-scm.com/download/win) includes Git Bash
and tools which can be included in the global `PATH`.
Expand Down
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
'SuppressStartupBanner': 'true',
},
},
'msvs_disabled_warnings': [4351, 4355, 4800],
'msvs_disabled_warnings': [4351, 4355, 4800, 4251, 4244, 4312, 4275],
'conditions': [
['asan == 1 and OS != "mac"', {
'cflags+': [
Expand Down
55 changes: 39 additions & 16 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ parser.add_option('-C',
dest='compile_commands_json',
help=optparse.SUPPRESS_HELP)

parser.add_option('--verbose',
action='store_true',
dest='verbose',
default=False,
help='make output more verbose')

(options, args) = parser.parse_args()

# Expand ~ in the install prefix now, it gets written to multiple files.
Expand Down Expand Up @@ -1004,10 +1010,21 @@ def configure_static(o):
if options.enable_asan:
o['libraries'] += ['-static-libasan']

def config_vs2017(o):
if os.environ.get('VisualStudioVersion') != '15.0': return
sdk_ver = os.environ.get('WindowsSDKVersion', '').rstrip("\\")
if not sdk_ver:
print(' Error: could not find a compatible SDK, ' +
'make sure you have either a Windows 10 or 8.1 SDK installed')
sys.exit(1)
o['msvs_windows_target_platform_version'] = sdk_ver
o['msbuild_toolset'] = 'v141'


def write(filename, data):
filename = os.path.join(root_dir, filename)
print('creating %s' % filename)
if options.verbose:
print('creating %s' % filename)
f = open(filename, 'w+')
f.write(data)

Expand All @@ -1027,7 +1044,8 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
patchfile = '%s/%s/%s' % (dir_base, patch_dir, file)
if os.path.isfile(patchfile):
srcfile = '%s/%s' % (patch_dir, file)
print('Using version-specific floating patch %s' % patchfile)
if options.verbose:
print('Using version-specific floating patch %s' % patchfile)
list.append(srcfile)
break
return list
Expand All @@ -1054,11 +1072,14 @@ def configure_intl(o):
if nodedownload.candownload(auto_downloads, "icu"):
nodedownload.retrievefile(url, targetfile)
else:
print('Re-using existing %s' % targetfile)
if options.verbose:
print('Re-using existing %s' % targetfile)
if os.path.isfile(targetfile):
print('Checking file integrity with MD5:\r')
if options.verbose:
print('Checking file integrity with MD5:\r')
gotmd5 = nodedownload.md5sum(targetfile)
print('MD5: %s %s' % (gotmd5, targetfile))
if options.verbose:
print('MD5: %s %s' % (gotmd5, targetfile))
if (md5 == gotmd5):
return targetfile
else:
Expand All @@ -1073,8 +1094,7 @@ def configure_intl(o):
return

# write an empty file to start with
write(icu_config_name, do_not_edit +
pprint.pformat(icu_config, indent=2) + '\n')
write(icu_config_name, do_not_edit + pprint.pformat(icu_config, indent=2) + '\n')

# always set icu_small, node.gyp depends on it being defined.
o['variables']['icu_small'] = b(False)
Expand Down Expand Up @@ -1220,7 +1240,8 @@ def configure_intl(o):
print('(Fix, or disable with "--with-intl=none" )')
sys.exit(1)
else:
print('* Using ICU in %s' % icu_full_path)
if options.verbose:
print('* Using ICU in %s' % icu_full_path)
# Now, what version of ICU is it? We just need the "major", such as 54.
# uvernum.h contains it as a #define.
uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h')
Expand Down Expand Up @@ -1284,8 +1305,7 @@ def configure_intl(o):
path = '../../%s/source/%s' % (icu_full_path, icu_src[i])
icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) )
# write updated icu_config.gypi with a bunch of paths
write(icu_config_name, do_not_edit +
pprint.pformat(icu_config, indent=2) + '\n')
write(icu_config_name, do_not_edit + pprint.pformat(icu_config, indent=2) + '\n')
return # end of configure_intl

def configure_inspector(o):
Expand Down Expand Up @@ -1325,6 +1345,7 @@ configure_openssl(output)
configure_intl(output)
configure_static(output)
configure_inspector(output)
config_vs2017(output)

# variables should be a root level element,
# move everything else to target_defaults
Expand All @@ -1337,8 +1358,7 @@ config_fips = { 'make_global_settings' : [] }
if 'make_fips_settings' in output:
config_fips['make_global_settings'] = output['make_fips_settings']
del output['make_fips_settings']
write('config_fips.gypi', do_not_edit +
pprint.pformat(config_fips, indent=2) + '\n')
write('config_fips.gypi', do_not_edit + pprint.pformat(config_fips, indent=2) + '\n')

# make_global_settings should be a root level element too
if 'make_global_settings' in output:
Expand All @@ -1354,10 +1374,10 @@ output = {
if make_global_settings:
output['make_global_settings'] = make_global_settings

pprint.pprint(output, indent=2)

write('config.gypi', do_not_edit +
pprint.pformat(output, indent=2) + '\n')
config_content = pprint.pformat(output, indent=2)
if options.verbose:
print(config_content)
write('config.gypi', do_not_edit + config_content + '\n')

config = {
'BUILDTYPE': 'Debug' if options.debug else 'Release',
Expand Down Expand Up @@ -1387,6 +1407,9 @@ else:
if options.compile_commands_json:
gyp_args += ['-f', 'compile_commands_json']

if options.verbose:
gyp_args += ['--verbose']

gyp_args += args

if warn.warned:
Expand Down
37 changes: 18 additions & 19 deletions tools/gyp_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,14 @@
output_dir = os.path.join(os.path.abspath(node_root), 'out')

def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
print 'Error running GYP'
sys.exit(rc)

if __name__ == '__main__':
args = sys.argv[1:]

# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
if sys.platform == 'win32':
args.append(os.path.join(node_root, 'node.gyp'))
common_fn = os.path.join(node_root, 'common.gypi')
options_fn = os.path.join(node_root, 'config.gypi')
options_fips_fn = os.path.join(node_root, 'config_fips.gypi')
else:
args.append(os.path.join(os.path.abspath(node_root), 'node.gyp'))
common_fn = os.path.join(os.path.abspath(node_root), 'common.gypi')
options_fn = os.path.join(os.path.abspath(node_root), 'config.gypi')
options_fips_fn = os.path.join(os.path.abspath(node_root), 'config_fips.gypi')
arg_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root)
args.append(os.path.join(arg_path, 'node.gyp'))
common_fn = os.path.join(arg_path, 'common.gypi')
options_fn = os.path.join(arg_path, 'config.gypi')
options_fips_fn = os.path.join(arg_path, 'config_fips.gypi')

if os.path.exists(common_fn):
args.extend(['-I', common_fn])
Expand All @@ -58,10 +45,22 @@ def run_gyp(args):
args.append('-Dlibrary=static_library')

# Don't compile with -B and -fuse-ld=, we don't bundle ld.gold. Can't be
# set in common.gypi due to how deps/v8/build/toolchain.gypi uses them.
# set in common.gypi due to deps/v8/build/toolchain.gypi overwriting them.
args.append('-Dlinux_use_bundled_binutils=0')
args.append('-Dlinux_use_bundled_gold=0')
args.append('-Dlinux_use_gold_flags=0')

if '--verbose' in args:
# TODO(refack) maybe set -D for `GYP` instead
args.remove('--verbose')
print('\nGYP args: {0}'.format(' '.join(args)))
rc = gyp.main(args)
if rc != 0:
print 'Error running GYP'
sys.exit(rc)


if __name__ == '__main__':
args = sys.argv[1:]
gyp_args = list(args)
run_gyp(gyp_args)
40 changes: 40 additions & 0 deletions tools/msvs-com-helper/GetKey.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2017 - Refael Ackermann
# Distributed under MIT style license
# See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
# version: 1.12.2

param (
[Parameter(Mandatory=$false)]
[string[]]$filters = "IsVcCompatible",
[Parameter(Mandatory=$false)]
[string[]]$keys = "VisualCppToolsCL",
[Parameter(Mandatory=$false)]
[switch]$Information
)
$invocation = (Get-Variable MyInvocation).Value
cd (Split-Path $invocation.MyCommand.Path)
if (-NOT (Test-Path 'Registry::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}')) { Exit 1 }
Add-Type -Path GetVS2017Configuration.cs;
$insts = [VisualStudioConfiguration.ComSurrogate]::QueryEx()
if ($Information) {
$insts | % { [Console]::Error.WriteLine('Found VS2017 "' +$_['Name'] + '" installed at "' + $_['InstallationPath'] + '"') }
}
$insts | % { $_.Add('Fail', @()) }
foreach ($filter in $filters) {
if ($filter -eq "*") { continue; }
if ($filter -like "*=*") {
$parts = $filter -Split "=";
$filter = $parts[0];
$criteria = $parts[1];
$insts | % { if ($_.Get($filter) -ne $criteria) { $_['Fail'] += $filter } }
} else {
$insts | % { if (!($_.Get($filter))) { $_['Fail'] += $filter } }
}
}
if ($Information) {
$insts | % { if ($_['Fail'].length -ne 0) {[Console]::Error.WriteLine('"' +$_['Name'] + '" installed in "' + $_['InstallationPath'] + '" does not meet criteria "' + $_['Fail'] + '"') } }
}
$insts = $insts | where { $_['Fail'].length -eq 0 }
foreach ($key in $keys) {
if ($key -eq "*") { $insts | echo } else { $insts | % { $_.Get($key) } }
}
Loading