forked from apanimesh061/VaderSentimentJava
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
83 lines (69 loc) · 2.61 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
apply plugin: 'java'
apply plugin: 'java-library-distribution'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = file('VERSION').getText()
String applicationName = 'VADER Sentiment Analysis in Java'
String readmeMDFile = "${projectDir}/README.md"
String readmeHTMLFile = "${buildDir}/README.html"
String overviewFile = "${buildDir}/overview.html"
println "${applicationName} ${version}"
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'src/main/dist')
testImplementation 'junit:junit:4.12'
testImplementation 'org.apache.lucene:lucene-core:5.5.4'
testImplementation 'org.apache.lucene:lucene-analyzers-common:5.5.4'
}
test {
// For comparision only, different results on Tokenizer vs. Lucene
// but final ground truth results are the same (expected).
exclude 'net/nunoachenriques/vader/text/Tokenizer*'
}
// JAVADOC
javadoc {
dependsOn = ['javadocOverview']
title = "${applicationName}" + ' API'
options.overview = "${overviewFile}"
}
task buildDirectory {
project.getBuildDir().mkdirs()
}
task markdownToHTML(type: Exec) {
description = 'Converts a Markdown text file to an HTML one.'
commandLine 'jjs', '-scripting', 'bin/showdown.min.js', 'bin/markdowntohtml.js', '--', "${->javadocOverview.mdFileName()}"
}
task javadocOverview(dependsOn: ['buildDirectory', 'markdownToHTML']) {
description = 'Generates the overview.html for the Javadoc API documentation.'
ext.mdFileName = { return "${readmeMDFile}" } // arg1 for markdownToHTML
markdownToHTML.standardOutput = new FileOutputStream("${readmeHTMLFile}") // arg2
doLast { // Complete overview.html with the head and tail HTML tags.
def overviewOutput = new File("${overviewFile}")
overviewOutput.text = '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>''' + "${applicationName}" + ''' API</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>
<body>
''' + file("${readmeHTMLFile}").getText() + '''
</body>
</html>
'''
}
}
// EXTRA PACKAGING FOR RELEASE DISTRIBUTION
task release(dependsOn: ['test', 'distZip', 'sourcesZip', 'javadocZip'])
task sourcesZip(type: Zip, dependsOn: 'classes') {
classifier = 'sources'
from sourceSets.main.allSource
destinationDir = file("${distsDir}")
}
task javadocZip(type: Zip, dependsOn: 'javadoc') {
classifier = 'javadoc'
from javadoc.destinationDir
destinationDir = file("${distsDir}")
}