forked from FineUploader/fine-uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
97 lines (79 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
def version = "3.5.0"
def filename = "fineuploader"
def srcDir = 'client'
def jsSrcDir = "$srcDir/js"
apply plugin: 'js'
def coreFiles = ["${jsSrcDir}/header.js",
"${jsSrcDir}/util.js",
"${jsSrcDir}/features.js",
"${jsSrcDir}/promise.js",
"${jsSrcDir}/button.js",
"${jsSrcDir}/paste.js",
"${jsSrcDir}/uploader.basic.js",
"${jsSrcDir}/dnd.js",
"${jsSrcDir}/uploader.js",
"${jsSrcDir}/ajax.requester.js",
"${jsSrcDir}/deletefile.ajax.requester.js",
"${jsSrcDir}/window.receive.message.js",
"${jsSrcDir}/handler.base.js",
"${jsSrcDir}/handler.form.js",
"${jsSrcDir}/handler.xhr.js"]
def cssFiles = ["$srcDir/fineuploader.css"]
def imageFiles = ["$srcDir/loading.gif",
"$srcDir/processing.gif"]
def additionalFilesToInclude = ["${jsSrcDir}/iframe.xss.response.js"]
def jQueryPluginFiles = ["${jsSrcDir}/jquery-plugin.js",
"${jsSrcDir}/jquery-dnd.js"]
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.eriwen:gradle-js-plugin:1.3'
}
}
combineJs {
source = files(coreFiles)
dest = file("$buildDir/${filename}-${version}.js")
}
task combineJsJquery(type: com.eriwen.gradle.js.tasks.CombineJsTask) {
source = files(coreFiles + jQueryPluginFiles)
dest = file("$buildDir/jquery.${filename}-${version}.js")
}
minifyJs {
source = combineJs
dest = file("$buildDir/${filename}-${version}.min.js")
}
task minifyJsJquery(type: com.eriwen.gradle.js.tasks.MinifyJsTask) {
source = combineJsJquery
dest = file("$buildDir/jquery.${filename}-${version}.min.js")
}
task zipJquery(type: Zip) {
baseName "jquery.$filename-$version"
from files("$buildDir")
destinationDir file('release')
}
task zip(type: Zip) {
baseName "$filename-$version"
from files("$buildDir")
destinationDir file('release')
}
task copyResources(type:Copy) {
from cssFiles + imageFiles + additionalFilesToInclude
into 'build'
rename { String fileName ->
fileName.replace('.css', "-${version}.css")
}
rename { String fileName ->
fileName.replace('.js', "-${version}.js")
}
}
task clean << {
delete files("$buildDir")
}
task createJQueryRelease(dependsOn: ['clean', 'minifyJsJquery', 'copyResources', 'zipJquery']) {
outputs.upToDateWhen { false }
}
task createRelease(dependsOn: ['clean', 'minifyJs', 'copyResources', 'zip']) {
outputs.upToDateWhen { false }
}