使用 -generateJsInteropExports 控制包含哪个 类 GWT

Controlling which classes GWT includes with -generateJsInteropExports

我可以控制在使用 -generateJsInteropExports 时包含哪些 class 吗?

我发现当我使用标志时,JS 输出包括一堆 classes,我没有在项目中使用它们,但它们的源出现在我的一些包中我正在使用。我不希望这些 classes 包含在输出中。通常,GWT 会很好地只引入我实际使用的 classes。

我如何告诉编译器“在此编译中我希望你为这些 class 生成 JsInterop,而不是这些”?

我找到了这些 GWT compiler options:

-includeJsInteropExports/excludeJsInteropExports

Include/exclude members and classes while generating JsInterop exports. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports)

但我似乎无法让它们工作。我尝试使用:

-generateJsInteropExports
-includeJsInteropExports com.example.MyClass

未包含 class。

过滤是在 class 成员级别(即字段和方法)而不是类型名称。要匹配 class 的所有成员,语法为:

-generateJsInteropExports
-includeJsInteropExports com.example.MyClass.*

注意:这是一个正则表达式,所以点代表“任何字符”而不是句点。如果有歧义,你必须逃避它们。