|
| 1 | +def seleniumVersion = '3.8.1' |
| 2 | +ext['selenium.version'] = seleniumVersion |
| 3 | + |
| 4 | +apply plugin: 'org.springframework.boot' |
| 5 | + |
| 6 | +dependencies { |
| 7 | + compile project(":core") |
| 8 | + compile "com.beust:jcommander:1.72" |
| 9 | + compile "com.google.code.gson:gson:2.8.2" |
| 10 | + compile "ch.qos.logback:logback-classic:1.2.3" |
| 11 | + testCompile "junit:junit:4.12" |
| 12 | + testCompile "org.mockito:mockito-core:2.13.0" |
| 13 | + testCompile "org.hamcrest:hamcrest-core:1.3" |
| 14 | + testCompile "org.hamcrest:hamcrest-library:1.3" |
| 15 | + testCompile "com.github.stefanbirkner:system-rules:1.17.0" |
| 16 | +} |
| 17 | + |
| 18 | +bootJar { |
| 19 | + enabled = true |
| 20 | +} |
| 21 | + |
| 22 | +test { |
| 23 | + testLogging { |
| 24 | + exceptionFormat = 'full' |
| 25 | + showStandardStreams = true |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +task javadocJar(type: Jar, dependsOn: javadoc) { |
| 30 | + baseName = 'jlineup' |
| 31 | + classifier = 'javadoc' |
| 32 | + from 'build/docs/javadoc' |
| 33 | +} |
| 34 | + |
| 35 | +task sourcesJar(type: Jar) { |
| 36 | + baseName = 'jlineup' |
| 37 | + from sourceSets.main.allSource |
| 38 | + classifier = 'sources' |
| 39 | +} |
| 40 | + |
| 41 | +bootJar { |
| 42 | + baseName = "jlineup" |
| 43 | + archiveName = "jlineup.jar" |
| 44 | + mainClassName = 'de.otto.jlineup.cli.Main' |
| 45 | + launchScript() |
| 46 | +} |
| 47 | + |
| 48 | +artifacts { |
| 49 | + archives sourcesJar |
| 50 | + archives javadocJar |
| 51 | + archives bootJar |
| 52 | +} |
| 53 | + |
| 54 | +[distZip, bootDistZip, distTar, bootDistTar].each { task -> |
| 55 | + configurations.archives.artifacts.removeAll |
| 56 | + { it.class.simpleName == "ArchivePublishArtifact" && it.archiveTask == task } |
| 57 | + task.enabled = false |
| 58 | +} |
| 59 | + |
| 60 | +signing { |
| 61 | + sign configurations.archives |
| 62 | +} |
| 63 | + |
| 64 | +tasks.processResources.doLast { task -> |
| 65 | + def resourcesDir = project.sourceSets.main.output.resourcesDir |
| 66 | + resourcesDir.mkdirs() |
| 67 | + |
| 68 | + def versionProperties = new File(resourcesDir, "version.properties") |
| 69 | + if (versionProperties) { |
| 70 | + def gitVersion = runCommand("git log -n1 --format=format:%H") |
| 71 | + def fullVersion = version |
| 72 | + versionProperties.text = "\njlineup.commit = ${gitVersion}" + "\njlineup.version = ${fullVersion}" |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +uploadArchives { |
| 77 | + configuration = configurations.archives |
| 78 | + repositories { |
| 79 | + mavenDeployer { |
| 80 | + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
| 81 | + |
| 82 | + // use this for local upload debugging instead of sonatype |
| 83 | + //repository(url: "file://${buildDir}/repo") |
| 84 | + //snapshotRepository(url: "file://${buildDir}/repo") |
| 85 | + |
| 86 | + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { |
| 87 | + authentication(userName: sonatypeUsername, password: sonatypePassword) |
| 88 | + } |
| 89 | + |
| 90 | + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { |
| 91 | + authentication(userName: sonatypeUsername, password: sonatypePassword) |
| 92 | + } |
| 93 | + |
| 94 | + pom.project { |
| 95 | + name 'JLineup' |
| 96 | + packaging 'jar' |
| 97 | + description 'Webapp image comparison tool' |
| 98 | + url 'http://github.com/otto-de/jlineup' |
| 99 | + |
| 100 | + scm { |
| 101 | + url 'scm:[email protected]:otto-de/jlineup.git' |
| 102 | + connection 'scm:[email protected]:otto-de/jlineup.git' |
| 103 | + } |
| 104 | + |
| 105 | + licenses { |
| 106 | + license { |
| 107 | + name 'The Apache Software License, Version 2.0' |
| 108 | + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 109 | + } |
| 110 | + } |
| 111 | + |
| 112 | + developers { |
| 113 | + developer { |
| 114 | + id 'mgeweke' |
| 115 | + name 'Marco Geweke' |
| 116 | + url 'https://github.com/MediaMarco' |
| 117 | + } |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | +} |
| 123 | + |
| 124 | +static String runCommand(command) { |
| 125 | + Process proc = command.execute() |
| 126 | + def out = new StringBuffer() |
| 127 | + proc.consumeProcessOutputStream(out) |
| 128 | + proc.consumeProcessErrorStream(out) |
| 129 | + proc.waitFor() |
| 130 | + def errorlevel = proc.exitValue() |
| 131 | + if (errorlevel != 0) { |
| 132 | + throw new RuntimeException("exec failed on command: '${command}' with errorlevel ${errorlevel}".toString()) |
| 133 | + } |
| 134 | + out.toString().trim() |
| 135 | +} |
0 commit comments