view build.gradle @ 26:42ecbd9364fa

gradle
author oshiroo
date Wed, 28 Nov 2018 17:34:23 +0900
parents
children 12633f67f3cf
line wrap: on
line source


apply plugin:'java'


sourceCompatibility = 1.11
targetCompatibility = 1.11
version = '0.1.0'

project.ext.baseName = 'wifibroadcast'

defaultTasks 'clean', 'dist'





def manifestAttributes = ['Main-Class': 'jp.ac.uryukyu.ie.kono.wifibroadcast.WifiBroadcast',
        'Implementation-Version': "${project.version} (${buildNo})",
        'Implementation-Title': 'WifiBroadcast',
        'Implementation-Vendor': 'uryukyu']

jar {
    baseName = project.baseName
    version = null
    manifest {
        attributes manifestAttributes
    }
    def runtimeDeps = configurations.viewerSwingRuntime.collect {
        it.isDirectory() ? it : zipTree(it)
    }
    from(runtimeDeps) {
        exclude 'META-INF/**'
    }
}




task noSshJar (type: Jar, dependsOn: classes) {
    baseName = 'nossh/' + project.baseName
    version = null
    manifest {
        attributes manifestAttributes
    }
    from sourceSets.main.output
}

artifacts {
    archives file('src/web/viewer-applet-example.html')
    archives noSshJar
}

uploadArchives {
    repositories {
        
    }
	uploadDescriptor = false
}

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]
}

// set mainclass to Application Plugin
mainClassName = 'com.glavsoft.viewer.TreeViewer'
applicationName = 'TreeVNC'