Changeset 239813 in webkit
- Timestamp:
- Jan 9, 2019 6:20:13 PM (5 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r239792 r239813 1 2019-01-09 Carlos Eduardo Ramalho <cadubentzen@gmail.com> and Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Use directory local sequential numbers for Unified Sources filenames instead of global sequential numbers for CMake 4 https://bugs.webkit.org/show_bug.cgi?id=192391 5 6 Reviewed by Don Olmstead. 7 8 Unified Source Builds are using global sequential numbers for 9 bundle filenames UnifiedSource{sequential-number}.cpp. As the 10 result, every new source file added would shift the next ones and 11 prevent compiler caches from speeding up consecutive builds e.g. 12 in git-bisect sessions. 13 14 Changed it to directory local sequential numbers, 15 UnifiedSource-{hash-of-dir-name}-{sequential-number-within-the-dir}.cpp. 16 17 This is affecting only CMake builds which is where no 18 '--max-cpp-bundle-count' nor '--max-obj-c-bundle-count' options 19 are set. Xcode builds still use the old convention. 20 21 * Scripts/generate-unified-source-bundles.rb: Add new instance 22 variables @currentDirectory and @extraFiles to BundleManager. 23 Still use global sequential numbers if --max-cpp-bundle-count or 24 --max-obj-c-bundle-count is given. 25 1 26 2019-01-09 Alex Christensen <achristensen@webkit.org> 2 27 -
trunk/Source/WTF/Scripts/generate-unified-source-bundles.rb
r239561 r239813 22 22 # THE POSSIBILITY OF SUCH DAMAGE. 23 23 24 require 'digest' 24 25 require 'fileutils' 25 26 require 'pathname' … … 53 54 puts 54 55 puts "Generation options:" 55 puts "--max-cpp-bundle-count Sets the limit on the number of cpp bundles that can be generated"56 puts "--max-obj-c-bundle-count Sets the limit on the number of Obj-C bundles that can be generated"56 puts "--max-cpp-bundle-count Use global sequential numbers for cpp bundle filenames and set the limit on the number" 57 puts "--max-obj-c-bundle-count Use global sequential numbers for Obj-C bundle filenames and set the limit on the number" 57 58 exit 1 58 59 end … … 184 185 185 186 class BundleManager 186 attr_reader :bundleCount, :extension, :fileCount, :currentBundleText, :maxCount 187 attr_reader :bundleCount, :extension, :fileCount, :currentBundleText, :maxCount, :extraFiles 187 188 188 189 def initialize(extension, max) … … 192 193 @currentBundleText = "" 193 194 @maxCount = max 195 @extraFiles = [] 196 @currentDirectory = nil 194 197 end 195 198 … … 206 209 end 207 210 208 def bundleFileName(number) 209 @extension == "cpp" ? "UnifiedSource#{number}.#{extension}" : "UnifiedSource#{number}-#{extension}.#{extension}" 211 def bundleFileName() 212 id = 213 if @maxCount 214 @bundleCount.to_s 215 else 216 # The dash makes the filenames more clear when using a hash. 217 hash = Digest::SHA1.hexdigest(@currentDirectory.to_s)[0..7] 218 "-#{hash}-#{@bundleCount}" 219 end 220 @extension == "cpp" ? "UnifiedSource#{id}.#{extension}" : "UnifiedSource#{id}-#{extension}.#{extension}" 210 221 end 211 222 212 223 def flush 213 # No point in writing an empty bundle file214 return if @currentBundleText == ""215 216 224 @bundleCount += 1 217 bundleFile = bundleFileName (@bundleCount)225 bundleFile = bundleFileName 218 226 $generatedSources << $unifiedSourceOutputPath + bundleFile 227 @extraFiles << bundleFile if @maxCount and @bundleCount > @maxCount 219 228 220 229 writeFile(bundleFile, @currentBundleText) … … 225 234 def flushToMax 226 235 raise if !@maxCount 227 ((@bundleCount+1)..@maxCount).each { 228 | index | 229 writeFile(bundleFileName(index), "") 230 } 236 while @bundleCount < @maxCount 237 flush 238 end 231 239 end 232 240 … … 234 242 path = sourceFile.path 235 243 raise "wrong extension: #{path.extname} expected #{@extension}" unless path.extname == ".#{@extension}" 244 if (TopLevelDirectoryForPath(@currentDirectory) != TopLevelDirectoryForPath(path.dirname)) 245 log("Flushing because new top level directory; old: #{@currentDirectory}, new: #{path.dirname}") 246 flush 247 @currentDirectory = path.dirname 248 @bundleCount = 0 unless @maxCount 249 end 236 250 if @fileCount == MAX_BUNDLE_SIZE 237 251 log("Flushing because new bundle is full (#{@fileCount} sources)") … … 256 270 path = sourceFile.path 257 271 $inputSources << sourceFile.to_s 258 if (TopLevelDirectoryForPath($currentDirectory) != TopLevelDirectoryForPath(path.dirname))259 log("Flushing because new top level directory; old: #{$currentDirectory}, new: #{path.dirname}")260 $bundleManagers.each_value { |x| x.flush }261 $currentDirectory = path.dirname262 end263 272 264 273 bundle = $bundleManagers[path.extname] … … 343 352 344 353 manager.flushToMax 345 bundleCount = manager.bundleCount 346 extension = manager.extension 347 if bundleCount > maxCount 348 filesToAdd = ((maxCount+1)..bundleCount).map { |x| manager.bundleFileName(x) }.join(", ") 354 355 unless manager.extraFiles.empty? 356 extension = manager.extension 357 bundleCount = manager.bundleCount 358 filesToAdd = manager.extraFiles.join(", ") 349 359 raise "number of bundles for #{extension} sources, #{bundleCount}, exceeded limit, #{maxCount}. Please add #{filesToAdd} to Xcode then update UnifiedSource#{extension.capitalize}FileCount" 350 360 end
Note: See TracChangeset
for help on using the changeset viewer.