-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
127 lines (103 loc) · 3.6 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
group 'kamontat.me'
apply plugin: 'java'
apply plugin: 'idea'
// run main
apply plugin: 'application'
mainClassName = "com.kamontat.main.Main"
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '2.2.3'
description = 'Github Request By Java'
task info {
description "get project information"
doFirst {
println "----------------"
println "Name: $project.name ($version)"
println "Description: $project.description"
println "Project-location: \"$projectDir\""
println "Project-location: \"$projectDir/docs\""
println "----------------"
println "Build-location: \"$buildDir\""
println "Reports-location: \"$reportsDir\""
println "Distributions-location: \"$buildDir/distributions\""
println "----------------"
}
doLast {
println ""
println ""
println ""
}
}
task wrapper(type: Wrapper) {
description "create wrapper gradle version 3.3"
gradleVersion = '3.3'
}
// execute main class by run `gradlew execute -P mainClass=<Name>` or `gradlew execute -P mainClass=<Name> -P arguments=<arguments>`
task execute(type: JavaExec) {
if (project.hasProperty('arguments')) {
args(getProperty('arguments').split(','))
}
if (project.hasProperty('mainClass')) {
main = getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
}
task gendocs(type: Javadoc) {
description "create docs folder in root folder($rootDir) and contain all javadoc"
// source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath
destinationDir = file("$rootDir/docs")
title = "Github-Request $version"
// options.windowTitle = "Github-Request $version"
// options.quiet()
}
// add version class in com.kamontat.model.management call `Version.java`
task genversionclass {
description "add version class in com.kamontat.model.management call `Version.java`"
doFirst {
new File("src/main/java/com/kamontat/model/management", "Version.java").write(
"package com.kamontat.model.management;\n" +
"\n" +
"public class Version {\n" +
"\tpublic static final String VERSION = \"2.2.3\";\n" +
"}"
)
}
}
task jarmaker(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Github Request',
'Implementation-Version': version,
'Main-Class': mainClassName
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
// ordering task
compileJava.dependsOn clean
build.dependsOn gendocs
build.dependsOn genversionclass
jar.finalizedBy jarmaker
build.finalizedBy info
repositories {
maven { url "https://repo.jenkins-ci.org/releases/" }
mavenCentral()
}
dependencies {
// unit test4
testCompile group: 'junit', name: 'junit', version: '4.11'
// unit test5
// testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M3'
// testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.0-M3'
// jetbrains gui
compile group: 'com.intellij', name: 'forms_rt', version: '7.0.3'
// github api
compile group: 'org.kohsuke', name: 'github-api', version: '1.84'
// encryption
compile group: 'org.jasypt', name: 'jasypt', version: '1.9.2'
// google drive api
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.22.0'
compile 'com.google.apis:google-api-services-drive:v3-rev56-1.22.0'
}