| 
29
 | 
     1 
 | 
| 
 | 
     2 println "version: $version"
 | 
| 
 | 
     3 
 | 
| 
31
 | 
     4 String makePackageName(String group, String name, String ver) {
 | 
| 
 | 
     5     def sb = new StringBuilder();
 | 
| 
 | 
     6     if(group)
 | 
| 
 | 
     7         sb
 | 
| 
 | 
     8             .append('@')
 | 
| 
 | 
     9             .append(group)
 | 
| 
 | 
    10             .append('/');
 | 
| 
 | 
    11 
 | 
| 
 | 
    12     sb.append(name);
 | 
| 
 | 
    13 
 | 
| 
 | 
    14     if (ver)
 | 
| 
 | 
    15         sb.append('@').append(ver);
 | 
| 
 | 
    16 
 | 
| 
 | 
    17     return sb.toString();
 | 
| 
 | 
    18 }
 | 
| 
 | 
    19 
 | 
| 
 | 
    20 configurations {
 | 
| 
 | 
    21     compile
 | 
| 
 | 
    22     peer
 | 
| 
 | 
    23     dev
 | 
| 
 | 
    24 }
 | 
| 
 | 
    25 
 | 
| 
 | 
    26 dependencies {
 | 
| 
 | 
    27     compile ":eslint:1.x || >=2.5.0 || 5.0.0 - 7.2.3"
 | 
| 
 | 
    28     compile (name: 'foo') {
 | 
| 
 | 
    29         ext.location = "http://some/package/location"
 | 
| 
 | 
    30     }
 | 
| 
 | 
    31     peer "dojo:core"
 | 
| 
 | 
    32 }
 | 
| 
29
 | 
    33 
 | 
| 
 | 
    34 task prepare(type: Copy) {
 | 
| 
31
 | 
    35     from('src/js/')
 | 
| 
29
 | 
    36     from('.') {
 | 
| 
 | 
    37         include 'readme.md', 'license', 'history.md', 'package.json'
 | 
| 
 | 
    38     }
 | 
| 
 | 
    39     into(buildDir)
 | 
| 
 | 
    40 }
 | 
| 
30
 | 
    41 
 | 
| 
31
 | 
    42 task installDeps {
 | 
| 
 | 
    43     configurations.compile.allDependencies.forEach { d ->
 | 
| 
 | 
    44         println makePackageName(d.group, d.name, d.version);
 | 
| 
 | 
    45         if(d.hasProperty('location')) {
 | 
| 
 | 
    46             println d.location
 | 
| 
30
 | 
    47         }
 | 
| 
 | 
    48     }
 | 
| 
29
 | 
    49 }
 | 
| 
 | 
    50 
 | 
| 
 | 
    51 task build(dependsOn: prepare) {
 | 
| 
 | 
    52 }
 | 
| 
 | 
    53 
 | 
| 
 | 
    54 task pack(dependsOn: build, type: Exec) {
 | 
| 
 | 
    55     workingDir = buildDir
 | 
| 
 | 
    56 
 | 
| 
 | 
    57     commandLine 'npm', 'pack'
 | 
| 
 | 
    58 } |