-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
67 lines (54 loc) · 1.69 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
group 'com.massivedisaster.bintraydeployautomator.Automator'
version '0.1.0'
apply from: "$project.rootDir/updateReadme.gradle"
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
dependencies {
compile "org.gradle:gradle-tooling-api:4.5"
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
compile 'com.google.code.gson:gson:2.8.2'
compile 'me.tongfei:progressbar:0.5.5'
runtime 'org.slf4j:slf4j-simple:1.7.10'
}
// Task to create an dynamic class with configuration data.
task generateConfig {
inputs.property "version", project.version
doFirst {
def versionFile = file("$buildDir/generated/source/Config.java")
versionFile.parentFile.mkdirs()
versionFile.text =
"""
package com.massivedisaster.bintraydeployautomator.utils;
/**
* Automatically generated file. DO NOT MODIFY
*/
public class Config {
public static final String VERSION = "$project.version";
public static final String NAME = "BintrayDeployAutomator-$project.version";
}
"""
}
}
project.sourceSets.matching { it.name == "main" } .all {
it.java.srcDir "$buildDir/generated/source"
}
task updateReadme {
doLast {
processUpdateReadme file("$project.rootDir"), ".md", version.toString()
}
}
compileJava.dependsOn generateConfig
compileJava.dependsOn updateReadme
jar {
baseName 'BintrayDeployAutomator'
manifest {
attributes 'Main-Class': 'com.massivedisaster.bintraydeployautomator.Automator', 'version-number': version
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}