forked from mgoellnitz/JFileSync3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
160 lines (141 loc) · 5.7 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
defaultTasks 'clean', 'build'
apply plugin: 'java'
apply plugin: 'application'
apply plugin:com.smokejumperit.gradle.ExecPlugin
apply plugin: 'launch4j'
sourceCompatibility = 1.7
targetCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
compileJava.options.deprecation = true
buildscript {
repositories {
mavenCentral()
maven { url "http://repo.smokejumperit.com" }
}
dependencies {
classpath 'com.smokejumperit:gradle-plugins:0.8.2'
classpath 'edu.sc.seis.gradle:launch4j:1.0.6'
}
}
repositories {
mavenCentral()
maven { url "http://sardine.googlecode.com/svn/maven/" }
maven { url "http://repo2.maven.org/maven2/org/bouncycastle" }
}
sourceSets {
main {
java {
srcDir 'src'
exclude 'jfs/sync/fileencrypted/*.java'
exclude '**/HeapSort.java'
}
resources {
srcDir 'src'
exclude '**/*.7z'; // I tend to hide some experimental codes here
exclude '**/*.java'; // result of the exclusions above: this is necessary
}
}
}
dependencies {
// dropbox client
// compile files(fileTree(dir: 'lib', includes: ['*.jar']))
// compile 'com.googlecode.sardine:sardine:314'
compile 'org.slf4j:slf4j-api:1.5.8' // 1.7.5
compile 'org.slf4j:slf4j-log4j12:1.5.8' // 1.7.5
compile 'org.apache.httpcomponents:httpclient:4.2.5'
// Cifs code looks good but I don't have shares to use so I skip this
// compile 'jcifs:jcifs:1.3.17'
compile 'commons-lang:commons-lang:2.6'
compile 'org.apache.commons:commons-compress:1.3' // 1.5
compile 'net.sf.jsignature.io-tools:easystream:1.2.12'
compile 'org.bouncycastle:bcprov-jdk16:1.46'
compile 'javax.servlet:servlet-api:2.5'
}
mainClassName = 'jfs.JFileSync'
// mainClass = 'jfs.JFileSync'
launch4j {
mainClassName = project.mainClassName
version = '3.0.4'
copyright = '(C) 2002-2014, J. Heidrich, M. Goellnitz'
downloadUrl = 'https://www.dropbox.com/s/3n4snlbw9tyjgec/JFileSync3.zip'
supportUrl = 'https://github.com/mgoellnitz/JFileSync3'
icon = "$project.projectDir/win/JFileSync3.ico"
dontWrapJar = true
xmlFileName = 'JFileSync3-launcher.xml'
initialHeapSize = 1024
maxHeapSize = 1536
}
startScripts {
doLast {
// Add some more reasonable memory settings to JFileSync3
unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-ms1280m -mx1536m -Xms1280m -Xmx1536m"')
windowsScript.text = windowsScript.text.replace('DEFAULT_JVM_OPTS=', 'DEFAULT_JVM_OPTS=-ms1280m -mx1536m -Xms1280m -Xmx1536m')
// Armor start script to use javaw and start when not used as a command line tool
windowsScript.text = windowsScript.text.replace('java.exe', '%JAVA_CMD%')
windowsScript.text = windowsScript.text.replace('@rem Find %JAVA_CMD%', 'set JAVA_PREFIX=start "JFileSync3 starting..."\nset JAVA_CMD=javaw.exe\nif "x%~1" == "x" goto noparams\nset JAVA_PREFIX=\nset JAVA_CMD=java.exe\n:noparams\n\n@rem Find java.exe')
windowsScript.text = windowsScript.text.replace('"%JAVA_EXE%" %DEFAULT_JVM_OPTS%', '%JAVA_PREFIX% "%JAVA_EXE%" %DEFAULT_JVM_OPTS%')
}
}
distZip {
// TODO: later...
// into(project.name+"/bin") {
// from 'bin'
// include 'E*.bat'
//}
into(project.name) {
from "$buildDir/launch4j"
include '*.exe'
include '*.xml'
}
// Sometimes I want to have the icon file at hand
into("$project.name/bin") {
from 'win'
include '*.ico'
}
// For the Ubuntu Unity desktop integration this looks better
into("$project.name/bin") {
from 'ubuntu'
include '*.desktop'
include '*.png'
}
// legal stuff, examples, and documentation
into(project.name) {
from '.'
include 'legal/*.*'
include 'profiles/*.*'
include 'README.md'
}
// I personally have the JCE stuff prepared there
into(project.name) {
from '..'
include 'jce-jre-patches/**'
}
// You might package your personal profiles in here
into(project.name) {
from '..'
include 'profiles/**'
}
}
task(encryptionTest) << {
// Extract distribution
println "Extracting distribution"
ant.unzip(src: "$buildDir/distributions/${project.name}.zip", dest: "$buildDir")
// Extract test data
println "Extracting test data"
ant.unzip(src: "test/test-folders.zip", dest: "$buildDir/${project.name}")
println "Encrypting"
String cmd = "cmd /c bin${File.separator}${project.name} -config ..\\..\\test\\1-encrypt-with-metadata.xml -nogui -nohistory -quiet"
project.exec(cmd, "$buildDir/${project.name}")
println "Decrypting taking every folders metadata into account"
cmd = "cmd /c bin${File.separator}${project.name} -config ..\\..\\test\\2-decrypt-with-metadata.xml -nogui -nohistory -quiet"
project.exec(cmd, "$buildDir/${project.name}")
println "Decrypting ignoring every folders metadata"
cmd = "cmd /c bin${File.separator}${project.name} -config ..\\..\\test\\3-decrypt-without-metadata.xml -nogui -nohistory -quiet"
project.exec(cmd, "$buildDir/${project.name}")
println "And now please compare by hand"
cmd = "cmd /c bin${File.separator}${project.name} -config ..\\..\\test\\4-compare-resulting-folders.xml -nohistory"
project.exec(cmd, "$buildDir/${project.name}")
}
// Project specific default output directory for eclipse users
// apply plugin: 'eclipse'
// eclipse.classpath.conventionMapping.defaultOutputDir = { new File(project.projectDir, 'build/classes/main') }