diff --git a/build.gradle b/build.gradle
index 1d88744c..649df4c2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -694,6 +694,13 @@ subprojects {
}
}
}
+
+ // 对每个前端项目在 idea 中排除 node_modules 目录, 避免大量耗时的 idea 索引
+ idea {
+ module {
+ excludeDirs += file('node_modules')
+ }
+ }
}
/***********************************************************************
@@ -703,7 +710,7 @@ subprojects {
* idea 配置
*----------------------------------------------------------------*/
tasks.ideaProject.enabled=true //在根工程中执行 ideaProject 任务,用于生成 ipr 文件
-tasks.ideaModule.enabled=false //在根工程中不执行 ideaModule 任务
+tasks.ideaModule.enabled=false //在根工程中不执行 ideaModule 任务
tasks.ideaWorkspace.enabled=true //在根工程中执行 ideaWorkspace 任务,用于修改 iws 文件
tasks.ideaProject.doFirst {
@@ -734,7 +741,7 @@ idea {
}
}
project {
- vcs = 'Git'
+ vcs = 'Git'
ipr {
// 自动化配置生成的 ipr 文件内容,减少手工操作
// 1. 移除根项目模块
@@ -759,22 +766,22 @@ idea {
withXml {
// 1. 移除根项目模块
def node = it.asNode()
- def projectModuleManagerNode =node.find{it.@name=='ProjectModuleManager'}
- def rootImlNode =projectModuleManagerNode.modules.module.find{it.@fileurl=='file://$PROJECT_DIR$/' + project.name + '.iml'}
- def rootImlParentNode =rootImlNode.parent()
+ def projectModuleManagerNode = node.find { it.@name == 'ProjectModuleManager' }
+ def rootImlNode = projectModuleManagerNode.modules.module.find { it.@fileurl == 'file://$PROJECT_DIR$/' + project.name + '.iml' }
+ def rootImlParentNode = rootImlNode.parent()
rootImlParentNode.remove(rootImlNode)
// 2. 替换 Encoding
- def encodingNode =node.find{it.@name=='Encoding'}
- encodingNode.@native2AsciiForPropertiesFiles="true"
+ def encodingNode = node.find { it.@name == 'Encoding' }
+ encodingNode.@native2AsciiForPropertiesFiles = "true"
// 3. 使 idea 编译器支持注解(enable annotation processing)
- def compilerConfigurationNode =node.find{it.@name=='CompilerConfiguration'}
- def annotationProcessingNode =compilerConfigurationNode.annotationProcessing[0]
- def annotationProcessingParentNode =annotationProcessingNode.parent()
+ def compilerConfigurationNode = node.find { it.@name == 'CompilerConfiguration' }
+ def annotationProcessingNode = compilerConfigurationNode.annotationProcessing[0]
+ def annotationProcessingParentNode = annotationProcessingNode.parent()
annotationProcessingParentNode.remove(annotationProcessingNode)
- annotationProcessingNode =annotationProcessingParentNode.appendNode("annotationProcessing")
- annotationProcessingNode.appendNode("profile",[default:true,enabled:true])
+ annotationProcessingNode = annotationProcessingParentNode.appendNode("annotationProcessing")
+ annotationProcessingNode.appendNode("profile", [default: true, enabled: true])
// 4. 激活 SaveActions 插件, 修改文件后自动编译并发布, 在 .ipr 文件中生成以下 xml 片段
//
@@ -788,39 +795,39 @@ idea {
//
//
- def saveActionSettingsNode =node.find{it.@name=='SaveActionSettings'}
- if(saveActionSettingsNode==null){
- saveActionSettingsNode =node.appendNode("component",[name:"SaveActionSettings"])
+ def saveActionSettingsNode = node.find { it.@name == 'SaveActionSettings' }
+ if (saveActionSettingsNode == null) {
+ saveActionSettingsNode = node.appendNode("component", [name: "SaveActionSettings"])
}
//