comparison build.gradle @ 26:42ecbd9364fa

gradle
author oshiroo
date Wed, 28 Nov 2018 17:34:23 +0900
parents
children 12633f67f3cf
comparison
equal deleted inserted replaced
25:a17e8b4ffe75 26:42ecbd9364fa
1
2 apply plugin:'java'
3
4
5 sourceCompatibility = 1.11
6 targetCompatibility = 1.11
7 version = '0.1.0'
8
9 project.ext.baseName = 'wifibroadcast'
10
11 defaultTasks 'clean', 'dist'
12
13
14
15
16
17 def manifestAttributes = ['Main-Class': 'jp.ac.uryukyu.ie.kono.wifibroadcast.WifiBroadcast',
18 'Implementation-Version': "${project.version} (${buildNo})",
19 'Implementation-Title': 'WifiBroadcast',
20 'Implementation-Vendor': 'uryukyu']
21
22 jar {
23 baseName = project.baseName
24 version = null
25 manifest {
26 attributes manifestAttributes
27 }
28 def runtimeDeps = configurations.viewerSwingRuntime.collect {
29 it.isDirectory() ? it : zipTree(it)
30 }
31 from(runtimeDeps) {
32 exclude 'META-INF/**'
33 }
34 }
35
36
37
38
39 task noSshJar (type: Jar, dependsOn: classes) {
40 baseName = 'nossh/' + project.baseName
41 version = null
42 manifest {
43 attributes manifestAttributes
44 }
45 from sourceSets.main.output
46 }
47
48 artifacts {
49 archives file('src/web/viewer-applet-example.html')
50 archives noSshJar
51 }
52
53 uploadArchives {
54 repositories {
55
56 }
57 uploadDescriptor = false
58 }
59
60 task dist(dependsOn: uploadArchives)
61
62 def processBuildNo(currentVersion) {
63 final String VERSION = 'version'
64 final String BUILD = 'build'
65
66 def lastVersion = currentVersion
67 def lastBuild = 0
68 def buildNoFile = new File('.build_no')
69 if ( ! buildNoFile.exists()) {
70 buildNoFile.createNewFile()
71 buildNoFile << "${VERSION}=${lastVersion}\n${BUILD}=${lastBuild}"
72 }
73 def versions = [:]
74 buildNoFile.eachLine {
75 def splitted = it.split('=')
76 if (splitted.size() == 2) {
77 def (key, value) = splitted
78 switch(key.trim()) {
79 case VERSION:
80 lastVersion = value.trim()
81 break
82 case BUILD:
83 try {
84 lastBuild = value != null ? value.trim() as Integer : 0
85 } catch (NumberFormatException) {}
86 versions[lastVersion] = lastBuild
87 break
88 }
89 }
90 }
91 lastVersion = versions[currentVersion]
92 if (null == lastVersion) {
93 versions[currentVersion] = 0
94 }
95 ++versions[currentVersion]
96 def outString = ''
97 versions.each { v, b ->
98 outString += "${VERSION}=${v}\n${BUILD}=${b}\n\n"
99 }
100 buildNoFile.write(outString)
101 versions[currentVersion]
102 }
103
104 // set mainclass to Application Plugin
105 mainClassName = 'com.glavsoft.viewer.TreeViewer'
106 applicationName = 'TreeVNC'