buildscript { dependencies { classpath fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') } } repositories { maven { url 'http://maven.ej-technologies.com/repository' } } configurations { providedCompile } dependencies { compile project(":deployment") compile fileTree('vendor') { include '*.jar' exclude '*-sources.jar' } providedCompile files('vendor/install4j-runtime-6.0.4.jar') } dependencies { // Note: uncomment and move into 'plugins' directory if you change it //vendor 'com.install4j:gradle-plugin:6.0.4' // These are actually provided via install4j, but, you'll need them to // create the custom actions. vendor 'com.install4j:install4j-runtime:6.0.4' vendor 'com.install4j:install4j-runtime:6.0.4:sources' } jar { archiveName "hws-install4j.jar" manifest { // attributes("Main-Class": "com.perforce.hws.server.HelixWebServices" ) } from { (configurations.runtime - configurations.providedCompile).collect { it.isDirectory() ? it : zipTree(it) } } } apply plugin: 'install4j' install4j { if (System.getProperty("os.name").contains("Mac OS X")) { installDir = file('/Applications/install4j.app/Contents/Resources/app') } else { installDir = file('/opt/install4j6') } } // I completely suck ass with groovy. // These methods are used for grabbing the version string. // See the VersionFileMethods utility class in the automation project. Maybe // we can just call it instead? // // TODO: Move these methods into a "helper" location, out of this build file String parseVersionValue(line) { def matcher = line =~ /.* = (.*) ;/ if (matcher.matches()) { return matcher.group(1).trim() } else { println "did not match " + line } } Map parseVersionFile(text) { def versionInfo = [:] text.eachLine { li -> if (li.startsWith("RELEASE")) { versionInfo.put("RELEASE", parseVersionValue(li)) } else if (li.startsWith("PATCHLEVEL")) { versionInfo.put("PATCHLEVEL", parseVersionValue(li)) } else if (li.startsWith("SUPPDATE")) { versionInfo.put("SUPPDATE", parseVersionValue(li)) } } def releaseParts = versionInfo["RELEASE"].split("\\s+") def releaseNumBits = [releaseParts[0], releaseParts[1]] versionInfo["productVersion"] = releaseNumBits.join(".") return versionInfo } String changelist() { def versionFile = file('../../../p4/Version') if (versionFile.exists()) { parseVersionFile(versionFile.text)["PATCHLEVEL"] } else { "9999999" } } task(printVersion) << { println productVersion() } task media(type: com.install4j.gradle.Install4jTask) { projectFile = file('hws.install4j') variables = [ sourceDir: file('..').canonicalPath, docArchiveDir: file('../../../../../builds/main/p4-bin/doc/internal').canonicalPath, productVersion: '2016.1.0', p4DocUserDir: file('../../../p4-doc/user').canonicalPath, changelist: changelist() ] dependsOn ':server:jar', ':deployment:jar', ':client-ruby:gem', ':client-javascript:gulpBuild' }