File: build.gradle

package info (click to toggle)
gkl 0.8.10%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,368 kB
  • sloc: ansic: 62,328; asm: 42,421; cpp: 3,910; sh: 2,869; java: 1,959; ada: 1,681; pascal: 1,456; makefile: 1,022; xml: 106; perl: 104; python: 81
file content (227 lines) | stat: -rw-r--r-- 7,379 bytes parent folder | download
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
plugins {
    id 'java'
    id 'maven'
    id 'signing'
}

compileJava {
    options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
}
compileTestJava {
    options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://artifactory.broadinstitute.org/artifactory/libs-snapshot/" }
}

dependencies {
    compile 'commons-io:commons-io:2.7'
    compile 'org.broadinstitute:gatk-native-bindings:1.0.0'
    compile 'commons-logging:commons-logging:1.2'
    compile 'com.github.samtools:htsjdk:2.21.1'
    testCompile 'org.testng:testng:7.4.0'
}

 wrapper {
    gradleVersion = '5.6'
}

//===================================================================
// build
//===================================================================
final nativeBuildDir = "$buildDir/native"

task cmakeConfig(type: Exec) {
    // hide stdout, but print stderr
    standardOutput = new ByteArrayOutputStream()
    doFirst {mkdir nativeBuildDir}
    workingDir nativeBuildDir
    commandLine 'cmake', '-Wno-dev', projectDir
    inputs.files fileTree(projectDir) {include '**/CMakeLists.txt'}
    outputs.files "$nativeBuildDir/Makefile"
}

task cmakeBuild(type: Exec) {
    def soCompression = file("$nativeBuildDir/libgkl_compression.so")
    // hide stdout, but print stderr
    standardOutput = new ByteArrayOutputStream()
    workingDir nativeBuildDir
    //Run only if we never executed copyNativeLib.
    if (!soCompression.exists()) commandLine 'make', 'install'
    else commandLine 'true'
}

task copyNativeLib(type: Copy) {
    from nativeBuildDir
    into "$buildDir/classes/java/main/com/intel/gkl/native"
    include '*.so'
    include '*.dylib'
}

task buildOnMac(type: Exec) {
    String mac_host = project.ext.properties.mac_host ? project.ext.properties.mac_host : "gkl-mac"
    workingDir '.'
    commandLine 'scripts/buildOnMac.sh', mac_host
    onlyIf {project.hasProperty('mac') || project.hasProperty('mac_host') || gradle.taskGraph.hasTask(uploadArchives)}
}

compileJava.finalizedBy copyNativeLib
copyNativeLib.finalizedBy buildOnMac
copyNativeLib.dependsOn cmakeBuild
cmakeBuild.dependsOn cmakeConfig
test.dependsOn copyNativeLib
//===================================================================
// test
//===================================================================

test {
    def longTestsEnabled = System.getProperty('long_tests')

    def additionalJvmArgs = []

    if (longTestsEnabled != null){
        additionalJvmArgs.add '-Xmx24G'
    }
    useTestNG {
    }
    scanForTestClasses = false
    // propagate system properties to test JVM
    systemProperties = System.getProperties()

    if (project.hasProperty('debug')) {
        jvmArgs('-verbose:jni', '-Xcheck:jni', '-XX:+RestoreMXCSROnJNICalls', *additionalJvmArgs)
    }
    else {
        jvmArgs('-Xcheck:jni', '-XX:+RestoreMXCSROnJNICalls', *additionalJvmArgs)
    }

    testLogging {
        if (!System.env.CI.toString().toBoolean()) {
            events "passed", "skipped", "failed", "standardOut", "standardError"
        }
        afterSuite { desc, result ->
            if (!desc.parent) { // will match the outermost suite
                println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
            }
        }
    }

    // always rerun tests
    outputs.upToDateWhen { false }
}

//===================================================================
// release
//===================================================================

final isRelease = project.hasProperty("release")
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", "")

group = "com.intel.gkl"

jar {
    baseName = "gkl"
    // include LICENSE file in jar
    from "LICENSE"
    exclude('**/*.so')
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from 'build/docs/javadoc'
}

task sourcesJar(type: Jar) {
    from sourceSets.main.allSource
    classifier = 'sources'
}

artifacts {
    archives jar
    archives javadocJar
    archives sourcesJar
}

signing {
    required { isRelease && gradle.taskGraph.hasTask(uploadArchives) }
    sign configurations.archives
}

install.doFirst { println "Version: $version" }

uploadArchives {
    repositories {
        mavenDeployer {
            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

//            repository(url: uri('testMaven'))
            repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
                authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword"))
                proxy(host: "proxy-us.intel.com", port: 912, type: 'https')
            }

//            snapshotRepository(url: uri('testMavenSnapshot'))
            snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
                authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword"))
                proxy(host: "proxy-us.intel.com", port: 912, type: 'https')
            }

            pom.project {
                name 'Intel Genomics Kernel Library (GKL)'
                packaging 'jar'
                description 'Genomics compute kernels optimized for Intel Architecture'
                url 'https://github.com/Intel-HLS/GKL'
                scm {
                    connection 'scm:git@github.com:Intel-HLS/GKL.git'
                    developerConnection 'scm:git@github.com:Intel-HLS/GKL.git'
                    url 'scm:git@github.com:Intel-HLS/GKL.git'
                }
                licenses {
                    license {
                        name 'MIT License'
                        url 'https://opensource.org/licenses/MIT'
                        distribution 'repo'
                    }
                    license {
                        name 'BSD 3-Clause'
                        url 'https://opensource.org/licenses/BSD-3-Clause'
                        distribution 'repo'
                    }
                    license {
                        name 'Zlib License'
                        url 'https://opensource.org/licenses/Zlib'
                        distribution 'repo'
                    }

                }
                developers {
                    developer {
                        name = "Keith Mannthey"
                        email = "keith.mannthey@intel.com"
                    }
                    developer {
                        name = "Priya Vaidya"
                        email = "priya.n.vaidya@intel.com"
                    }
                    developer {
                        name = "Marissa Powers"
                        email = "marissa.e.powers@intel.com"
                    }
                }
            }
        }
    }
}