forked from centic9/jgit-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
53 lines (46 loc) · 1.96 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
apply plugin: 'java'
//apply plugin: 'idea'
apply plugin: 'eclipse'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url "https://repo.eclipse.org/content/groups/releases/"
}
}
dependencies {
compile 'org.eclipse.jgit:org.eclipse.jgit:4.2.0.201601211800-r'
compile 'org.eclipse.jgit:org.eclipse.jgit.archive:4.2.0.201601211800-r'
compile 'commons-io:commons-io:2.4'
compile 'org.slf4j:slf4j-simple:1.7.13'
testCompile "junit:junit:4+"
}
// work around unnecessary timestamp in generated file which always causes dirty files in version control
// https://issues.gradle.org/browse/GRADLE-2293
task adjustEclipseSettingsFile << {
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
fileset(dir: project.projectDir, includes: '.settings/org.eclipse.jdt.core.prefs,.settings/com.google.gdt.eclipse.core.prefs')
}
}
task sortEclipseSettingsFile << {
new File(project.projectDir, '.settings/org.eclipse.jdt.core.prefs').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
new File(project.projectDir, '.classpath').with { it.text = it.readLines().findAll { it }.unique().join('\n') }
File file = new File(project.projectDir, '.settings/com.google.gdt.eclipse.core.prefs');
if(file.exists()) {
file.with { it.text = it.readLines().findAll { it }.sort().join('\n') }
}
ant.fixcrlf(srcDir: '.settings', eol: 'lf')
}
eclipseJdt.finalizedBy adjustEclipseSettingsFile
eclipseJdt.finalizedBy sortEclipseSettingsFile
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
task adjustWrapperPropertiesFile << {
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
}
new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
}
wrapper.finalizedBy adjustWrapperPropertiesFile