GithubHelp home page GithubHelp logo

isabella232 / gradle-bowerdeps-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from palantir/gradle-bowerdeps-plugin

0.0 0.0 0.0 259 KB

A Gradle plugin for controlling build order with bower.json files.

License: Apache License 2.0

Groovy 100.00%

gradle-bowerdeps-plugin's Introduction

Gradle Plugin for Multi-Project Bower Dependency Ordering

Build Status Build Status

This plugin is useful in multi-project gradle builds where bower.json is used to declare dependencies between projects. It sets the cross project dependencies so that projects build in the correct order.

Plugin Design

  1. Creates a "bower" configuration in the project
  2. Looks for and parses the bower.json file
  3. Adds the main and devMain files as artifacts in the "bower" configuration that are builtBy the default front end build task, e.g. grunt default
  4. Iterates over the dependencies and devDependencies and tries to resolve the paths to directories
  5. For each resolved path, take the name of the dependency and attempts to find a peer Gradle project that matches
  • If the dependency is example-lib-a: ../example-lib-a it would iterate over all projects under the root project looking for a match:
    • :web-server matches? /:example-lib-a$/ - false
    • :web-app:example-app matches? /:example-lib-a$/ - false
    • :web-app:example-lib-a matches? /:example-lib-a$/ - true
  1. Add each of the projects as project dependencies of the "bower" configuration
  2. Adds the task dependencies of the "bower" configuration as dependencies of the default front end build task, e.g. `grunt default

Installing the plugin

buildscript {
    repositories {
        maven {
            url 'http://dl.bintray.com/palantir/releases'
        }
    }

    dependencies {
        classpath 'com.palantir:gradle-bowerdeps-plugin:0.1.0'
    }

}

apply plugin: 'com.palantir.bowerdeps'

When ./gradlew build is run, the assemble task will cause each of the projects to be executed in order based on the inter-project dependencies.

Configuring the plugin

The configuration block for the plugin looks like this.

bowerdeps {
  // name of the task to run to build the bower main files
  buildTask 'grunt_build'

  // working directory where bower.json is located
  workDir file('folder/containing/bower/manifest')
}

In each of these examples, running ./gradlew build will cause the project to be built. ./gradlew assemble also works.

Grunt Default

You can utilize https://github.com/srs/gradle-grunt-plugin and the buildTask will automatically be set to grunt_default.

apply plugin: 'com.moowork.grunt'
apply plugin: 'com.palantir.bowerdeps'

Grunt Custom Task

apply plugin: 'com.moowork.grunt'
apply plugin: 'com.palantir.bowerdeps'

bowerdeps {
  buildTask 'grunt_build'
}

Gulp Default

You can utilize https://github.com/srs/gradle-gulp-plugin and the buildTask will automatically be set to gulp_default.

apply plugin: 'com.moowork.gulp'
apply plugin: 'com.palantir.bowerdeps'

Gulp Custom Task

apply plugin: 'com.moowork.gulp'
apply plugin: 'com.palantir.bowerdeps'

bowerdeps {
  buildTask 'gulp_build'
}

Custom

apply plugin: 'com.palantir.bowerdeps'

bowerdeps {
  // Any valid task name will work here
  buildTask 'customBuild'
}

task customBuild(type: Exec) {
  // You can put an arbitrary command here
  commandLine './buildScript.sh'
}

gradle-bowerdeps-plugin's People

Contributors

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