Skip to content

Commit

Permalink
[filter-build-webkit] Show target names in colored output
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=256052

Reviewed by Alexey Proskuryakov.

It's helpful to see which target each line from filter-build-webkit
corresponds with, to see at a glance how far the build has
progressed. When filter-build-webkit is connected to a terminal, prefix
the target name using ANSI colors onto each output line.

The target string is colored based on a checksum of the target name and
project name. This makes the output lines visually distinguishable
(e.g., JavaScriptCore is always the same color), and helps keep the task
description readable.

We only use ANSI "basic" colors (the first 16, excluding black and
white). These colors are set by the user's terminal theme, so it's
unlikely that the script will pick a color that is unreadable.

When output is not colorized (i.e. when being read by scripts or run in
CI), the target name is omitted, to preserve readability of the existing
task description.

* Tools/Scripts/filter-build-webkit:
(main):
(printLine):

Canonical link: https://commits.webkit.org/263507@main
  • Loading branch information
emw-apple committed Apr 28, 2023
1 parent 944c48e commit 3cf2ce9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
5 changes: 1 addition & 4 deletions Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
Expand Up @@ -26,17 +26,14 @@
DEFINES_MODULE = YES;
MODULEMAP_FILE = $(SRCROOT)/JavaScriptCore.modulemap;

// Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols.
OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol,__ZdlPvS_ -Wl,-unexported_symbol,__ZNKSt3__14__fs10filesystem18directory_iteratordeEv -Wl,-unexported_symbol,__ZNKSt3__14__fs10filesystem18directory_iteratorptEv -Wl,-unexported_symbol,__ZNKSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEEclES3_S5_ -Wl,-unexported_symbol,__ZNKSt3__18functionIFvvEEclEv -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem14__is_separatorIcEENS_9enable_ifIXsr18__can_convert_charIT_EE5valueEbE4typeES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem18directory_iterator9incrementERNS_10error_codeE -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem18directory_iteratorppEv -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endB6v15000ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endB6v15004ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endB6v15006ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE13__range_beginB6v15004ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE13__range_beginB6v15006ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE13__range_beginERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endB6v15000EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endB6v15004EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endB6v15006EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endEPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginB6v15000EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginB6v15004EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginB6v15006EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginEPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE11__range_endES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE13__range_beginES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE15__first_or_nullES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__throw_filesystem_errorIJRPKcRKNS1_4pathERKNS_10error_codeEEEEvDpOT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__throw_filesystem_errorB6v15004IJRPKcRKNS1_4pathERKNS_10error_codeEEEEvDpOT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__throw_filesystem_errorB6v15006IJRPKcRKNS1_4pathERKNS_10error_codeEEEEvDpOT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem28recursive_directory_iteratorppEv -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem4path20__source_is_absoluteIcEEbT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem4path6appendIPKcEENS_9enable_ifIXsr13__is_pathableIT_EE5valueERS2_E4typeERKS7_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem4pathdVERKS2_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem6u8pathIPKcEENS_9enable_ifIXsr13__is_pathableIT_EE5valueENS1_4pathEE4typeERKS6_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeB6v15000IPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeB6v15004IPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeB6v15006IPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceB6v15000IA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceB6v15004IA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceB6v15006IA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceIA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceIPKcEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeB6v15000ERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeB6v15004ERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeB6v15006ERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceB6v15000INS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceB6v15004INS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceB6v15006INS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED2Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC1EOS2_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC2EOS2_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED2Ev -Wl,-unexported_symbol,__ZnwmPv -Wl,-unexported_symbol,__ZTISt9bad_alloc -Wl,-unexported_symbol,__ZTISt9exception -Wl,-unexported_symbol,__ZTSSt9bad_alloc -Wl,-unexported_symbol,__ZTSSt9exception -Wl,-unexported_symbol,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endB6v15007ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE13__range_beginB6v15007ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endB6v15007EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginB6v15007EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__throw_filesystem_errorB6v15007IJRPKcRKNS1_4pathERKNS_10error_codeEEEEvDpOT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeB6v15007ERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceB6v15007INS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeB6v15007IPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceB6v15007IA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE11__range_endB7v160000ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem20__is_pathable_stringINS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEvE13__range_beginB7v160000ERKS8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__throw_filesystem_errorB7v160000IJRPKcRKNS1_4pathERKNS_10error_codeEEEEvDpOT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE14__append_rangeB7v160000ERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKDuSC_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIDuE15__append_sourceB7v160000INS_12basic_stringIDuNS_11char_traitsIDuEENS_9allocatorIDuEEEEEEvRNS5_IcNS6_IcEENS8_IcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endB7v160000EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginB7v160000EPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeB7v160000IPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceB7v160000IA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_;

