mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Filter out webidl files based on special comments, and feature-gate webxr interfaces. (#34348)
* Filter out webidl files based on skip-if directives. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Don't build XR functionality without webxr feature. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Adjust imports for file movement. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Clean up webxr module import. Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
e956f3124c
commit
3faed9b921
94 changed files with 206 additions and 53 deletions
|
@ -5,10 +5,13 @@
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import re
|
||||
|
||||
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..", "..", "..", ".."))
|
||||
|
||||
FILTER_PATTERN = re.compile("// skip-unless ([A-Z_]+)\n")
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(os.path.join(os.path.dirname(__file__)))
|
||||
|
@ -32,7 +35,14 @@ def main():
|
|||
for webidl in webidls:
|
||||
filename = os.path.join(webidls_dir, webidl)
|
||||
with open(filename, "r", encoding="utf-8") as f:
|
||||
parser.parse(f.read(), filename)
|
||||
contents = f.read()
|
||||
filter_match = FILTER_PATTERN.search(contents)
|
||||
if filter_match:
|
||||
env_var = filter_match.group(1)
|
||||
if not os.environ.get(env_var):
|
||||
continue
|
||||
|
||||
parser.parse(contents, filename)
|
||||
|
||||
add_css_properties_attributes(css_properties_json, parser)
|
||||
parser_results = parser.finish()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue