GWT
GWT 是 2.5 版本及以后版本的官方开源项目。
本文档提供了从源代码构建 SDK 并运行其测试的快速指南。
如需更详细的文档,请访问我们的网站。如果您有兴趣为项目做出贡献,请阅读让 GWT 变得更好部分。
构建 GWT SDK:
-
要构建 GWT,您的系统需要安装
java
和ant
。 -
您需要检出并更新 GWT 工具库。默认情况下,它应位于
../tools
目录。您可以通过设置 GWT_TOOLS 环境变量或向 ant 传递-Dgwt.tools=
参数来覆盖默认位置。 -
要创建 SDK 分发文件,请运行:
$ ant clean dist-dev
然后您将在
build/lib
文件夹中获得所有.jar
文件,可重新分发的文件将是:build/dist/gwt-0.0.0.zip
如果您想指定不同的版本号,请运行:
$ ant clean dist-dev -Dgwt.version=x.x.x
-
要编译包括示例在内的所有内容,您需要运行:
$ ant clean dist
-
要创建 Maven 构件(在使用 ant 构 建 .jar 之后),请使用以下指南。
如何验证 GWT 代码规范:
-
在 GWT 中,我们有一些约定,以使所有贡献者编写的代码看起来相似,更易于审查。
-
在进行任何修改后,运行以下命令来编译包括测试在内的所有内容,检查 API,并验证代码风格。这不应该花费超过 3-4 分钟。
$ ant compile.tests apicheck checkstyle
如何运行 GWT 测试
-
在运行任何测试之前,您需要设置一些环境变量,以确保所有开发人员在相同条件下运行测试。
在类 Unix 平台上,您可以使用
export
命令:$ export TZ=America/Los_Angeles ANT_OPTS=-Dfile.encoding=UTF-8
但在 Windows™ 上,您需要在控制面板中设置时区,并使用
set
命令设置环境变量。 -
最后,您可以使用以下命令运行所有测试套件,但请做好准备,因为这可能需要数小时,并且可能会因超时等原因而失败。
$ ant test
-
因此,您可能只想运行某些测试,以便专注于检查您正在进行的修改。
GWT 构建脚本使用特定的 ant 任务和一系列系统属性(列在下表中)来指定要运行的测试以及如何运行。
例如,要在
user
模块中运行test
任务,您需要切换到user
文件夹并运行ant
,将任务作为参数,并使用-D
标志添加任何其他属性:$ ( cd user && ant test -Dtest.emma.htmlunit.disable=true ; cd .. )
模块 | 任务 | 可跳过的属性 | 描述 -------------- | ---------------------- | ------------------------------ | ---------------------- dev | test | test.dev.disable | GWT编译器和开发库 codeserver | test | test.codeserver.disable | SuperDevMode服务器 user | test | test.user.disable | GWT用户API和JRE模拟 user | test.nongwt | test.nongwt.disable | 运行不需要GWTTestCase的测试 user | test.dev.htmlunit | test.dev.htmlunit.disable | 使用HtmlUnit运行开发模式测试 user | test.web.htmlunit | test.web.htmlunit.disable | 使用HtmlUnit运行Web模式测试 user | test.draft.htmlunit | test.draft.htmlunit.disable | 运行草稿编译的HtmlUnit测试 user | test.nometa.htmlunit | test.nometa.htmlunit.disable | 使用HtmlUnit运行-XdisableClassMetadata测试 user | test.emma.htmlunit | test.emma.htmlunit.disable | 使用HtmlUnit运行emma测试 user | test.coverage.htmlunit | test.coverage.htmlunit.disable | 运行覆盖率支持测试 user | test.dev.selenium | test.dev.selenium.disable | 使用Selenium RC服务器运行开发模式测试 user | test.web.selenium | test.web.selenium.disable | 使用Selenium RC服务器运行Web测试 user | test.draft.selenium | test.draft.selenium.disable | 使用Selenium RC服务器运行草稿编译测试 user | test.nometa.selenium | test.nometa.selenium.disable | 使用Selenium RC服务器运行-XdisableClassMetadata测试 user | test.emma.selenium | test.emma.selenium.disable | 使用Selenium RC服务器运行emma测试 requestfactory | test | test.requestfactory.disable | Request Factory库 tools | test | test.tools.disable | GWT开发中使用的一些工具
此外,您可以使用一些变量来过滤每个任务中要运行的测试:
模块 | 任务 | 属性 | 默认值 |
---|---|---|---|
dev/core | test | gwt.junit.testcase.dev.core.includes | **/com/google/**/*Test.class |
gwt.junit.testcase.dev.core.excludes | |||
user | test | gwt.junit.testcase.includes | **/*Suite.class |
user | test.nongwt | gwt.nongwt.testcase.includes | **/*JreSuite.class |
gwt.nongwt.testcase.excludes | |||
user | test.web.* test.draft.* test.nometa.* | gwt.junit.testcase.web.includes | **/*Suite.class |
gwt.junit.testcase.web.excludes | **/*JsInteropSuite.class,**/*JreSuite.class,***/OptimizedOnly* | ||
user | test.dev.* test.emma.* | gwt.junit.testcase.dev.includes | **/*Suite.class |
gwt.junit.testcase.dev.excludes | **/*JsInteropSuite.class,**/*JreSuite.class,***/OptimizedOnly* |
示例
-
在dev中运行所有测试
$ ( cd dev && ant test ; cd .. )
注意:最后的
cd ..
仅在Windows中需要。 -
还有另一种方法可以实现相同的目的,无需切换到模块文件夹。我们需要将模块指定为ant任务,将任务指定为目标参数。
$ ant dev -Dtarget=test
-
在codeserver中运行所有测试
$ ( cd dev/codeserver && ant test )
或
$ ant codeserver -Dtarget=test -Dtest.dev.disable=true
注意:我们禁用dev测试,因为codeserver依赖于dev,我们不想运行它的测 试。
-
在tools中运行所有测试
$ ant tools -Dtarget=test -Dtest.dev.disable=true -Dtest.user.disable=true
-
仅在dev中运行JsniRefTest
$ ant dev -Dtarget=test \ -Dgwt.junit.testcase.dev.core.includes="**/JsniRefTest.class"
-
在dev中运行几个测试
$ ant dev -Dtarget=test \ -Dgwt.junit.testcase.dev.core.includes="**/JsniRefTest.class,**/JsParserTest.class"
注意:您必须使用逗号分隔的正则表达式来选择要执行的测试类。
-
在user中运行所有Jre测试,它们应该不超过3分钟。 我们有两种方法来运行它们。尽管第二种方法更复杂,但它在这里是为了了解禁用属性的工作原理。
$ ( cd user && ant test.nongwt )
或
$ ant user -Dtarget=test
-Dtest.dev.disable=true \
-Dtest.codeserver.disable=true \
-Dtest.requestfactory.disable=true \
-Dtest.tools.disable=true \
-Dtest.dev.htmlunit.disable=true \
-Dtest.web.htmlunit.disable=true \
-Dtest.coverage.htmlunit.disable=true \
-Dtest.dev.selenium.disable=true \
-Dtest.draft.htmlunit.disable=true \
-Dtest.draft.selenium.disable=true \
-Dtest.emma.htmlunit.disable=true \
-Dtest.emma.selenium.disable=true \
-Dtest.nometa.htmlunit.disable=true \
-Dtest.nometa.selenium.disable=true \
-Dtest.web.selenium.disable=true
注意:我们必须设置所有的禁用变量,除了test.nongwt.disable
- 在user模块中运行特定的Jre测试。
$ ( cd user && ant test.nongwt -Dgwt.nongwt.testcase.includes="**/I18NJreSuite.class" )
- 在开发模式下使用htmlunit运行user中的所有GWT测试。
$ ( cd user && ant test.dev.htmlunit )
编辑推荐精选

