Giter Club home page Giter Club logo

intellij-gradle-init-plugin's Introduction

intellij-gradle-init-plugin

Proposal for improving IntelliJ compatibility with Gradle incremental tasks

https://youtrack.jetbrains.com/issue/IDEA-240111

Quickstart

  1. Install this project

    cd $MyGitProjectsDir
    git clone [email protected]:aSemy/intellij-gradle-init-plugin.git
    cd intellij-gradle-init-plugin
    ./gradlew publishToMavenLocal
  2. Run the updated IntelliJ version that uses the plugin

    cd $IntelliJCommunityRepo
    
    git remote add forks/aSemy [email protected]:aSemy/intellij-community.git
    git fetch forks/aSemy 
    git checkout forks/aSemy/fix/gradle-incremental-test-tasks-2
    
    # run IDEA

What's wrong?

IntelliJ breaks a Gradle feature for avoiding re-running tasks.

Fixing this is really important. It would have a huge impact on users, as their workflow would become faster.

Additionally, the power requirements of repeatedly re-running the same tests would be avoided, helping reduce energy usage worldwide.

Where is it wrong?

When running Gradle using IntelliJ, IntelliJ injects a init.gradle init script, testFilterInit.gradle. This file does many things, including adding this code:

taskGraph.allTasks.each { Task task ->
  if (task instanceof Test || (abstractTestTaskClass != null && abstractTestTaskClass.isAssignableFrom(task.class))) {

    task.outputs.upToDateWhen { false } // <- here's the problem! 

  }
}

This breaks Gradle up-to-date checks for all test tasks! This forces all tests tasks to run, even if nothing has changed. This is very wasteful (Gradle recommends against it) and can hugely increase the amount of time spent running tests.

What's the proposal?

  1. Migrate from a Groovy init script, to an Init Script Plugin - IntellijGradleInitPlugin.

    This makes the change much more modular, easier to test and debug, and can be written in Kotlin.

    (Extra bonus: the init script plugin can be updated independently of an IntelliJ release - meaning bug fixes can be released faster.)

  2. IntelliJ will apply the new plugin in addTestListener.init.gradle

  3. When the test tasks run, they'll log the IJLog XML to stdout as normal. Additionally, they'll print the XML messages to file, and register that file as a task output.

  4. The init script plugin will register an additional task, IJTestEventLoggerTask, that will collect all of those files.

  5. IJTestEventLoggerTask will determine if the test tasks have already run, and if they haven't (because they're up-to-date), will print them to stdout.

intellij-gradle-init-plugin's People

Contributors

asemy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.