Code Monkey home page Code Monkey logo

gradle.tmbundle's Introduction

Provides the ability to run Gradle commands from within TextMate.

To use this bundle, you MUST have the Gradle wrapper script (i.e. gradlew) installed at the root of the directory that you have open in TextMate.

Running commands

To run a Gradle command, with any file open, press ⌃⌘G (control + command + G) to bring up the Gradle task menu.

Gradle Commands

There is a predefined set of common tasks, and a “Run Command…” item that will prompt with a dialog where you can enter the arguments to be passed to gradlew.

prompt

output

Targeting

The command menu contains items with (module) and (project) suffixes. The module commands target the module of the currently selected file in the editor, while the project commands operate on the root project.

The current mechanism for finding the module for the open file relies on a *.gradle file being present in the module directory.

prompt

output

Project Structure

The default behaviour is to determine the module name by taking it's relative path from the project root and substituting the forward slashes with colons. So given the following project structure…

modules/module-a
modules/module-b

The bundle will use the following as the names for the modules…

modules:module-a
modules:module-b

However you may have your settings.gradle file configured to use a different convention. If so, you need to provide a “transformer” script that generates the right module names. You might want the names to be module-a and module-b (i.e. no modules prefix). Your settings.gradle would look like…

include 'module-a', 'module-b'

rootProject.children.each { project ->
    project.projectDir = new File(settingsDir, "modules/$fileBaseName")
}

See the Gradle User Guide section on settings.gradle for more on configuration of project structure.

So TextMate can correctly target the module you are asking it to, you need to create a script that takes the module path as input and writes its name as output. This script must be located at .textmate/transform-gradle-project-path in the root of the project. For our custom project structure outlined above, this file would look like…

#!/usr/bin/env ruby

path = STDIN.read
puts path.start_with? "modules:" ? path.sub /^modules:/, "" : path

We are using Ruby here, but it could be anything… it just needs to be an exectuable that takes the default assumed path (i.e. modules:module-a) as input and transforms it into the appropriate path (i.e. module-a).

The Previous Command

The “Run Previous Command” item will always re-run the most recently executed command, regardless of whether it was a project or module targeted command.

Running A Single Test

The “Test Selected File” command runs the command to run the open file in the editor as the single test…

prompt

prompt

Output Filtering Features

prompt

Compile Errors

The filename and line number of output as part of each compile error for Java and Groovy source is a link that will take you to the line of the file which the compile error.

prompt

Failed Tests

The output message for each individual test class failure is linked to the corresponding XML test report which will open in TextMate when clicked.

The output message pointing to the HTML test report on test failure is converted into a link that when clicked opens the test report in your browser.

prompt

Notifications

At the end of the command, a Growl notification will be raised with the result of the command.

prompt

gradle.tmbundle's People

Contributors

ldaley avatar

Watchers

 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.