Git Product home page Git Product logo

gradle-teg2neo4j-plugin's Introduction

gradle-teg2neo4j-plugin

Travis build status

"gradle-teg2neo4j-plugin" (or in short: "gteg2neo4j") is a Gradle plugin providing functionality to store the Task Execution Graph (including information like success, failure, etc. for each task of the current build) of a project's gradle build inside a Neo4j instance.

Once imported, the graph can be seen directly inside the Neo4j browser and detailed data can be queried using the Neo4j Cypher language.

The following image shows such a visualizion. The source was a build execution of the "gradle-teg2neo4j-plugin" project itself (which was actually failing).

Task Graph Visualization

Usage

Configuration of the plugin

The build.gradle file of the project, which will use the plugin, must be extended with the configuration below:

//fetch plugin jar and dependencies
buildscript {
    repositories {
        //required for the neo4j relevant dependencies
        maven { url "http://m2.neo4j.org/content/groups/public" }
    }
}

//load the plugin
plugins {
    id "com.github.mahnkong.gteg2neo4j" version "1.1.4"
}

//apply the plugin
apply plugin: 'com.github.mahnkong.gteg2neo4j'

//configuration of the plugin
gteg2neo4j {
    //required: server url
    neo4jServer "http://localhost:7474"
    //optional: authentication parameters
    neo4jUser "neo4j"
    neo4jPassword "password"
    //optional: disable plugin
    disabled false
}

Execution of a build with the plugin configured

Just execute the build as always. At the end of the build the plugin prints the build id used for the storing of the data in the neo4j instance

$ ./gradlew build
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:assemble UP-TO-DATE
:createClasspathManifest UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 5.091 secs
gteg2neo4j :: This build has the id: gradle-teg2neo4j-plugin::71592037-771a-4391-b9db-825df301d6a4

The plugin execution can be disabled during a build by providing the system property "gteg2neo4j.disabled"

$ ./gradlew build -Dgteg2neo4j.disabled
 ...
BUILD SUCCESSFUL

Total time: 3.488 secs
'gteg2neo4j' has been disabled - won't send data to neo4j!

Query the database using the build id

With the build id, the stored task graph and its task data can be accessed using Neo4j.

Example query for the complete task graph of one specific build:

MATCH (t:BuildTask {build:'gradle-teg2neo4j-plugin::71592037-771a-4391-b9db-825df301d6a4'}) RETURN t

Another example of a possible query after the import - query for all tasks stored during the last 10 minutes:

MATCH (t:BuildTask) WHERE t.insertedAt + 600000 >= timestamp() RETURN t

Node and Relationship reference

The following labels exist for the task nodes:

  • BuildTask: All task nodes
  • SucessfulTask: All successful task nodes
  • FailureTask: All failed task nodes

The following attributes are set for each task node (based on the task's state after the build finished):

  • name: The task's path
  • build: The build id (set by the "gradle-teg2neo4j-plugin")
  • executed: A bool indicating that the task was executed
  • didWork: A bool indicating that the task did some work
  • upToDate: A bool indicating that the task was up to date
  • failureMsg: The thrown exception's message in case the task failed
  • insertedAt: The timestamp of the data insertion (set by the "gradle-teg2neo4j-plugin")

The following relationships are set between the task nodes depending on the task execution graph

  • DEPENDS_ON: Indicates, that one task depends on another task
  • FINALIZES: Indicates, that one task finalizes another task

How to build the plugin

To build, simply execute the build task from within the project's directory:

$ ./gradlew build

To publish the build to the local maven repository, execute:

$ ./gradlew publishAPTMLR

gradle-teg2neo4j-plugin's People

Contributors

mahnkong avatar

Watchers

 avatar  avatar  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.