diff options
-rw-r--r-- | net/crash_cache.scons | 66 | ||||
-rw-r--r-- | net/dump_cache.scons | 63 | ||||
-rw-r--r-- | net/net_lib.scons | 366 | ||||
-rw-r--r-- | net/net_perftests.scons | 88 | ||||
-rw-r--r-- | net/net_unittests.scons | 215 | ||||
-rw-r--r-- | net/stress_cache.scons | 65 | ||||
-rw-r--r-- | net/tools/tld_cleanup/tld_cleanup.scons | 63 | ||||
-rw-r--r-- | site_scons/site_tools/_Node_MSVS.py | 401 | ||||
-rw-r--r-- | site_scons/site_tools/chromium_builders.py | 6 |
9 files changed, 1123 insertions, 210 deletions
diff --git a/net/crash_cache.scons b/net/crash_cache.scons index 0aab3ec..834cb51 100644 --- a/net/crash_cache.scons +++ b/net/crash_cache.scons @@ -24,20 +24,66 @@ if env.Bit('windows'): ], ) -input_files = [ - 'disk_cache/disk_cache_test_util$OBJSUFFIX', +# TODO: restore to alphabetical order; below matches original .vcproj. +input_files = ChromeFileList([ 'tools/crash_cache/crash_cache.cc', -] + 'disk_cache/disk_cache_test_util$OBJSUFFIX', +]) if not env.AnyBits('linux', 'mac'): # TODO(port): port to linux and mac? env.ChromeTestProgram('crash_cache', input_files) -env.ChromeMSVSProject('$NET_DIR/build/crash_cache.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$NET_DIR/build/net.vcproj', - '$ICU38_DIR/build/icu.vcproj', - ], - guid='{B0EE0599-2913-46A0-A847-A3EC813658D3}') +p = env.ChromeMSVSProject('$NET_DIR/build/crash_cache.vcproj', + guid='{B0EE0599-2913-46A0-A847-A3EC813658D3}', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$NET_DIR/build/net.vcproj', + '$ICU38_DIR/build/icu.vcproj', + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=TODO, + files=input_files, + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + 'VCCLCompilerTool', + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + MSVSTool('VCLinkerTool', + SubSystem='1'), + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ], + ConfigurationType='1') + + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/crash_cache.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/dump_cache.scons b/net/dump_cache.scons index 0dfa39c..75231bb 100644 --- a/net/dump_cache.scons +++ b/net/dump_cache.scons @@ -23,21 +23,66 @@ if env.Bit('windows'): ], ) -input_files = [ +input_files = ChromeFileList([ 'tools/dump_cache/dump_cache.cc', 'tools/dump_cache/dump_files.cc', 'tools/dump_cache/upgrade.cc', -] +]) if env.Bit('windows'): env.ChromeTestProgram('dump_cache', input_files) -env.ChromeMSVSProject('$NET_DIR/build/dump_cache.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$ICU38_DIR/build/icu.vcproj', - '$NET_DIR/build/net.vcproj', - ], - guid='{4A14E455-2B7C-4C0F-BCC2-35A9666C186F}') +p = env.ChromeMSVSProject('$NET_DIR/build/dump_cache.vcproj', + guid='{4A14E455-2B7C-4C0F-BCC2-35A9666C186F}', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$ICU38_DIR/build/icu.vcproj', + '$NET_DIR/build/net.vcproj', + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=TODO, + files=input_files, + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + 'VCCLCompilerTool', + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + MSVSTool('VCLinkerTool', + SubSystem='1'), + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ], + ConfigurationType='1') + + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/dump_cache.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/net_lib.scons b/net/net_lib.scons index 30e83a8..5f0bf0f 100644 --- a/net/net_lib.scons +++ b/net/net_lib.scons @@ -8,7 +8,7 @@ Configuration for building net.lib / libnet.a. Import('env') -env = env.Clone() +env = env.Clone(COMPONENT_STATIC=True) env.ApplySConscript([ '$GRIT_DIR/build/using_generated_resources.scons', @@ -17,105 +17,269 @@ env.ApplySConscript([ '$ZLIB_DIR/using_zlib.scons', ]) -# These net files work on *all* platforms; files that don't work -# cross-platform live below. -input_files = [ +input_files = ChromeFileList([ + MSVSFilter('base', [ 'base/address_list.cc', + 'base/address_list.h', + 'base/auth.h', 'base/auth_cache.cc', + 'base/auth_cache.h', 'base/base64.cc', + 'base/base64.h', 'base/bzip2_filter.cc', + 'base/bzip2_filter.h', + 'base/cert_status_flags.h', + 'base/client_socket.h', 'base/client_socket_factory.cc', + 'base/client_socket_factory.h', 'base/client_socket_handle.cc', + 'base/client_socket_handle.h', 'base/client_socket_pool.cc', + 'base/client_socket_pool.h', + 'base/completion_callback.h', 'base/cookie_monster.cc', + 'base/cookie_monster.h', 'base/cookie_policy.cc', + 'base/cookie_policy.h', 'base/data_url.cc', + 'base/data_url.h', 'base/directory_lister.cc', + 'base/directory_lister.h', 'base/dns_resolution_observer.cc', + 'base/dns_resolution_observer.h', + 'base/effective_tld_names.dat', 'base/escape.cc', + 'base/escape.h', 'base/ev_root_ca_metadata.cc', + 'base/ev_root_ca_metadata.h', + 'base/file_stream.h', + 'base/file_stream_win.cc', 'base/filter.cc', + 'base/filter.h', 'base/gzip_filter.cc', + 'base/gzip_filter.h', 'base/gzip_header.cc', + 'base/gzip_header.h', 'base/host_resolver.cc', + 'base/host_resolver.h', 'base/listen_socket.cc', + 'base/listen_socket.h', + 'base/load_flags.h', 'base/mime_sniffer.cc', + 'base/mime_sniffer.h', 'base/mime_util.cc', + 'base/mime_util.h', + 'base/net_error_list.h', 'base/net_errors.cc', + 'base/net_errors.h', 'base/net_module.cc', + 'base/net_module.h', + 'base/net_resources.h', 'base/net_util.cc', + 'base/net_util.h', + 'base/net_util_win.cc', + 'base/platform_mime_util.h', + 'base/platform_mime_util_win.cc', + 'build/precompiled_net.cc', + 'build/precompiled_net.h', 'base/registry_controlled_domain.cc', + 'base/registry_controlled_domain.h', + 'base/scoped_cert_chain_context.h', 'base/sdch_filter.cc', + 'base/sdch_filter.h', 'base/sdch_manager.cc', + 'base/sdch_manager.h', + 'base/socket.h', + 'base/ssl_client_socket.h', + 'base/ssl_client_socket_win.cc', + 'base/ssl_client_socket_win.h', 'base/ssl_config_service.cc', + 'base/ssl_config_service.h', + 'base/ssl_info.h', + 'base/ssl_test_util.cc', + 'base/tcp_client_socket.h', + 'base/tcp_client_socket_win.cc', 'base/telnet_server.cc', + 'base/telnet_server.h', 'base/upload_data.cc', + 'base/upload_data.h', 'base/upload_data_stream.cc', + 'base/upload_data_stream.h', + 'base/wininet_util.cc', + 'base/wininet_util.h', + 'base/winsock_init.cc', + 'base/winsock_init.h', 'base/x509_certificate.cc', - 'disk_cache/backend_impl.cc', - 'disk_cache/block_files.cc', - 'disk_cache/entry_impl.cc', - 'disk_cache/eviction.cc', - 'disk_cache/file_lock.cc', - 'disk_cache/hash.cc', - 'disk_cache/mem_backend_impl.cc', - 'disk_cache/mem_entry_impl.cc', - 'disk_cache/mem_rankings.cc', - 'disk_cache/rankings.cc', - 'disk_cache/stats.cc', - 'disk_cache/stats_histogram.cc', - 'disk_cache/trace.cc', - 'ftp/ftp_network_layer.cc', - 'ftp/ftp_network_transaction.cc', - 'http/cert_status_cache.cc', - 'http/http_auth.cc', - 'http/http_auth_cache.cc', - 'http/http_auth_handler.cc', - 'http/http_auth_handler_basic.cc', - 'http/http_auth_handler_digest.cc', - 'http/http_cache.cc', - 'http/http_chunked_decoder.cc', - 'http/http_network_layer.cc', - 'http/http_network_transaction.cc', - 'http/http_response_headers.cc', - 'http/http_transaction_winhttp.cc', - 'http/http_util.cc', - 'http/http_vary_data.cc', - 'http/winhttp_request_throttle.cc', - 'proxy/proxy_script_fetcher.cc', - 'proxy/proxy_service.cc', + 'base/x509_certificate.h', + 'base/x509_certificate_win.cc', + ]), + MSVSFilter('url_request', [ 'url_request/mime_sniffer_proxy.cc', + 'url_request/mime_sniffer_proxy.h', 'url_request/url_request.cc', + 'url_request/url_request.h', 'url_request/url_request_about_job.cc', + 'url_request/url_request_about_job.h', + 'url_request/url_request_context.h', 'url_request/url_request_error_job.cc', + 'url_request/url_request_error_job.h', 'url_request/url_request_file_dir_job.cc', + 'url_request/url_request_file_dir_job.h', 'url_request/url_request_file_job.cc', + 'url_request/url_request_file_job.h', 'url_request/url_request_filter.cc', + 'url_request/url_request_filter.h', 'url_request/url_request_ftp_job.cc', + 'url_request/url_request_ftp_job.h', 'url_request/url_request_http_job.cc', + 'url_request/url_request_http_job.h', + 'url_request/url_request_inet_job.cc', + 'url_request/url_request_inet_job.h', 'url_request/url_request_job.cc', + 'url_request/url_request_job.h', 'url_request/url_request_job_manager.cc', + 'url_request/url_request_job_manager.h', 'url_request/url_request_job_metrics.cc', + 'url_request/url_request_job_metrics.h', 'url_request/url_request_job_tracker.cc', + 'url_request/url_request_job_tracker.h', 'url_request/url_request_simple_job.cc', + 'url_request/url_request_simple_job.h', + 'url_request/url_request_status.h', 'url_request/url_request_test_job.cc', + 'url_request/url_request_test_job.h', 'url_request/url_request_view_cache_job.cc', -] + 'url_request/url_request_view_cache_job.h', + ]), + MSVSFilter('http', [ + 'http/cert_status_cache.cc', + 'http/cert_status_cache.h', + 'http/http_atom_list.h', + 'http/http_cache.cc', + 'http/http_cache.h', + 'http/http_chunked_decoder.cc', + 'http/http_chunked_decoder.h', + 'http/http_network_layer.cc', + 'http/http_network_layer.h', + 'http/http_network_session.h', + 'http/http_network_transaction.cc', + 'http/http_network_transaction.h', + 'http/http_request_info.h', + 'http/http_response_headers.cc', + 'http/http_response_headers.h', + 'http/http_response_info.h', + 'http/http_transaction.h', + 'http/http_transaction_factory.h', + 'http/http_transaction_winhttp.cc', + 'http/http_transaction_winhttp.h', + 'http/http_util.cc', + 'http/http_util.h', + 'http/http_auth.cc', + 'http/http_auth.h', + 'http/http_auth_cache.cc', + 'http/http_auth_cache.h', + 'http/http_auth_handler.h', + 'http/http_auth_handler.cc', + 'http/http_auth_handler_basic.cc', + 'http/http_auth_handler_basic.h', + 'http/http_auth_handler_digest.cc', + 'http/http_auth_handler_digest.h', + 'http/http_auth.cc', + 'http/http_auth.h', + 'http/http_auth_handler.h', + 'http/http_auth_handler.cc', + 'http/http_auth_handler_basic.cc', + 'http/http_auth_handler_basic.h', + 'http/http_auth_handler_digest.cc', + 'http/http_auth_handler_digest.h', + 'http/http_vary_data.cc', + 'http/http_vary_data.h', + 'http/winhttp_request_throttle.cc', + 'http/winhttp_request_throttle.h', + ]), + MSVSFilter('disk_cache', [ + 'disk_cache/addr.h', + 'disk_cache/backend_impl.cc', + 'disk_cache/backend_impl.h', + 'disk_cache/block_files.cc', + 'disk_cache/block_files.h', + 'disk_cache/cache_util.h', + 'disk_cache/cache_util_win.cc', + 'disk_cache/disk_cache.h', + 'disk_cache/disk_format.h', + 'disk_cache/entry_impl.cc', + 'disk_cache/entry_impl.h', + 'disk_cache/errors.h', + 'disk_cache/eviction.cc', + 'disk_cache/eviction.h', + 'disk_cache/file.h', + 'disk_cache/file_block.h', + 'disk_cache/file_lock.cc', + 'disk_cache/file_lock.h', + 'disk_cache/file_win.cc', + 'disk_cache/hash.cc', + 'disk_cache/hash.h', + 'disk_cache/mapped_file.h', + 'disk_cache/mapped_file_win.cc', + 'disk_cache/mem_backend_impl.cc', + 'disk_cache/mem_backend_impl.h', + 'disk_cache/mem_entry_impl.cc', + 'disk_cache/mem_entry_impl.h', + 'disk_cache/mem_rankings.cc', + 'disk_cache/mem_rankings.h', + 'disk_cache/rankings.cc', + 'disk_cache/rankings.h', + 'disk_cache/stats.cc', + 'disk_cache/stats.h', + 'disk_cache/stats_histogram.cc', + 'disk_cache/stats_histogram.h', + 'disk_cache/storage_block-inl.h', + 'disk_cache/storage_block.h', + 'disk_cache/trace.cc', + 'disk_cache/trace.h', + ]), + MSVSFilter('proxy', [ + 'proxy/proxy_config_service_fixed.h', + 'proxy/proxy_config_service_win.cc', + 'proxy/proxy_config_service_win.h', + 'proxy/proxy_resolver_winhttp.cc', + 'proxy/proxy_resolver_winhttp.h', + 'proxy/proxy_script_fetcher.cc', + 'proxy/proxy_script_fetcher.h', + 'proxy/proxy_service.cc', + 'proxy/proxy_service.h', + ]), + MSVSFilter('ftp', [ + 'ftp/ftp_network_layer.cc', + 'ftp/ftp_network_layer.h', + 'ftp/ftp_network_session.h', + 'ftp/ftp_network_transaction.cc', + 'ftp/ftp_network_transaction.h', + 'ftp/ftp_request_info.h', + 'ftp/ftp_response_info.h', + 'ftp/ftp_transaction.h', + 'ftp/ftp_transaction_factory.h', + ]), +]) if env.Bit('posix'): # Remove files that still need to be ported from the input_files list. # TODO(port): delete files from this list as they get ported. - to_be_ported_files = [ + input_files.Remove( 'base/ssl_config_service.cc', 'http/http_transaction_winhttp.cc', 'http/winhttp_request_throttle.cc', 'url_request/url_request_ftp_job.cc', - ] - for remove in to_be_ported_files: - input_files.remove(remove) + ) -if env.Bit('windows'): - input_files.extend([ +if not env.Bit('windows'): + # Remove windows-specific files on non-Windows platforms. + # TODO(sgk): + # Remove the windows-specific files from the input_files list above + # and turn this back in to an add-on-Windows list (like we used to) + # once we're comfortable re-ordering the files in the generated + # .vcproj file(s). + input_files.Remove( 'base/file_stream_win.cc', 'base/net_util_win.cc', 'base/platform_mime_util_win.cc', @@ -124,16 +288,17 @@ if env.Bit('windows'): 'base/wininet_util.cc', 'base/winsock_init.cc', 'base/x509_certificate_win.cc', + 'build/precompiled_net.cc', 'disk_cache/cache_util_win.cc', 'disk_cache/file_win.cc', 'disk_cache/mapped_file_win.cc', 'proxy/proxy_config_service_win.cc', 'proxy/proxy_resolver_winhttp.cc', 'url_request/url_request_inet_job.cc', - ]) + ) if env.Bit('mac'): - input_files.extend([ + input_files.Extend([ 'base/platform_mime_util_mac.cc', 'base/ssl_client_socket_mac.cc', 'base/x509_certificate_mac.cc', @@ -141,7 +306,7 @@ if env.Bit('mac'): ]) if env.Bit('linux'): - input_files.extend([ + input_files.Extend([ 'base/nss_memio.c', # TODO(tc): gnome-vfs? xdgmime? /etc/mime.types? 'base/platform_mime_util_linux.cc', @@ -150,7 +315,7 @@ if env.Bit('linux'): ]) if env.Bit('posix'): - input_files.extend([ + input_files.Extend([ 'base/file_stream_posix.cc', 'base/net_util_posix.cc', 'base/tcp_client_socket_libevent.cc', @@ -163,17 +328,108 @@ if env.Bit('windows'): # TODO(bradnelson): This step generates file precompiled_net.pch.ib_tag # possibly only on incredibuild, scons doesn't know this. env_p = env.Clone() - env_p.Append(CCFLAGS='/Ylnet') + # TODO(sgk): for now, add the same _LIB flag that Hammer adds to + # the other .obj files + env_p.Append(CCFLAGS='/Ylnet', + CPPDEFINES=['_LIB']) pch, obj = env_p.PCH('precompiled_net.pch', 'build/precompiled_net.cc') env['PCH'] = pch env['PCHSTOP'] = 'precompiled_net.h' env.Append(CCPCHFLAGS = ['/FIprecompiled_net.h']) - input_files += [obj] + input_files.Replace('build/precompiled_net.cc', obj) + +lib = env.ChromeLibrary('net', input_files) + +p = env.ChromeMSVSProject('$NET_DIR/build/net.vcproj', + guid='{326E9795-E760-410A-B69A-3F79DB3F5243}', + dependencies = [ + '$NET_DIR/build/tld_cleanup.vcproj' + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=[lib[0]], + files=input_files, + ConfigurationType='4') + +p.AddToolFile('build/convert_tld_data.rules') + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + '$(SolutionDir)../third_party/icu38/build/using_icu.vsprops', + '$(SolutionDir)../third_party/zlib/using_zlib.vsprops', + '$(SolutionDir)../sdch/using_sdch.vsprops', + '$(SolutionDir)../tools/grit/build/using_generated_resources.vsprops', + ], + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'Convert TLD Data File', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + MSVSTool('VCCLCompilerTool', + PrecompiledHeaderThrough='precompiled_net.h', + ForcedIncludeFiles='precompiled_net.h', + UsePrecompiledHeader='2'), + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + 'VCLibrarianTool', + 'VCALinkTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCPostBuildEventTool', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + '$(SolutionDir)../third_party/icu38/build/using_icu.vsprops', + '$(SolutionDir)../third_party/zlib/using_zlib.vsprops', + '$(SolutionDir)../sdch/using_sdch.vsprops', + '$(SolutionDir)../tools/grit/build/using_generated_resources.vsprops', + ], + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'Convert TLD Data File', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + 'VCCLCompilerTool', + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + 'VCLibrarianTool', + 'VCALinkTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCPostBuildEventTool', + ]) + +# TODO(sgk): remove when we can derive this information +p.AddFileConfig('build/precompiled_net.cc', + 'Debug|Win32', + tools=[ + MSVSTool('VCCLCompilerTool', + UsePrecompiledHeader='1'), + ]) + +# TODO(sgk): remove when we can derive this information +p.AddFileConfig('build/precompiled_net.cc', + 'Release|Win32', + ExcludedFromBuild='true', + tools=[ + 'VCCLCompilerTool', + ]) -env.ChromeLibrary('net', input_files) +env.AlwaysBuild(p) -env.ChromeMSVSProject('$NET_DIR/build/net.vcproj', - dependencies = [ - '$NET_DIR/build/tld_cleanup.vcproj' - ], - guid='{326E9795-E760-410A-B69A-3F79DB3F5243}') +i = env.Command('$CHROME_SRC_DIR/net/build/net.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/net_perftests.scons b/net/net_perftests.scons index c2b16a2..5f0529a 100644 --- a/net/net_perftests.scons +++ b/net/net_perftests.scons @@ -37,27 +37,85 @@ elif env.Bit('linux'): CCFLAGS = ['-fno-strict-aliasing'], ) -input_files = [ +input_files = ChromeFileList([ + # TODO(sgk): violate standard indentation so we don't have to + # reindent too much when we remove the explicit MSVSFilter() calls + # in favor of generating the hierarchy to reflect the file system. + MSVSFilter('support', [ + '../base/perftimer$OBJSUFFIX', + '../base/run_all_perftests$OBJSUFFIX', + ]), + MSVSFilter('tests', [ 'base/cookie_monster_perftest.cc', 'disk_cache/disk_cache_perftest.cc', 'disk_cache/disk_cache_test_util$OBJSUFFIX', - - # TODO(sgk): avoid using .cc from base directly - '$OBJ_ROOT/base/run_all_perftests$OBJSUFFIX', - '$OBJ_ROOT/base/perftimer$OBJSUFFIX', -] + ]), +]) if not env.Bit('mac'): env.ChromeTestProgram('net_perftests', input_files) env.ChromeMSVSProject('$NET_DIR/build/net_perftests.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$NET_DIR/build/net.vcproj', - '$MODP_B64_DIR/modp_b64.vcproj', - '$ICU38_DIR/build/icu.vcproj', - '$TESTING_DIR/gtest.vcproj', - '$GOOGLEURL_DIR/build/googleurl.vcproj', - '$SDCH_DIR/sdch.vcproj', - ], guid='{AAC78796-B9A2-4CD9-BF89-09B03E92BF73}') + +# TODO######################################################################## + +p = env.ChromeMSVSProject('$NET_DIR/build/net_perftests.vcproj', + guid='{AAC78796-B9A2-4CD9-BF89-09B03E92BF73}', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$NET_DIR/build/net.vcproj', + '$MODP_B64_DIR/modp_b64.vcproj', + '$ICU38_DIR/build/icu.vcproj', + '$TESTING_DIR/gtest.vcproj', + '$GOOGLEURL_DIR/build/googleurl.vcproj', + '$SDCH_DIR/sdch.vcproj', + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=TODO, + files=input_files, + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + # TODO(sgk): pull this from CPPDEFINES. + MSVSTool('VCCLCompilerTool', + PreprocessorDefinitions='PERF_TEST'), + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + 'VCLinkerTool', + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ], + ConfigurationType='1') + + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + '$(SolutionDir)../testing/using_gtest.vsprops', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + '$(SolutionDir)../testing/using_gtest.vsprops', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/net_perftests.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/net_unittests.scons b/net/net_unittests.scons index 9d4fe72..2b3911e 100644 --- a/net/net_unittests.scons +++ b/net/net_unittests.scons @@ -34,7 +34,46 @@ if env.Bit('windows'): ], ) -input_files = [ +input_files = ChromeFileList([ + # TODO(sgk): violate standard indentation so we don't have to + # reindent too much when we remove the explicit MSVSFilter() calls + # in favor of generating the hierarchy to reflect the file system. + MSVSFilter('support', [ + 'build/precompiled_net$OBJSUFFIX', + 'build/precompiled_net.h', + 'base/run_all_unittests.cc', + ]), + MSVSFilter('tests', [ + MSVSFilter('disk_cache', [ + 'disk_cache/addr_unittest.cc', + 'disk_cache/backend_unittest.cc', + 'disk_cache/block_files_unittest.cc', + 'disk_cache/disk_cache_test_base.cc', + 'disk_cache/disk_cache_test_base.h', + 'disk_cache/disk_cache_test_util.cc', + 'disk_cache/disk_cache_test_util.h', + 'disk_cache/entry_unittest.cc', + 'disk_cache/mapped_file_unittest.cc', + 'disk_cache/storage_block_unittest.cc', + ]), + MSVSFilter('http', [ + 'http/http_auth_cache_unittest.cc', + 'http/http_auth_handler_basic_unittest.cc', + 'http/http_auth_handler_digest_unittest.cc', + 'http/http_auth_unittest.cc', + 'http/http_cache_unittest.cc', + 'http/http_chunked_decoder_unittest.cc', + 'http/http_network_layer_unittest.cc', + 'http/http_network_transaction_unittest.cc', + 'http/http_response_headers_unittest.cc', + 'http/http_transaction_unittest.cc', + 'http/http_transaction_unittest.h', + 'http/http_transaction_winhttp_unittest.cc', + 'http/http_util_unittest.cc', + 'http/http_vary_data_unittest.cc', + 'http/winhttp_request_throttle_unittest.cc', + ]), + MSVSFilter('base', [ 'base/auth_cache_unittest.cc', 'base/base64_unittest.cc', 'base/bzip2_filter_unittest.cc', @@ -49,83 +88,157 @@ input_files = [ 'base/gzip_filter_unittest.cc', 'base/host_resolver_unittest.cc', 'base/listen_socket_unittest.cc', + 'base/listen_socket_unittest.h', 'base/mime_sniffer_unittest.cc', 'base/mime_util_unittest.cc', 'base/net_util_unittest.cc', 'base/registry_controlled_domain_unittest.cc', - 'base/run_all_unittests.cc', - 'base/ssl_test_util.cc', + 'base/sdch_filter_unittest.cc', 'base/ssl_client_socket_unittest.cc', + 'base/ssl_config_service_unittest.cc', 'base/tcp_client_socket_unittest.cc', 'base/telnet_server_unittest.cc', 'base/test_completion_callback_unittest.cc', + 'base/wininet_util_unittest.cc', 'base/x509_certificate_unittest.cc', - 'disk_cache/addr_unittest.cc', - 'disk_cache/backend_unittest.cc', - 'disk_cache/block_files_unittest.cc', - 'disk_cache/disk_cache_test_base.cc', - 'disk_cache/disk_cache_test_util.cc', - 'disk_cache/entry_unittest.cc', - 'disk_cache/mapped_file_unittest.cc', - 'disk_cache/storage_block_unittest.cc', - 'http/http_auth_cache_unittest.cc', - 'http/http_auth_handler_basic_unittest.cc', - 'http/http_auth_handler_digest_unittest.cc', - 'http/http_auth_unittest.cc', - 'http/http_cache_unittest.cc', - 'http/http_chunked_decoder_unittest.cc', - 'http/http_network_layer_unittest.cc', - 'http/http_network_transaction_unittest.cc', - 'http/http_response_headers_unittest.cc', - 'http/http_transaction_unittest.cc', - 'http/http_util_unittest.cc', - 'http/http_vary_data_unittest.cc', + ]), + MSVSFilter('url_request', [ + 'url_request/url_request_unittest.cc', + 'url_request/url_request_unittest.h', + ]), + MSVSFilter('proxy', [ 'proxy/proxy_script_fetcher_unittest.cc', 'proxy/proxy_service_unittest.cc', - 'url_request/url_request_unittest.cc', -] + ]), + ]), +]) -if env.Bit('windows'): - input_files.extend([ +if not env.Bit('windows'): + input_files.Remove( 'base/wininet_util_unittest.cc', + 'build/precompiled_net$OBJSUFFIX', 'http/http_transaction_winhttp_unittest.cc', 'http/winhttp_request_throttle_unittest.cc', - ]) + ) if env.Bit('linux'): # TODO(port): - to_be_ported_files = [ + input_files.Remove( 'base/sdch_filter_unittest.cc', 'base/ssl_config_service_unittest.cc', - ] - input_files = list(set(input_files) - set(to_be_ported_files)) + ) if env.Bit('mac'): - input_files.extend([ + input_files.Extend([ '../base/platform_test_mac$OBJSUFFIX', ]) # TODO(port): - to_be_ported_files = [ + input_files.Remove( 'base/x509_certificate_unittest.cc', 'base/sdch_filter_unittest.cc', 'base/ssl_config_service_unittest.cc', 'url_request/url_request_unittest.cc', - ] - input_files = list(set(input_files) - set(to_be_ported_files)) - -env.ChromeTestProgram('net_unittests', input_files) - -env.ChromeMSVSProject('$NET_DIR/build/net_unittests.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$BZIP2_DIR/bzip2.vcproj', - '$NET_DIR/build/net.vcproj', - '$MODP_B64_DIR/modp_b64.vcproj', - '$ZLIB_DIR/zlib.vcproj', - '$ICU38_DIR/build/icu.vcproj', - '$TESTING_DIR/gtest.vcproj', - '$GOOGLEURL_DIR/build/googleurl.vcproj', - '$SDCH_DIR/sdch.vcproj', - ], - guid='{E99DA267-BE90-4F45-88A1-6919DB2C7567}') + ) + +net_unittests = env.ChromeTestProgram('net_unittests', input_files) + +p = env.ChromeMSVSProject('$NET_DIR/build/net_unittests.vcproj', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$BZIP2_DIR/bzip2.vcproj', + '$NET_DIR/build/net.vcproj', + '$MODP_B64_DIR/modp_b64.vcproj', + '$ZLIB_DIR/zlib.vcproj', + '$ICU38_DIR/build/icu.vcproj', + '$TESTING_DIR/gtest.vcproj', + '$GOOGLEURL_DIR/build/googleurl.vcproj', + '$SDCH_DIR/sdch.vcproj', + ], + guid='{E99DA267-BE90-4F45-88A1-6919DB2C7567}', + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=net_unittests, + files=input_files, + ConfigurationType='1') + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + '$(SolutionDir)../testing/using_gtest.vsprops', + ], + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + MSVSTool('VCCLCompilerTool', + PrecompiledHeaderThrough='precompiled_net.h', + ForcedIncludeFiles='precompiled_net.h', + PreprocessorDefinitions='UNIT_TEST', + UsePrecompiledHeader='2'), + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + 'VCLinkerTool', + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + '$(SolutionDir)../testing/using_gtest.vsprops', + ], + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + MSVSTool('VCCLCompilerTool', + PreprocessorDefinitions='UNIT_TEST'), + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + 'VCLinkerTool', + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ]) + +# TODO: Remove when we can derive this information +p.AddFileConfig('build/precompiled_net.cc', + 'Debug|Win32', + tools=[ + MSVSTool('VCCLCompilerTool', + UsePrecompiledHeader='1'), + ]) + +# TODO: Remove when we can derive this information +p.AddFileConfig('build/precompiled_net.cc', + 'Release|Win32', + ExcludedFromBuild='true', + tools=[ + 'VCCLCompilerTool', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/net_unittests.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/stress_cache.scons b/net/stress_cache.scons index 008683d..9f926e4 100644 --- a/net/stress_cache.scons +++ b/net/stress_cache.scons @@ -36,19 +36,64 @@ if env.Bit('windows'): ], ) -input_files = [ +input_files = ChromeFileList([ 'disk_cache/disk_cache_test_util$OBJSUFFIX', 'disk_cache/stress_cache.cc', -] +]) if not env.Bit('mac'): env.ChromeTestProgram('stress_cache', input_files) -env.ChromeMSVSProject('$NET_DIR/build/stress_cache.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$NET_DIR/build/net.vcproj', - '$ICU38_DIR/build/icu.vcproj', - '$TESTING_DIR/gtest.vcproj', - ], - guid='{B491C3A1-DE5F-4843-A1BB-AB8C4337187B}') +p = env.ChromeMSVSProject('$NET_DIR/build/stress_cache.vcproj', + guid='{B491C3A1-DE5F-4843-A1BB-AB8C4337187B}', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$NET_DIR/build/net.vcproj', + '$ICU38_DIR/build/icu.vcproj', + '$TESTING_DIR/gtest.vcproj', + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=TODO, + files=input_files, + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + 'VCCLCompilerTool', + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + MSVSTool('VCLinkerTool', + SubSystem='1'), + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ], + ConfigurationType='1') + + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/stress_cache.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/net/tools/tld_cleanup/tld_cleanup.scons b/net/tools/tld_cleanup/tld_cleanup.scons index cd937ca..5f366c4 100644 --- a/net/tools/tld_cleanup/tld_cleanup.scons +++ b/net/tools/tld_cleanup/tld_cleanup.scons @@ -23,16 +23,61 @@ if env.Bit('windows'): ], ) -input_files = [ +input_files = ChromeFileList([ 'tld_cleanup.cc', -] +]) env.ChromeProgram('tld_cleanup', input_files) -env.ChromeMSVSProject('$NET_DIR/build/tld_cleanup.vcproj', - dependencies = [ - '$BASE_DIR/build/base.vcproj', - '$ICU38_DIR/build/icu.vcproj', - '$GOOGLEURL_DIR/build/googleurl.vcproj', - ], - guid='{E13045CD-7E1F-4A41-9B18-8D288B2E7B41}') +p = env.ChromeMSVSProject('$NET_DIR/build/tld_cleanup.vcproj', + guid='{E13045CD-7E1F-4A41-9B18-8D288B2E7B41}', + dependencies = [ + '$BASE_DIR/build/base.vcproj', + '$ICU38_DIR/build/icu.vcproj', + '$GOOGLEURL_DIR/build/googleurl.vcproj', + ], + # TODO: restore when we can derive all info, + # on all platforms, from the windows build targets. + #buildtargets=TODO, + files=input_files, + tools=[ + 'VCPreBuildEventTool', + 'VCCustomBuildTool', + 'VCXMLDataGeneratorTool', + 'VCWebServiceProxyGeneratorTool', + 'VCMIDLTool', + 'VCCLCompilerTool', + 'VCManagedResourceCompilerTool', + 'VCResourceCompilerTool', + 'VCPreLinkEventTool', + MSVSTool('VCLinkerTool', + SubSystem='1'), + 'VCALinkTool', + 'VCManifestTool', + 'VCXDCMakeTool', + 'VCBscMakeTool', + 'VCFxCopTool', + 'VCAppVerifierTool', + 'VCWebDeploymentTool', + 'VCPostBuildEventTool', + ], + ConfigurationType='1') + + +p.AddConfig('Debug|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/debug.vsprops', + ]) + +p.AddConfig('Release|Win32', + InheritedPropertySheets=[ + '$(SolutionDir)../build/common.vsprops', + '$(SolutionDir)../build/release.vsprops', + ]) + +env.AlwaysBuild(p) + +i = env.Command('$CHROME_SRC_DIR/net/build/tld_cleanup.vcproj', p, + Copy('$TARGET', '$SOURCE')) +Alias('msvs', i) diff --git a/site_scons/site_tools/_Node_MSVS.py b/site_scons/site_tools/_Node_MSVS.py index d394d28..b421de2 100644 --- a/site_scons/site_tools/_Node_MSVS.py +++ b/site_scons/site_tools/_Node_MSVS.py @@ -39,6 +39,8 @@ import xml.dom.minidom import SCons.Node.FS import SCons.Script +from SCons.Debug import Trace +TODO = 0 # Initialize random number generator random.seed() @@ -264,7 +266,7 @@ def MSVSFolder(env, item, *args, **kw): class MSVSConfig(object): """Visual Studio configuration.""" - def __init__(self, Name, config_type, tools=[], **attrs): + def __init__(self, Name, config_type, tools=None, **attrs): """Initializes the configuration. Args: @@ -278,21 +280,12 @@ class MSVSConfig(object): ips = ';'.join(ips) attrs['InheritedPropertySheets'] = ips.replace('/', '\\') - tools = tools or [] - if not SCons.Util.is_List(tools): - tools = [tools] - tool_objects = [] - for t in tools: - if not isinstance(t, MSVSTool): - t = MSVSTool(t) - tool_objects.append(t) - self.Name = Name self.config_type = config_type - self.tools = tool_objects + self.tools = tools self.attrs = attrs - def CreateElement(self, doc): + def CreateElement(self, doc, project): """Creates an element for the configuration. Args: @@ -305,8 +298,20 @@ class MSVSConfig(object): node.setAttribute('Name', self.Name) for k, v in self.attrs.items(): node.setAttribute(k, v) - for t in self.tools: + + tools = self.tools + if tools is None: + tools = project.tools or [] + if not SCons.Util.is_List(tools): + tools = [tools] + tool_objects = [] + for t in tools: + if not isinstance(t, MSVSTool): + t = MSVSTool(t) + tool_objects.append(t) + for t in tool_objects: node.appendChild(t.CreateElement(doc)) + return node @@ -398,6 +403,17 @@ class MSVSTool(object): node.setAttribute(k, v) return node + def _format(self): + """Formats a tool specification for debug printing""" + xml_impl = xml.dom.getDOMImplementation() + doc = xml_impl.createDocument(None, 'VisualStudioProject', None) + return self.CreateElement(doc).toprettyxml() + + def diff(self, other): + for key, value in self.attrs.items(): + if other.attrs[key] == value: + del self.attrs[key] + class MSVSToolFile(object): """Visual Studio tool file specification.""" @@ -429,6 +445,7 @@ class _MSVSProject(SCons.Node.FS.File): """Visual Studio project.""" entry_type_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}' + initialized = False def initialize(self, env, path, name = None, dependencies = None, @@ -438,7 +455,8 @@ class _MSVSProject(SCons.Node.FS.File): root_namespace = None, relative_path_prefix = '', tools = None, - configurations = None): + configurations = None, + **attrs): """Initializes the project. Args: @@ -464,32 +482,51 @@ class _MSVSProject(SCons.Node.FS.File): configurations: A list of MSVSConfig objects representing configurations built by this project. """ - self.msvs_path = path - self.msvs_node = env.File(path) if name is None: if buildtargets: name = os.path.splitext(buildtargets[0].name)[0] else: name = os.path.splitext(os.path.basename(path))[0] - self.msvs_name = name - self.root_namespace = root_namespace or self.msvs_name - self.buildtargets = buildtargets - self.relative_path_prefix = relative_path_prefix - self.tools = tools + if not root_namespace: + root_namespace or name + + if self.initialized: + # TODO(sgk): fill in + if self.msvs_name != name: + pass + if self.root_namespace != root_namespace: + pass + if self.relative_path_prefix != relative_path_prefix: + pass + if self.guid != guid: + pass + #if self.env != env: + # pass + else: + self.buildtargets = [] + self.configurations = [] + self.dependencies = [] + self.file_configurations = {} + self.files = MSVSFiles([]) + self.tool_files = [] + self.file_lists = [] + self.initialized = True + self.attrs = attrs self.env = env self.guid = guid + self.msvs_name = name + self.msvs_path = path + self.relative_path_prefix = relative_path_prefix + self.root_namespace = root_namespace or self.msvs_name + self.tools = tools - self.dependencies = list(dependencies or []) - self.configurations = list(configurations or []) - self.file_configurations = {} - self.tool_files = [] - - if not isinstance(files, MSVSFiles): - files = MSVSFiles(self.args2nodes(files)) - self.files = files + self.buildtargets.extend(buildtargets) + self.configurations.extend(configurations or []) + self.dependencies.extend(list(dependencies or [])) + self.AddFiles(files) - env.Command(self, [], MSVSSolutionAction) + env.Command(self, [], MSVSProjectAction) def args2nodes(self, entries): result = [] @@ -505,7 +542,7 @@ class _MSVSProject(SCons.Node.FS.File): elif hasattr(entry, 'sources') and entry.sources: result.extend(entry.sources) else: - result.append(entry) + result.append(entry.srcnode()) return result def FindFile(self, node): @@ -523,9 +560,11 @@ class _MSVSProject(SCons.Node.FS.File): file_list.extend(f.entries) else: flat_file_dict[f] = True + flat_file_dict[f.srcnode()] = True if hasattr(f, 'sources'): for s in f.sources: flat_file_dict[s] = True + flat_file_dict[s.srcnode()] = True self.flat_file_dict = flat_file_dict return flat_file_dict.get(node) @@ -555,7 +594,7 @@ class _MSVSProject(SCons.Node.FS.File): return sln.rel_path(self).replace('/', '\\') def get_rel_path(self, node): - result = self.relative_path_prefix + self.msvs_node.rel_path(node) + result = self.relative_path_prefix + self.rel_path(node) return result.replace('/', '\\') def AddConfig(self, Name, tools=None, **attrs): @@ -570,6 +609,16 @@ class _MSVSProject(SCons.Node.FS.File): # No tool list specifically for this configuration, # use the Project's as a default. tools = self.tools + if not attrs.has_key('ConfigurationType'): + # No ConfigurationType specifically for this configuration, + # use the Project's as a default. + try: + attrs['ConfigurationType'] = self.attrs['ConfigurationType'] + except KeyError: + pass + if attrs.has_key('InheritedPropertySheets'): + ips = attrs['InheritedPropertySheets'] + attrs['InheritedPropertySheets'] = self.env.subst(ips) c = MSVSConfig(Name, 'Configuration', tools=tools, **attrs) self.configurations.append(c) @@ -583,9 +632,35 @@ class _MSVSProject(SCons.Node.FS.File): later add files to a Filter object which was passed into a previous call to AddFiles(), it will not be reflected in this project. """ - # TODO(rspangler) This also doesn't handle adding files to an existing - # filter. That is, it doesn't merge the trees. - self.files.extend(self.args2nodes(files)) + self.file_lists.append(self.args2nodes(files)) + + def _FilesToSourceFiles(self, files): + file_list = files[:] + result = [] + while file_list: + entry = file_list.pop(0) + if not isinstance(entry, (list, UserList.UserList)): + entry = [entry] + for f in entry: + if hasattr(f, 'entries'): + self._FilesToSourceFiles(f.entries) + result.append(f) + else: + if f.sources: + flist = f.sources + else: + flist = [f] + for x in flist: + result.append(x.srcnode()) + files[:] = result + + def _MergeFiles(self, dest_list, src_list): + for f in src_list: + if f not in dest_list: + dest_list.append(f) + continue + #if hasattr(f, 'entries'): + # self._FilesToSourceFiles(f.entries) def AddFileConfig(self, path, Name, tools=None, **attrs): """Adds a configuration to a file. @@ -599,9 +674,8 @@ class _MSVSProject(SCons.Node.FS.File): Raises: ValueError: Relative path does not match any file added via AddFiles(). """ + # Store as the VariantDir node, not as the source node. node = self.env.File(path) - if not self.FindFile(node): - raise ValueError('AddFileConfig: file "%s" not in project' % path) c = MSVSConfig(Name, 'FileConfiguration', tools=tools, **attrs) config_list = self.file_configurations.get(node) if config_list is None: @@ -655,7 +729,7 @@ class _MSVSProject(SCons.Node.FS.File): configs = self.doc.createElement('Configurations') root.appendChild(configs) for c in self.configurations: - configs.appendChild(c.CreateElement(self.doc)) + configs.appendChild(c.CreateElement(self.doc, self)) # Add empty References section root.appendChild(self.doc.createElement('References')) @@ -681,10 +755,194 @@ class _MSVSProject(SCons.Node.FS.File): node = self.doc.createElement('File') node.setAttribute('RelativePath', self.get_rel_path(file)) for c in self.file_configurations.get(file, []): - node.appendChild(c.CreateElement(self.doc)) + node.appendChild(c.CreateElement(self.doc, self)) return node - def _AddFileConfigurationDifferences(self, target, source, base_env, file_env): + def VCCLCompilerTool(self, args): + default_attrs = { + 'BufferSecurityCheck' : "false", + 'CompileAs' : 0, # default + 'DebugInformationFormat' : 0, # TODO(???) + 'DisableSpecificWarnings' : [], + 'EnableFiberSafeOptimizations' : "false", + 'EnableFunctionLevelLinking' : "false", + 'EnableIntrinsicFunctions' : "false", + 'FavorSizeOrSpeed' : 0, # favorNone + 'InlineFunctionExpansion' : 1, # expandDisable + 'MinimalRebuild' : "false", + 'OmitFramePointers' : "false", + 'Optimization' : 1, # optimizeDisabled TODO(???) + 'PreprocessorDefinitions' : [], + 'RuntimeLibrary' : TODO, + 'RuntimeTypeInfo' : "false", + 'StringPooling' : "false", + 'SuppressStartupBanner' : "false", + 'WarningAsError' : "false", + 'WarningLevel' : 1, # warningLevel_1 + 'WholeProgramOptimization' : "false", + } + + tool = MSVSTool('VCCLCompilerTool', **default_attrs) + attrs = tool.attrs + + for arg in args: + if arg in ('/c',): + continue + if arg.startswith('/Fo'): + continue + if arg.startswith('/D'): + attrs['PreprocessorDefinitions'].append(arg[2:]) + elif arg == '/EH': + attrs['ExceptionHandling'] = 0 + elif arg == '/GF': + attrs['StringPooling'] = "true" + elif arg == '/GL': + attrs['WholeProgramOptimization'] = "true" + elif arg == '/GM': + attrs['MinimalRebuild'] = "true" + elif arg == '/GR-': + attrs['RuntimeTypeInfo'] = "true" + elif arg == '/Gs': + attrs['BufferSecurityCheck'] = "true" + elif arg == '/Gs-': + attrs['BufferSecurityCheck'] = "false" + elif arg == '/GT': + attrs['EnableFiberSafeOptimizations'] = "true" + elif arg == '/Gy': + attrs['EnableFunctionLevelLinking'] = "true" + elif arg == '/MD': + attrs['RuntimeLibrary'] = 1 # rtMultiThreadedDebug + elif arg == '/MDd': + attrs['RuntimeLibrary'] = 2 # rtMultiThreadedDebugDLL + elif arg == '/MT': + attrs['RuntimeLibrary'] = 0 # rtMultiThreaded + elif arg == '/MTd': + attrs['RuntimeLibrary'] = 3 # rtMultiThreadedDLL + elif arg == '/nologo': + attrs['SuppressStartupBanner'] = "true" + elif arg == '/O1': + attrs['InlineFunctionExpansion'] = 4 # optimizeMinSpace + elif arg == '/O2': + attrs['InlineFunctionExpansion'] = 3 # optimizeMaxSpeed + elif arg == '/Ob1': + attrs['InlineFunctionExpansion'] = 2 # expandOnlyInline + elif arg == '/Ob2': + attrs['InlineFunctionExpansion'] = 0 # expandAnySuitable + elif arg == '/Od': + attrs['Optimization'] = 0 + elif arg == '/Oi': + attrs['EnableIntrinsicFunctions'] = "true" + elif arg == '/Os': + attrs['FavorSizeOrSpeed'] = 1 # favorSize + elif arg == '/Ot': + attrs['FavorSizeOrSpeed'] = 2 # favorSpeed + elif arg == '/Ox': + attrs['Optimization'] = 2 # optimizeFull + elif arg == '/Oy': + attrs['OmitFramePointers'] = "true" + elif arg == '/Oy-': + attrs['TODO'] = "true" + elif arg in ('/Tc', '/TC'): + attrs['CompileAs'] = 1 # compileAsC + elif arg in ('/Tp', '/TP'): + attrs['CompileAs'] = 2 # compileAsCPlusPlus + elif arg == '/WX': + attrs['WarnAsError'] = "true" + elif arg.startswith('/W'): + attrs['WarningLevel'] = int(arg[2:]) # 0 through 4 + elif arg.startswith('/wd'): + attrs['DisableSpecificWarnings'].append(str(arg[3:])) + elif arg == '/Z7': + attrs['DebugInformationFormat'] = 3 # debugOldSytleInfo TODO(???) + elif arg == '/Zd': + attrs['DebugInformationFormat'] = 0 # debugDisabled + elif arg == '/Zi': + attrs['DebugInformationFormat'] = 2 # debugEnabled TODO(???) + elif arg == '/ZI': + attrs['DebugInformationFormat'] = 1 # debugEditAndContinue TODO(???) + + cppdefines = attrs['PreprocessorDefinitions'] + if cppdefines: + attrs['PreprocessorDefinitions'] = ';'.join(cppdefines) + warnings = attrs['DisableSpecificWarnings'] + if warnings: + warnings = SCons.Util.uniquer(warnings) + attrs['DisableSpecificWarnings'] = ';'.join(warnings) + + return tool + + def VCLibrarianTool(self, args): + default_attrs = { + 'LinkTimeCodeGeneration' : "false", + 'SuppressStartupBanner' : "false", + } + + tool = MSVSTool('VCLibrarianTool', **default_attrs) + attrs = tool.attrs + + for arg in args: + if arg.startswith('/OUT'): + continue + if arg == '/ltcg': + attrs['LinkTimeCodeGeneration'] = "true" + elif arg == '/nologo': + attrs['SuppressStartupBanner'] = "true" + + return tool + + def VCLinkerTool(self, args): + default_attrs = { + 'LinkIncremental' : "false", + 'LinkTimeCodeGeneration' : "false", + 'EnableCOMDATFolding' : TODO, + 'OptimizeForWindows98' : TODO, + 'OptimizeReferences' : TODO, + 'Profile' : "false", + 'SuppressStartupBanner' : "false", + } + + tool = MSVSTool('VCLinkerTool', **default_attrs) + attrs = tool.attrs + + for arg in args: + if arg == '': + continue + if arg == '/INCREMENTAL': + attrs['LinkIncremental'] = "true" + elif arg == '/INCREMENTAL:NO': + attrs['LinkIncremental'] = "false" + elif arg == '/LTCG': + attrs['LinkTimeCodeGeneration'] = "true" + elif arg == '/nologo': + attrs['SuppressStartupBanner'] = "true" + elif arg == '/OPT:NOICF': + attrs['EnableCOMDATFolding'] = 2 # + elif arg == '/OPT:NOWIN98': + attrs['OptimizeForWindows98'] = 1 # + elif arg == '/OPT:REF': + attrs['OptimizeReferences'] = 2 # + elif arg == '/PROFILE': + attrs['Profile'] = "true" + + return tool + + command_to_tool_map = { + 'cl' : 'VCCLCompilerTool', + 'cl.exe' : 'VCCLCompilerTool', + 'lib' : 'VCLibrarianTool', + 'lib.exe' : 'VCLibrarianTool', + 'link' : 'VCLinkerTool', + 'link.exe' : 'VCLinkerTool', + } + + def cl_to_tool(self, args): + command = os.path.basename(args[0]) + method_name = self.command_to_tool_map.get(command) + if not method_name: + return None + return getattr(self, method_name)(args[1:]) + + def _AddFileConfigurationDifferences(self, target, source, base_env, file_env, name): """Adds a per-file configuration. Args: @@ -696,7 +954,18 @@ class _MSVSProject(SCons.Node.FS.File): file_env: The construction environment for the target, containing the per-target settings. """ - pass + executor = target.get_executor() + base_cl = map(str, base_env.subst_list(executor)[0]) + file_cl = map(str, file_env.subst_list(executor)[0]) + if base_cl == file_cl: + return + + base_tool = self.cl_to_tool(base_cl) + file_tool = self.cl_to_tool(file_cl) + + file_tool.diff(base_tool) + + self.AddFileConfig(source, name, tools=[file_tool]) def _AddFileConfigurations(self, env): """Adds per-file configurations for the buildtarget's sources. @@ -707,25 +976,53 @@ class _MSVSProject(SCons.Node.FS.File): if not self.buildtargets: return - bt = self.buildtargets[0] - additional_files = [] - for t in bt.sources: + for bt in self.buildtargets: + executor = bt.get_executor() + build_env = bt.get_build_env() + bt_cl = map(str, build_env.subst_list(executor)[0]) + tool = self.cl_to_tool(bt_cl) + default_tool = self.cl_to_tool([bt_cl[0]]) + if default_tool: + tool.diff(default_tool) + else: + print "no tool for %r" % bt_cl[0] + for t in bt.sources: e = t.get_build_env() + additional_files = SCons.Util.UniqueList() for s in t.sources: - s = env.arg2nodes([s])[0] + s = env.arg2nodes([s])[0].srcnode() if not self.FindFile(s): additional_files.append(s) - if not env is e: - self._AddFileConfigurationDifferences(t, s, env, e) - self.AddFiles(additional_files) + if not build_env is e: + # TODO(sgk): This test may be bogus, but it works for now. + # We're trying to figure out if the file configuration + # differences need to be added one per build target, or one + # per configuration for the entire project. The assumption + # is that if the number of buildtargets configured matches + # the number of project configurations, that we use those + # in preference to the project configurations. + if len(self.buildtargets) == len(self.configurations): + self._AddFileConfigurationDifferences(t, s, build_env, e, e.subst('$MSVSCONFIGURATIONNAME')) + else: + for config in self.configurations: + self._AddFileConfigurationDifferences(t, s, build_env, e, config.Name) + self._MergeFiles(self.files, additional_files) def Write(self, env): """Writes the project file.""" + for flist in self.file_lists: + self._FilesToSourceFiles(flist) + self._MergeFiles(self.files, flist) + for k, v in self.file_configurations.items(): + self.file_configurations[str(k)] = v + k = self.env.File(k).srcnode() + self.file_configurations[k] = v + self.file_configurations[str(k)] = v self._AddFileConfigurations(env) self.Create() - f = open(str(self.msvs_node), 'wt') + f = open(str(self), 'wt') f.write(self.formatMSVSProjectXML(self.doc)) f.close() @@ -789,6 +1086,11 @@ class _MSVSProject(SCons.Node.FS.File): 'Tool' : [ 'Name', 'DisableSpecificWarnings', + + 'PreprocessorDefinitions', + 'UsePrecompiledHeader', + 'PrecompiledHeaderThrough', + 'ForcedIncludeFiles', ], 'VisualStudioProject' : [ 'ProjectType', @@ -1062,6 +1364,7 @@ def MSVSSolution(env, item, *args, **kw): import __builtin__ +__builtin__.MSVSConfig = MSVSConfig __builtin__.MSVSFilter = MSVSFilter __builtin__.MSVSProject = MSVSProject __builtin__.MSVSSolution = MSVSSolution diff --git a/site_scons/site_tools/chromium_builders.py b/site_scons/site_tools/chromium_builders.py index 6088203..7ee8928 100644 --- a/site_scons/site_tools/chromium_builders.py +++ b/site_scons/site_tools/chromium_builders.py @@ -53,10 +53,12 @@ __builtin__.ChromeFileList = ChromeFileList def compilable_files(sources): if not hasattr(sources, 'entries'): - return [x for x in sources if not str(x).endswith('.h')] + return [x for x in sources if not str(x).endswith('.h') + and not str(x).endswith('.dat')] result = [] for top, folders, nonfolders in MSVS.FileListWalk(sources): - result.extend([x for x in nonfolders if not str(x).endswith('.h')]) + result.extend([x for x in nonfolders if not str(x).endswith('.h') + and not str(x).endswith('.dat')]) return result def ChromeProgram(env, target, source, *args, **kw): |