1
1
#!/usr/bin/ruby
2
2
3
3
require 'fileutils'
4
- require 'tempfile'
5
4
require 'tmpdir'
6
5
7
6
if ARGV . size != 0
11
10
12
11
WEB_INSPECTOR_PATH = File . expand_path File . join ( File . dirname ( __FILE__ ) , ".." )
13
12
JAVASCRIPTCORE_PATH = File . expand_path File . join ( File . dirname ( __FILE__ ) , ".." , ".." , "JavaScriptCore" )
14
- WEBCORE_PATH = File . expand_path File . join ( File . dirname ( __FILE__ ) , ".." , ".." , "WebCore" )
15
-
16
- JAVASCRIPT_INSPECTOR_PROTOCOLS_PATH = File . join JAVASCRIPTCORE_PATH , "inspector" , "protocol"
17
- WEB_INSPECTOR_PROTOCOLS_PATH = File . join WEBCORE_PATH , "inspector" , "protocol"
18
13
19
14
$code_generator_path = File . join JAVASCRIPTCORE_PATH , "inspector" , "scripts" , "CodeGeneratorInspector.py"
20
- $inspector_json_generator_path = File . join JAVASCRIPTCORE_PATH , "inspector" , "scripts" , "generate-combined-inspector-json.py"
21
- $inspector_js_json_path = Tempfile . new ( "generated-InspectorJS.json" ) . path
22
- $inspector_web_json_path = Tempfile . new ( "generated-InspectorWeb.json" ) . path
23
15
$versions_directory_path = File . join WEB_INSPECTOR_PATH , "Versions"
24
- $web_inspector_user_interface_path = File . join WEB_INSPECTOR_PATH , "UserInterface"
25
- $web_inspector_protocol_path = File . join WEB_INSPECTOR_PATH , "UserInterface" , "Protocol"
16
+ $web_inspector_protocol_legacy_path = File . join WEB_INSPECTOR_PATH , "UserInterface" , "Protocol" , "Legacy"
26
17
27
18
class Task
28
- def initialize ( input_json_path , dependency_json_path , type , output_directory_path , verification )
19
+ def initialize ( input_json_path , dependency_json_path , type , output_directory_path )
29
20
@type = type
30
21
@input_json_path = input_json_path
31
22
@dependency_json_path = dependency_json_path
32
23
@output_directory_path = output_directory_path
33
- @verification = verification
34
24
end
35
25
36
26
def run
@@ -42,8 +32,7 @@ def run
42
32
43
33
Dir . mktmpdir do |tmpdir |
44
34
dependency = @dependency_json_path ? "'#{ @dependency_json_path } '" : ""
45
- cmd = "#{ $code_generator_path} '#{ @input_json_path } ' #{ dependency } --output_h_dir '#{ tmpdir } ' --output_cpp_dir '#{ tmpdir } ' --output_js_dir '#{ tmpdir } ' --write_always --output_type '#{ @type } '"
46
- cmd += " --no_verification" if !@verification
35
+ cmd = "#{ $code_generator_path} '#{ @input_json_path } ' #{ dependency } --no_verification --output_h_dir '#{ tmpdir } ' --output_cpp_dir '#{ tmpdir } ' --output_js_dir '#{ tmpdir } ' --write_always --output_type '#{ @type } '"
47
36
%x{ #{ cmd } }
48
37
if $?. exitstatus != 0
49
38
puts "ERROR: Error Code (#{ $?. exitstatus } ) Evaluating: #{ cmd } "
@@ -62,36 +51,15 @@ def run
62
51
end
63
52
end
64
53
65
- def generate_combined_inspector_json
66
- # InspectorJS.json
67
- output = %x{ #{ $inspector_json_generator_path} "#{ JAVASCRIPT_INSPECTOR_PROTOCOLS_PATH } " > "#{ $inspector_js_json_path} " }
68
- if $?. exitstatus != 0
69
- puts "ERROR: Could not generate combined InspectorJS.json file"
70
- exit 1
71
- end
72
-
73
- # InspectorWeb.json
74
- output = %x{ #{ $inspector_json_generator_path} "#{ WEB_INSPECTOR_PROTOCOLS_PATH } " > "#{ $inspector_web_json_path} " }
75
- if $?. exitstatus != 0
76
- puts "ERROR: Could not generate combined InspectorWeb.json file"
77
- exit 1
78
- end
79
- end
80
-
81
54
def all_tasks
82
55
tasks = [ ]
83
56
84
- # ToT Inspector json files.
85
- generate_combined_inspector_json
86
- tasks << Task . new ( $inspector_js_json_path, nil , "JavaScript" , $web_inspector_protocol_path, true )
87
- tasks << Task . new ( $inspector_web_json_path, $inspector_js_json_path, "Web" , $web_inspector_protocol_path, true )
88
-
89
57
had_error = false
90
58
Dir . glob ( File . join ( $versions_directory_path, "*.json" ) ) . each do |version_path |
91
59
match = File . basename ( version_path ) . match ( /^Inspector(.*?)\- ([^-]+?)\. json$/ )
92
60
if match
93
- output_path = File . join $web_inspector_protocol_path , "Legacy" , match [ 2 ]
94
- tasks << Task . new ( version_path , nil , "Web" , output_path , false )
61
+ output_path = File . join $web_inspector_protocol_legacy_path , match [ 2 ]
62
+ tasks << Task . new ( version_path , nil , "Web" , output_path )
95
63
else
96
64
puts "ERROR: Version file (#{ version_path } ) did not match the template Inspector<ANYTHING>-<VERSION>.js"
97
65
had_error = true
0 commit comments