summaryrefslogtreecommitdiff
path: root/build.gradle
blob: ce4b65b8d759822c04cd5039e4ca0b5358386511 (plain) (blame)
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
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "eu.appsatori:gradle-fatjar-plugin:0.2-rc1"
        classpath "net.sf.proguard:proguard-gradle:5.0"
    }
}

apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "fatjar"

sourceCompatibility = 1.7
targetCompatibility = 1.7

group = "com.cuchazinteractive"
archivesBaseName = "enigma"
version = "0.6b"

sourceSets {
	main {
		java {
			srcDir "src"
		}
		resources {
			srcDir "conf"
		}
	}
	test {
		java {
			srcDir "test"
		}
	}
}

repositories {
	mavenCentral()
}

dependencies {
	compile fileTree( dir: "libs", include: "*.jar" )
	compile "de.sciss:jsyntaxpane:1.0.0"
	compile "com.google.guava:guava:17.0"
	compile "org.javassist:javassist:3.18.1-GA"
	
	testCompile "junit:junit:4.11"
	testCompile "org.hamcrest:hamcrest-all:1.3"
}

fatJar {
	from( "." ) {
		include( "*.txt" )
	}
	manifest {
		attributes(
			"Title": archivesBaseName,
			"Manifest-Version": "1.0",
			"Version": version,
			"Main-Class" : "cuchaz.enigma.Main"
		)
	}
}

task jarLoneClass( type: Jar ) {
	from( sourceSets.test.output ) {
		include( "cuchaz/enigma/inputs/Keep.class" )
		include( "cuchaz/enigma/inputs/loneClass/**" )
	}
	archiveName( "testLoneClass.jar" )
}

task jarInheritanceTree( type: Jar ) {
	from( sourceSets.test.output ) {
		include( "cuchaz/enigma/inputs/Keep.class" )
		include( "cuchaz/enigma/inputs/inheritanceTree/**" )
	}
	archiveName( "testInheritanceTree.jar" )
}

task jarConstructors( type: Jar ) {
	from( sourceSets.test.output ) {
		include( "cuchaz/enigma/inputs/Keep.class" )
		include( "cuchaz/enigma/inputs/constructors/**" )
	}
	archiveName( "testConstructors.jar" )
}

task jarInnerClasses( type: Jar ) {
	from( sourceSets.test.output ) {
		include( "cuchaz/enigma/inputs/Keep.class" )
		include( "cuchaz/enigma/inputs/innerClasses/**" )
	}
	archiveName( "testInnerClasses.jar" )
}

tasks.withType( proguard.gradle.ProGuardTask ) {
	libraryjars( "${System.getProperty('java.home')}/lib/rt.jar" )
	overloadaggressively
	repackageclasses
	allowaccessmodification
	dontoptimize
	dontshrink
	keep( "class cuchaz.enigma.inputs.Keep" )
}

task obfLoneClass( type: proguard.gradle.ProGuardTask, dependsOn: jarLoneClass ) {
	def name = "LoneClass"
	injars( "build/libs/test${name}.jar" )
	outjars( "build/libs/test${name}.obf.jar" )
}

task obfInheritanceTree( type: proguard.gradle.ProGuardTask, dependsOn: jarInheritanceTree ) {
	def name = "InheritanceTree"
	injars( "build/libs/test${name}.jar" )
	outjars( "build/libs/test${name}.obf.jar" )
}

task obfConstructors( type: proguard.gradle.ProGuardTask, dependsOn: jarConstructors ) {
	def name = "Constructors"
	injars( "build/libs/test${name}.jar" )
	outjars( "build/libs/test${name}.obf.jar" )
}

task obfInnerClasses( type: proguard.gradle.ProGuardTask, dependsOn: jarInnerClasses ) {
	def name = "InnerClasses"
	injars( "build/libs/test${name}.jar" )
	outjars( "build/libs/test${name}.obf.jar" )
}

task obfTestCases( dependsOn: tasks.withType( proguard.gradle.ProGuardTask ) )