summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibIDL
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2022-11-05 11:37:33 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-13 11:31:24 +0100
commit24d2c90a28a1761423bf3958bd96c2f2b5123975 (patch)
tree9fb35e7038d22c5690677fd46e407e2c8e27365f /Userland/Libraries/LibIDL
parent8d1ad592a131fce32bdde424302d149a80fd670d (diff)
downloadserenity-24d2c90a28a1761423bf3958bd96c2f2b5123975.zip
BindingsGenerator+CMake: Keep track of IDL dependencies
This commit teaches BindingsGenerator to generate depfiles, which can be used by CMake to ensure that bindings are properly regenerated when imported IDL files change. Two new options, `--depfile` and `--depfile-target` are added. - `--depfile` sets the path for the dependency file. - `--depfile-target` lets us set a target name different than the output file in the depfile. This option is needed because generated files are first written to a temporary file, but depfiles have to refer to the final location. These are analogous to GCC's `-MF` and `-MT` options respectively. The depfile's syntax matches the ones generated by GCC. Note: This changes the minimal required CMake version to 3.20 if the Make generator is used, and to 3.21 for the Xcode generator. Ninja is not affected.
Diffstat (limited to 'Userland/Libraries/LibIDL')
-rw-r--r--Userland/Libraries/LibIDL/IDLParser.cpp4
-rw-r--r--Userland/Libraries/LibIDL/IDLParser.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp
index e54d78861c..5fb0a95c05 100644
--- a/Userland/Libraries/LibIDL/IDLParser.cpp
+++ b/Userland/Libraries/LibIDL/IDLParser.cpp
@@ -1068,4 +1068,8 @@ HashTable<NonnullOwnPtr<Interface>>& Parser::top_level_interfaces()
return top_level_parser()->interfaces;
}
+Vector<DeprecatedString> Parser::imported_files() const
+{
+ return const_cast<Parser*>(this)->top_level_resolved_imports().keys();
+}
}
diff --git a/Userland/Libraries/LibIDL/IDLParser.h b/Userland/Libraries/LibIDL/IDLParser.h
index 1233af275b..e1239c54f7 100644
--- a/Userland/Libraries/LibIDL/IDLParser.h
+++ b/Userland/Libraries/LibIDL/IDLParser.h
@@ -20,6 +20,8 @@ public:
Parser(DeprecatedString filename, StringView contents, DeprecatedString import_base_path);
Interface& parse();
+ Vector<DeprecatedString> imported_files() const;
+
private:
// https://webidl.spec.whatwg.org/#dfn-special-operation
// A special operation is a getter, setter or deleter.