|
| 1 | +import java.time.LocalDateTime |
| 2 | + |
| 3 | +apply plugin: 'java' |
| 4 | +apply plugin: 'maven-publish' |
| 5 | +apply plugin: 'signing' |
| 6 | +apply plugin: "io.github.gradle-nexus.publish-plugin" |
| 7 | + |
| 8 | +buildscript { |
| 9 | + repositories { |
| 10 | + maven { |
| 11 | + url "https://plugins.gradle.org/m2/" |
| 12 | + } |
| 13 | + } |
| 14 | + dependencies { |
| 15 | + classpath "io.github.gradle-nexus:publish-plugin:1.1.0" |
| 16 | + classpath "com.dipien:semantic-version-gradle-plugin:1.4.1" |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | + |
| 21 | +sourceCompatibility = 1.8 |
| 22 | +targetCompatibility = 1.8 |
| 23 | + |
| 24 | +group 'com.github.sidhant92' |
| 25 | +version = "1.0.0" |
| 26 | + |
| 27 | +apply plugin: "com.dipien.semantic-version" |
| 28 | + |
| 29 | +repositories { |
| 30 | + mavenCentral() |
| 31 | +} |
| 32 | + |
| 33 | +dependencies { |
| 34 | + testImplementation group: 'junit', name: 'junit', version: '4.12' |
| 35 | + |
| 36 | + implementation 'ch.qos.logback:logback-classic:1.2.3' |
| 37 | + implementation 'ch.qos.logback.contrib:logback-json-classic:0.1.5' |
| 38 | + implementation 'ch.qos.logback.contrib:logback-jackson:0.1.5' |
| 39 | + implementation 'net.logstash.logback:logstash-logback-encoder:5.2' |
| 40 | + implementation 'org.apache.maven:maven-artifact:3.5.2' |
| 41 | + implementation 'org.antlr:antlr4-runtime:4.11.1' |
| 42 | + implementation 'io.vavr:vavr:0.10.4' |
| 43 | + |
| 44 | + compileOnly 'org.projectlombok:lombok:1.18.26' |
| 45 | + annotationProcessor 'org.projectlombok:lombok:1.18.26' |
| 46 | + |
| 47 | + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.2' |
| 48 | + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.2' |
| 49 | + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.3.3' |
| 50 | + testImplementation group: 'org.mock-server', name: 'mockserver-junit-jupiter', version: '5.10.0' |
| 51 | +} |
| 52 | + |
| 53 | +test { |
| 54 | + testLogging { |
| 55 | + events "passed", "skipped", "failed" |
| 56 | + } |
| 57 | + useJUnitPlatform() |
| 58 | + reports { |
| 59 | + junitXml.enabled = true |
| 60 | + html.enabled = false |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +java { |
| 65 | + withJavadocJar() |
| 66 | + withSourcesJar() |
| 67 | +} |
| 68 | + |
| 69 | +artifacts { |
| 70 | + archives javadocJar, sourcesJar |
| 71 | +} |
| 72 | + |
| 73 | +/*signing { |
| 74 | + sign configurations.archives |
| 75 | +}*/ |
| 76 | + |
| 77 | +signing { |
| 78 | + def signingKey = findProperty("signingKey") |
| 79 | + def signingPassword = findProperty("signingPassword") |
| 80 | + useInMemoryPgpKeys(signingKey, signingPassword) |
| 81 | + sign publishing.publications |
| 82 | +} |
| 83 | + |
| 84 | +publishing { |
| 85 | + publications { |
| 86 | + mavenJava(MavenPublication) { |
| 87 | + from(components.java) |
| 88 | + pom { |
| 89 | + name = 'bool-parser' |
| 90 | + description = 'Java parser for boolean expressions' |
| 91 | + url = 'https://github.com/sidhant92/bool-parser' |
| 92 | + licenses { |
| 93 | + license { |
| 94 | + name = 'The Apache License, Version 2.0' |
| 95 | + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 96 | + } |
| 97 | + } |
| 98 | + developers { |
| 99 | + developer { |
| 100 | + id = 'sidhant92' |
| 101 | + name = 'Sidhant Aggarwal' |
| 102 | + } |
| 103 | + } |
| 104 | + scm { |
| 105 | + url = 'https://github.com/sidhant92/bool-parser' |
| 106 | + connection = 'scm:git://github.com/sidhant92/bool-parser.git' |
| 107 | + developerConnection = 'scm:git://github.com/sidhant92/bool-parser.git' |
| 108 | + } |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +nexusPublishing { |
| 115 | + repositories { |
| 116 | + sonatype() |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +ext.genOutputDir = file("$buildDir/generated-resources") |
| 121 | + |
| 122 | +task generateVersionTxt() { |
| 123 | + ext.outputFile = file("$genOutputDir/version.txt") |
| 124 | + outputs.file(outputFile) |
| 125 | + doLast { |
| 126 | + outputFile.text = """GroupId: ${project.group} |
| 127 | +Name: ${project.name} |
| 128 | +Version: $version |
| 129 | +Build-time: ${LocalDateTime.now()} |
| 130 | +""" |
| 131 | + } |
| 132 | +} |
| 133 | + |
| 134 | +sourceSets.main.output.dir genOutputDir, builtBy: generateVersionTxt |
0 commit comments