diff build.gradle @ 52:472a9bcacb21 draft default tip

TightVNC 2.7.1.0
author you@cr.ie.u-ryukyu.ac.jp
date Wed, 07 Aug 2013 19:01:17 +0900
parents 4689cc86d6cb
children
line wrap: on
line diff
--- a/build.gradle	Tue Jul 03 13:20:49 2012 +0900
+++ b/build.gradle	Wed Aug 07 19:01:17 2013 +0900
@@ -3,15 +3,16 @@
 
 sourceCompatibility = 1.6
 targetCompatibility = 1.6
-version = '2.5.0'
+version = '2.7.2'
 
-baseName = 'tightvnc-jviewer'
+project.ext.baseName = 'tightvnc-jviewer'
+def buildNo = processBuildNo(version)
 
 defaultTasks 'clean', 'dist'
 
 configurations {
-	viewerSwingCompile { extendsFrom compile }
-	viewerSwingRuntime { extendsFrom viewerSwingCompile, runtime }
+    viewerSwingCompile { extendsFrom compile }
+    viewerSwingRuntime { extendsFrom viewerSwingCompile, runtime }
 }
 
 sourceSets {
@@ -29,46 +30,102 @@
 	}
 }
 
+repositories {
+	flatDir {
+		dirs 'src/libs/'
+	}
+}
+
+dependencies {
+    viewerSwingCompile group: 'com.jcraft', name: 'jsch', version: '0.1.+', ext: 'jar'
+    viewerSwingRuntime configurations.viewerSwingCompile
+    testCompile group: 'junit', name: 'junit', version: '4.+'
+}
+
+def manifestAttributes = ['Main-Class': 'com.glavsoft.viewer.Viewer',
+        'Implementation-Version': "${project.version} (${buildNo})",
+        'Implementation-Title': 'TightVNC Viewer',
+        'Implementation-Vendor': 'GlavSoft LLC.']
+
 jar {
-	baseName = project.baseName
-	version = null
+    baseName = project.baseName
+    version = null
     manifest {
-        attributes 'Main-Class': 'com.glavsoft.viewer.Viewer'
-        attributes 'Implementation-Version': "${project.version}"
+        attributes manifestAttributes
+    }
+    def runtimeDeps = configurations.viewerSwingRuntime.collect {
+        it.isDirectory() ? it : zipTree(it)
+    }
+    from(runtimeDeps) {
+        exclude 'META-INF/**'
     }
 }
 
-repositories {
-    mavenCentral()
+task noSshJar (type: Jar, dependsOn: classes) {
+    baseName = 'nossh/' + project.baseName
+    version = null
+    manifest {
+        attributes manifestAttributes
+    }
+    from sourceSets.main.output
 }
 
-dependencies {
-    testCompile group: 'junit', name: 'junit', version: '4.+'
-    archives fileTree(dir: 'src/web', include: '*.html')
+artifacts {
+    archives file('src/web/viewer-applet-example.html')
+    archives noSshJar
 }
 
 uploadArchives {
     repositories {
-		add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
-			name = 'repo'
-			addArtifactPattern "$projectDir/dist/${project.baseName}-${project.version}/${project.baseName}.[ext]"
-			descriptor = 'optional'
-			checkmodified = true
-		}
-	}
+        add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
+            addArtifactPattern("$projectDir/dist/${project.baseName}-${project.version}/[artifact].[ext]")
+        }
+    }
 	uploadDescriptor = false
 }
 
-task dist(dependsOn: uploadArchives) << {
-	otherFilesUpload("$projectDir/dist/${project.baseName}-${project.version}")
-}
-def otherFilesUpload(repoDir) {
-	copy {
-		from 'src/web'
-		include '*-applet-*.html'
-		expand (['archive_name' : project.baseName])
-		into repoDir
-	}
+task dist(dependsOn: uploadArchives)
+
+def processBuildNo(currentVersion) {
+    final String VERSION = 'version'
+    final String BUILD = 'build'
+
+    def lastVersion = currentVersion
+    def lastBuild = 0
+    def buildNoFile = new File('.build_no')
+    if ( ! buildNoFile.exists()) {
+        buildNoFile.createNewFile()
+        buildNoFile << "${VERSION}=${lastVersion}\n${BUILD}=${lastBuild}"
+    }
+    def versions = [:]
+    buildNoFile.eachLine {
+        def splitted = it.split('=')
+        if (splitted.size() == 2) {
+            def (key, value) = splitted
+            switch(key.trim()) {
+                case VERSION:
+                    lastVersion = value.trim()
+                    break
+                case BUILD:
+                    try {
+                        lastBuild = value != null ? value.trim() as Integer : 0
+                    } catch (NumberFormatException) {}
+                    versions[lastVersion] = lastBuild
+                    break
+            }
+        }
+    }
+    lastVersion = versions[currentVersion]
+    if (null == lastVersion) {
+        versions[currentVersion] = 0
+    }
+    ++versions[currentVersion]
+    def outString = ''
+    versions.each { v, b ->
+        outString += "${VERSION}=${v}\n${BUILD}=${b}\n\n"
+    }
+    buildNoFile.write(outString)
+    versions[currentVersion]
 }
 
 
@@ -385,3 +442,50 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+