酷表ChatExcel
大模型驱动的Excel数据处理工具
基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。


DeepEP
DeepSeek开源的专家并行通信优化框架
DeepEP是一个专为大规模分布式计算设计的通信库,重点解决专家并行模式中的通信瓶颈问题。其核心架构采用分层拓扑感知技术,能够自动识别节点间物理连接关系,优化数据传输路径。通过实现动态路由选择与负载均衡机制,系统在千卡级计算集群中维持稳定的低延迟特性,同时兼容主流深度学习框架的通信接口。


DeepSeek
全球领先开源大模型,高效智能助手
DeepSeek是一家幻方量化创办的专注于通用人工智能的中国科技公司,主攻大模型研发与应用。DeepSeek-R1是开源的推理模型,擅长处理复杂任务且可免费商用。


问小白
DeepSeek R1 满血模型上线
问小白是一个基于 DeepSeek R1 模型的智能对话平台,专为用户提供高效、贴心的对话体验。实时在线,支持深度思考和联网搜索。免费不限次数,帮用户写作、创作、分析和规划,各种任务随时完成!


KnowS
AI医学搜索引擎 整合4000万+实时更新的全球医学文献
医学领域专用搜索引擎整合4000万+实时更新的全球医学文献,通过自主研发AI模型实现精准知识检索。系统每日更新指南、中英文文献及会议资料,搜索准确率较传统工具提升80%,同时将大模型幻觉率控制在8%以下。支持临床建议生成、文献深度解析、学术报告制作等全流程科研辅助,典型用户反馈显示每周可节省医疗工作者70%时间。


Windsurf Wave 3
Windsurf Editor推出第三次重大更新Wave 3
新增模型上下文协议支持与智能编辑功能。本次更新包含五项 核心改进:支持接入MCP协议扩展工具生态,Tab键智能跳转提升编码效率,Turbo模式实现自动化终端操作,图片拖拽功能优化多模态交互,以及面向付费用户的个性化图标定制。系统同步集成DeepSeek、Gemini等新模型,并通过信用点数机制实现差异化的资源调配。


腾讯元宝
腾讯自研的混元大模型AI助手
腾讯元宝是腾讯基于自研的混元大模型推出的一款多功能AI应用,旨在通过人工智能技术提升用户在写作、绘画、翻译、编程、搜索、阅读总结等多个领域的工作与生活效率。


Grok3
埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型
Grok3 是由埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型,常被马斯克称为“地球上最聪明的 AI”。它不仅是在前代产品 Grok 1 和 Grok 2 基础上的一次飞跃,还在多个关键技术上实现了创新突破。


OmniParser
帮助AI理解电脑屏幕 纯视觉GUI元素的自动化解析方案
开源工具通过计算机视觉技术实现图形界面元素的智能识别与结构化处理,支持自动化测试脚本生成和辅助功能开发。项目采用模块化设计,提供API接口与多种输出格式,适用于跨平台应用场景。核心算法优化了元素定位精度,在动态界面和复杂布局场景下保持稳定解析能力。


流畅阅读
AI网页翻译插件 双语阅读工具,还原母语级体验
流畅阅读是一款浏览器翻译插件,通过上下文智能分析提升翻译准确性,支持中英双语对照显示。集成多翻译引擎接口,允许用户自定义翻译规则和快捷键配置,操作数据全部存储在本地设备保障隐私安全。兼容Chrome、Edge、Firefox等主流浏览器,基于GPL-3.0开源协议开发,提供持续的功能迭代和社区支持。
推荐工具精选
AI云服务特惠
懂AI专属折扣关注微信公众号
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号