1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
Description: patching build.gradle to perform a build with Debian packages
Author: Olivier Sallou <osallou@debian.org>
Forwarded: not-needed
Last-Update: 2022-05-25
--- a/build.gradle
+++ b/build.gradle
@@ -1,25 +1,30 @@
plugins {
- id "java-library"
+ id 'java'
id 'maven-publish'
id 'signing'
- id 'jacoco'
- id 'com.palantir.git-version' version '0.5.1' //version helper
}
wrapper {
gradleVersion = '8.12'
}
-java {
- toolchain {
- languageVersion = JavaLanguageVersion.of(21)
- }
-}
+sourceCompatibility = 1.21
+targetCompatibility = 1.21
group = 'org.broadinstitute'
final isRelease = Boolean.getBoolean("release")
-version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".dirty", "")
+def getDebianVersion() {
+ def dpkgStdOut = new ByteArrayOutputStream()
+ exec {
+ commandLine "dpkg-parsechangelog", "-S", "Version"
+ standardOutput = dpkgStdOut
+ }
+ return dpkgStdOut.toString().trim().replaceFirst(/(-gradle)?([+]dfsg[.0-9]*)?-[^-]+$/, "")
+}
+
+version = getDebianVersion()
+//version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".dirty", "")
repositories {
mavenCentral()
@@ -30,38 +35,25 @@
mavenLocal()
}
-jacocoTestReport {
- getAdditionalSourceDirs().from(sourceSets.main.allJava.srcDirs)
-
- dependsOn test
- group = "Reporting"
- description = "Generate Jacoco coverage reports after running tests."
-
- reports {
- xml.required = true // codecov plugin depends on xml format report
- html.required = true
- }
-}
-
compileJava {
- options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
+ options.compilerArgs = ['-proc:none', '-Xlint:all','-Xdiags:verbose', '-source', '21', '-target', '21']
}
compileTestJava {
- options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
+ options.compilerArgs = ['-proc:none', '-Xlint:all','-Xdiags:verbose', '-source', '21', '-target', '21']
}
dependencies {
- api 'net.sf.jopt-simple:jopt-simple:5.0.3'
- api 'com.google.code.gson:gson:2.8.9'
- api 'org.freemarker:freemarker:2.3.30'
+ implementation 'net.sf.jopt-simple:jopt-simple:5.0.3'
+ implementation 'com.google.code.gson:gson:2.8.9'
+ implementation 'org.freemarker:freemarker:2.3.30'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.17.1'
testImplementation 'commons-io:commons-io:2.11.0'
- testImplementation 'org.testng:testng:7.7.0'
+ testImplementation 'org.testng:testng:debian'
testImplementation 'org.mockito:mockito-core:4.6.1'
}
@@ -94,19 +86,18 @@
}
-tasks.register('javadocJar', Jar) {
- dependsOn javadoc
- archiveClassifier = 'javadoc'
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
from 'build/docs/javadoc'
}
-tasks.register('sourcesJar', Jar) {
+task sourcesJar(type: Jar) {
from sourceSets.main.allSource
- archiveClassifier = 'sources'
+ classifier = 'sources'
}
// This is a hack to disable the default javadoc lint until we fix the html formatting
-tasks.withType(Javadoc).configureEach {
+tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
@@ -119,14 +110,6 @@
archives sourcesJar
}
-/**
- * Sign non-snapshot releases with our secret key. This should never need to be invoked directly.
- */
-signing {
- required = (isRelease && gradle.taskGraph.hasTask("publish"))
- sign publishing.publications
-}
-
def basePomConfiguration = {
packaging = 'jar'
description = 'Barclay command line parsing and documentation utilities'
@@ -155,35 +138,3 @@
}
}
-/**
- * Upload a release to sonatype. You must be an authorized uploader and have your sonatype
- * username and password information in your gradle properties file. See the readme for more info.
- *
- * For releasing to your local maven repo, use gradle publishToMavenLocal
- */
-publishing {
- publications {
- barclay(MavenPublication) {
- from components.java
- artifactId = "barclay"
- pom basePomConfiguration
- pom.name = "Barclay"
-
- artifact javadocJar
- artifact sourcesJar
- }
- }
-
- repositories {
- maven {
- name = isRelease ? "SonaType" : "Artifactory"
- url = isRelease ? "https://oss.sonatype.org/service/local/staging/deploy/maven2/" : "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/"
- credentials {
- username = isRelease ? project.findProperty("sonatypeUsername") : System.env.ARTIFACTORY_USERNAME
- password = isRelease ? project.findProperty("sonatypePassword") : System.env.ARTIFACTORY_PASSWORD
- }
- }
- }
-}
-
-
|