-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
81 lines (65 loc) · 2.5 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
buildscript {
repositories {
jcenter()
maven { url KOTLIN_REPO }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'net.sf.proguard:proguard-gradle:5.3.2'
}
}
repositories {
jcenter()
maven { url KOTLIN_REPO }
}
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
//noinspection GroovyUnusedAssignment
sourceCompatibility = 1.5
mainClassName = 'com.cypressworks.kotlinw.MainKt'
def minifiedName = "${project.name}-minified-${project.version}.jar"
def minifiedDir = "$buildDir/minified-dist/"
jar.manifest.attributes 'Main-Class': mainClassName
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.eclipse.aether:aether-api:$aether_version"
compile "org.eclipse.aether:aether-util:$aether_version"
compile "org.eclipse.aether:aether-impl:$aether_version"
compile "org.eclipse.aether:aether-connector-basic:$aether_version"
compile "org.eclipse.aether:aether-transport-file:$aether_version"
compile "org.eclipse.aether:aether-transport-http:$aether_version"
compile "org.eclipse.aether:aether-transport-wagon:$aether_version"
compile 'org.apache.maven:maven-aether-provider:3.3.9'
compile 'org.apache.maven.wagon:wagon-ssh:1.0'
compile 'org.slf4j:slf4j-nop:1.7.13'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
//noinspection UnnecessaryQualifiedReference
task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar, group: 'build') {
injars project.jar.archivePath
injars configurations.compile
libraryjars files(System.getProperty('sun.boot.class.path').split(File.pathSeparator))
dontwarn 'javax.**'
dontwarn 'com.sun.javafx.**'
dontwarn 'com.jcraft.jzlib.**'
dontwarn 'org.apache.maven.repository.internal.**'
dontwarn 'org.eclipse.aether.**'
dontwarn 'org.codehaus.plexus.**'
dontwarn 'com.google.inject.**'
keep 'class com.cypressworks.kotlinw.** {*;}'
keepclassmembers '''enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}'''
dontobfuscate()
dontoptimize()
//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
outjars new File(minifiedDir, minifiedName)
}
task minifiedStartScripts(dependsOn: proguardJar) << {
new File(minifiedDir, 'kotlinw.bat').write("""@echo off
java -jar %~dp0\\$minifiedName %*""")
}
build.dependsOn proguardJar, minifiedStartScripts