Skip to content

Commit

Permalink
Fix build with Ruby 3.2
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246743

Reviewed by Ross Kirsling.

File.exists has been declared deprecated since Ruby 2.1 (2013) and with Ruby 3.2 gets removed for good.

* Source/JavaScriptCore/offlineasm/config.rb:
* Source/JavaScriptCore/offlineasm/parser.rb:
* Source/WebInspectorUI/Scripts/update-LegacyInspectorBackendCommands.rb:

Canonical link: https://commits.webkit.org/257775@main
  • Loading branch information
DimStar77 authored and fujii committed Dec 13, 2022
1 parent 2ba3398 commit b7ac5d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/offlineasm/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR'];
headersFolderPath = ENV['WK_LIBRARY_HEADERS_FOLDER_PATH'];
if buildProductsDirectory and File.exists?(buildProductsDirectory)
if buildProductsDirectory and File.exist?(buildProductsDirectory)
$: << "#{buildProductsDirectory}#{headersFolderPath}/WebKitAdditions/Scripts"
end
sdkRootDirectory = ENV['SDKROOT'];
if sdkRootDirectory and File.exists?(sdkRootDirectory)
if sdkRootDirectory and File.exist?(sdkRootDirectory)
$: << "#{sdkRootDirectory}#{headersFolderPath}/WebKitAdditions/Scripts"
end

Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/offlineasm/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,10 @@ def parseSequence(final, comment)
additionsDirectoryName = "#{@buildProductsDirectory}#{@headersFolderPath}/WebKitAdditions/"
end
fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName
if not File.exists?(fileName)
if not File.exist?(fileName)
fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
end
fileExists = File.exists?(fileName)
fileExists = File.exist?(fileName)
raise "File not found: #{fileName}" if not fileExists and not isOptional
list << parse(fileName, @options, @sources) if fileExists
else
Expand Down Expand Up @@ -876,10 +876,10 @@ def parseIncludes(final, comment, options)
additionsDirectoryName = "#{@buildProductsDirectory}#{@headersFolderPath}/WebKitAdditions/"
end
fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName
if not File.exists?(fileName)
if not File.exist?(fileName)
fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
end
fileExists = File.exists?(fileName)
fileExists = File.exist?(fileName)
raise "File not found: #{fileName}" if not fileExists and not isOptional
if fileExists
parser = Parser.new(readTextFile(fileName), SourceFile.new(fileName), options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run
end

generated_path = File.join tmpdir, output_filename
if !File.exists?(generated_path)
if !File.exist?(generated_path)
puts "ERROR: Generated file does not exist at expected path."
exit 1
end
Expand Down

0 comments on commit b7ac5d0

Please sign in to comment.