File: build.gradle

package info (click to toggle)
mediathekview 13.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 6,124 kB
  • sloc: java: 36,697; xml: 184; sh: 178; makefile: 3
file content (177 lines) | stat: -rw-r--r-- 4,820 bytes parent folder | download
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import org.apache.tools.ant.filters.ReplaceTokens
import java.nio.file.Files

apply plugin: 'java'
apply plugin: 'distribution'
apply plugin: 'maven'


compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.9
targetCompatibility = 1.9
group = 'de.mediathekview'
version = '13.2.1'

def jarName = 'MediathekView.jar'
def mainClass = 'mediathek.Main'

ext {
    propsFile = file('src/main/resources/version.properties').absoluteFile
    if (!propsFile.exists()) {
        Files.createFile(propsFile.toPath())
    }
    swingxGroup = 'org.swinglabs'
    swingxVersion = '1.6.6-SNAPSHOT'
}

def loadVersionProperties() {
    Properties props = new Properties()
    props.load(propsFile.newDataInputStream())
    return props
}

compileJava {
    options.compilerArgs = ['-Xlint:all']
}
compileTestJava {
    options.compilerArgs = ['-Xlint:all']
}

repositories {
    mavenLocal()
    mavenCentral()
    flatDir {
        dirs '/usr/share/java/'
    }
}

dependencies {
    compile ":jide-oss:3.7.4"
    compile "$swingxGroup:swingx-beaninfo:$swingxVersion"
    compile "$swingxGroup:swingx-core:$swingxVersion"
    compile 'org.apache.commons:commons-lang3:3.6'
    compile 'com.google.guava:guava:26.0-jre'
    compile 'org.apache.commons:commons-compress:1.17'
    compile 'com.fasterxml.jackson.core:jackson-core:2.9.6'
    compile 'org.tukaani:xz:1.6'
    compile 'net.sf.jchart2d:jchart2d:3.3.2'
    compile 'org.apache.logging.log4j:log4j-core:2.8.1'
    compile 'net.engio:mbassador:1.3.0'
    compile 'org.controlsfx:controlsfx:8.40.14'
    compile 'com.h2database:h2:1.4.197'
    compile 'org.apache.commons:commons-configuration2:2.2'
    compile 'com.github.jiconfont:jiconfont-swing:1.0.1'
    compile 'com.github.jiconfont:jiconfont-font_awesome:4.7.0.0'
    compile 'com.miglayout:miglayout-swing:5.1'
    compile 'com.miglayout:miglayout-core:5.1'
    compile 'com.miglayout:miglayout-javafx:5.1'
    compile 'com.squareup.okhttp3:okhttp:3.11.0'
    compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.5.0'

    compile name: 'okhttp'
    compile name: 'javafx-base'
    compile name: 'javafx-swing'
    compile name: 'javafx-web'
    compile name: 'javax.activation'
    compileOnly group: 'org.jetbrains', name: 'annotations', version: '16.0.2'
}

build.dependsOn(install)

task updateVersion {
    doLast {
        Properties props = loadVersionProperties()

        def oldVersion = props.getProperty('VERSION')
        if (!oldVersion.equals(project.version)) {
            logger.lifecycle "==MediathekView======================"
            logger.lifecycle "Version: $project.version"
            logger.lifecycle "==MediathekView======================"
            props.setProperty('VERSION', project.version)
            props.store(propsFile.newWriter(), null)
        }
    }
}

processResources.dependsOn updateVersion

tasks.withType(Zip) { task ->
    task.doLast {
        ant.checksum(algorithm: 'SHA-512', file: it.archivePath)
    }
}
tasks.withType(Tar) { task ->
    task.doLast {
        ant.checksum(algorithm: 'SHA-512', file: it.archivePath)
    }
}

tasks.withType(Tar) {
    compression = Compression.GZIP
    extension = "tar.gz"
}

[distZip, distTar]*.shouldRunAfter compileJava, updateVersion, jar

jar {
    manifest {
        attributes(
            'SplashScreen-Image': 'mediathek/res/splash.png',
            'Main-Class': mainClass,
            'Class-Path': configurations.runtime.files.collect { "lib/$it.name" }.join(' ')
        )
    }
    archiveName = jarName
}

distributions {
    main {
        baseName = 'MediathekView'
        contents {
            into('lib') {
                from configurations.compile
            }
            from('res') {
                filesMatching('**/*.txt') {
                    filter(ReplaceTokens, tokens: [JARNAME: jarName])
                }
                filesMatching('**/*.sh') {
                    filter(ReplaceTokens, tokens: [JARNAME: jarName])
                }
            }
            from('build/libs') {
                include '*.jar'
            }
        }
    }
}

/**
 * This is how you pass arguments: "./gradlew run -Pargs=arg1,arg2,arg3
 */
task run(type: JavaExec, dependsOn: classes) {
    main = mainClass
    classpath = sourceSets.main.runtimeClasspath

    if (project.hasProperty('args')) {
        args(project.args.split(','))
    }

}

/**
 * HOWTO debug:
 *  1. run "gradle debug"
 *  2. Call your IDE to connect to a remote java application on port 5005.
 *
 * This is how you pass arguments: "./gradlew debug -Pargs=arg1,arg2,arg3
 */
task debug(type: JavaExec, dependsOn: classes) {
    main = mainClass
    classpath = sourceSets.main.runtimeClasspath
    debug true

    if (project.hasProperty('args')) {
        args(project.args.split(','))
    }
}