建设机器人工作室项目时,运行皮棉 [英] Run lint when building android studio projects
问题描述
我希望能够运行,当我建立了Android Studio项目,以确保得到遵守的规则皮棉皮棉任务。
我使用任务相关性,但没有运气都试过了。我的TeamCity构建服务器使用它运行皮棉任务生成任务,使伟大工程。然而,Android的工作室似乎使用generateDebugSources和compileDebugJava任务交替时,我选择了调试版本的变种。
下面是我曾在我的build.gradle:
assemble.dependsOn皮棉
如果你只是想配置你的Android Studio项目,而不影响您的摇篮任务是如何配置运行默认的运行配置前皮棉检查,可以按照以下步骤。
- 打开运行配置下拉菜单,选择修改
<醇开始=2>
<醇开始=3>
<醇开始=4>
- 键入检查,并选择与您的应用程序模块名称和检查的选项。 (我的是
:应用:检查
)
<醇开始=6>
检查
现有的摇篮感知化妆前一步
一步
现在,Android的工作室将运行绒毛检查和构建失败,如果发生任何皮棉错误。
I would like to be able to run the lint task when I'm building projects with android studio to ensure the lint rules are being followed.
I have tried using task dependencies but with no luck. My teamcity build server uses the build task which runs the lint task, so that works great. However, android studio appears to use generateDebugSources and compileDebugJava tasks interchangeably when I have selected the debug build variant.
Here is what I have tried in my build.gradle:
assemble.dependsOn lint
If you just want to configure your Android Studio project to run the lint check before the default run configuration without affecting how your gradle tasks are configured, you can follow these steps.
- Open the run configurations drop down and choose edit
- Select your app run configuration
- Press the '+' to add a new step
- Choose "Gradle-aware Make"
- Type 'check' and choose the option with your app module name and check. (Mine is
:app:check
)
- Press the up arrow to move the new
check
step before the existingGradle-aware make
step
Now, Android Studio will run the lint check and fail the build if any lint errors occur.
这篇关于建设机器人工作室项目时,运行皮棉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!