Skip to content

Commit

Permalink
Fixes GH-37: Only recompile code under IntelliJ IDEA (improve dev exp…
Browse files Browse the repository at this point in the history
…erience)
  • Loading branch information
dweiss committed Nov 25, 2020
1 parent ab17c4c commit 233ef90
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions gradle/ide/idea.gradle
@@ -1,3 +1,16 @@

// Try to detect IntelliJ model loader early.
rootProject.ext {
isIdea = System.getProperty("idea.active") != null ||
gradle.startParameter.taskNames.contains('idea') ||
gradle.startParameter.taskNames.contains('cleanIdea')

if (isIdea) {
logger.lifecycle("IntelliJ Idea IDE detected.")
}
}

// Apply intellij plugin to all projects.
allprojects {
apply plugin: 'idea'

Expand All @@ -10,3 +23,27 @@ allprojects {
}
}

// GH-37: skip certain long tasks if we're building within IntelliJ.
if (rootProject.isIdea) {
gradle.taskGraph.whenReady { taskGraph ->
def tasks = taskGraph.getAllTasks()

def skipTasks = [
// Skip any tasks from distribution or DCS distribution.
":distribution:.+",
":dcs:distribution:.+",
// Skip yarn-related stuff.
".*:(yarnSetup|yarnInstall|yarnBuild)",
// Skip WAR or ZIP assembly.
".*:(war|zip)"
]

tasks.each { task ->
def taskPath = task.path
if (skipTasks.any {pattern -> taskPath ==~ pattern}) {
logger.debug("Skipping task on IntelliJ: " + taskPath)
task.enabled = false
}
}
}
}

0 comments on commit 233ef90

Please sign in to comment.