WK_ERROR_WHEN_LINKING_WITH_STATIC_INITIALIZERS = -Xlinker -no_inits;
WK_NO_STATIC_INITIALIZERS = $(WK_NO_STATIC_INITIALIZERS_$(CONFIGURATION)_$(WK_ANY_SANITIZER_ENABLED)_$(ENABLE_LLVM_PROFILE_GENERATION));
WK_NO_STATIC_INITIALIZERS_Release__ = $(WK_ERROR_WHEN_LINKING_WITH_STATIC_INITIALIZERS);
WK_NO_STATIC_INITIALIZERS_Release_NO_ = $(WK_ERROR_WHEN_LINKING_WITH_STATIC_INITIALIZERS);
WK_NO_STATIC_INITIALIZERS_Production__ = $(WK_ERROR_WHEN_LINKING_WITH_STATIC_INITIALIZERS);
WK_NO_STATIC_INITIALIZERS_Production_NO_ = $(WK_ERROR_WHEN_LINKING_WITH_STATIC_INITIALIZERS);

OTHER_LDFLAGS_BASE = $(OTHER_LDFLAGS_HIDE_SYMBOLS) -force_load $(WTF_ARCHIVE) -force_load $(BMALLOC_ARCHIVE) -load_hidden $(LIBPAS_ARCHIVE) $(SOURCE_VERSION_LDFLAGS) $(WK_NO_STATIC_INITIALIZERS);
OTHER_LDFLAGS_BASE = -unexported_symbols_list $(SRCROOT)/unexported-libc++.txt -force_load $(WTF_ARCHIVE) -force_load $(BMALLOC_ARCHIVE) -load_hidden $(LIBPAS_ARCHIVE) $(SOURCE_VERSION_LDFLAGS) $(WK_NO_STATIC_INITIALIZERS);
OTHER_LDFLAGS[sdk=embedded*] = $(inherited) $(OTHER_LDFLAGS_BASE);
OTHER_LDFLAGS[sdk=macosx*] = $(inherited) $(OTHER_LDFLAGS_BASE) -framework CoreServices $(PROFILE_GENERATE_OR_USE_LDFLAGS);

Expand Down
30 changes: 30 additions & 0 deletions Source/JavaScriptCore/unexported-libc++.txt
@@ -0,0 +1,30 @@
# This unexport list uses the Itanium mangling rules [1] to hide any symbols
# emitted from libc++ headers.
# [1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.type

# std:: namespace, with any valid combination of restrict (r), volatile (V), or const (K)
__ZSt*
__Z[KVr]St*
__ZK[Vr]St*
__ZKVrSt*

# nested std:: namespace, with the above qualifiers
__ZNSt*
__ZN[KVr]St*
__ZNK[Vr]St*
__ZNKVrSt*

# vtable for std::, with the above qualifiers
__ZTVSt*
__ZTV[KVr]St*
__ZTVK[Vr]St*
__ZTVKVrSt*

# typeinfo for std::
__ZT[IS]St*

# global operator new and new[]
__Zn[wa]*

# global operator delete and delete[]
__Zd[la]*

0 comments on commit 3cf2ce9

Please sign in to comment.