-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
147 lines (129 loc) · 4.84 KB
/
build.gradle
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
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "com.github.jk1.dependency-license-report" version "1.17"
id "net.saliman.properties" version "1.5.2"
id "io.snyk.gradle.plugin.snykplugin" version "0.4"
}
group = "com.marklogic"
version = "2.8.0"
java {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
taskGroup = project.name
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
api 'com.marklogic:marklogic-client-api:6.6.0'
implementation 'org.slf4j:slf4j-api:2.0.13'
testImplementation 'com.marklogic:marklogic-junit5:1.4.0'
// Forcing Spring to use logback instead of commons-logging
testImplementation "ch.qos.logback:logback-classic:1.3.14" // Not using 1.4.x yet as it requires Java 11
testImplementation 'org.slf4j:jcl-over-slf4j:2.0.13'
testImplementation 'org.slf4j:slf4j-api:2.0.13'
}
test {
useJUnitPlatform()
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc
}
javadoc.failOnError = false
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
task generatePomForDependencyGraph(dependsOn: "generatePomFileForMainJavaPublication") {
description = "Prepare for a release by making a copy of the generated pom file in the root directory so that it " +
"can enable Github's Dependency Graph feature, which does not yet support Gradle"
doLast {
def preamble = '<?xml version="1.0" encoding="UTF-8"?>'
def comment = "<!--\n" +
"This file was generated via Gradle and is being used primarily for github's Dependency Graph feature.\n" +
"It is not intended to be used to build this project.\n" +
"-->"
def fileText = file("build/publications/mainJava/pom-default.xml").getText()
file("pom.xml").setText(fileText.replace(preamble, preamble + comment))
}
}
publishing {
publications {
mainJava(MavenPublication) {
pom {
name = "${group}:${project.name}"
description = "Reusable components that depend solely on MarkLogic's DMSDK"
packaging = "jar"
url = "https://github.com/marklogic-community/${project.name}"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "marklogic"
name = "MarkLogic Github Contributors"
email = "[email protected]"
organization = "MarkLogic"
organizationUrl = "https://www.marklogic.com"
}
}
scm {
url = "[email protected]:marklogic-community/${project.name}.git"
connection = "scm:[email protected]:marklogic-community/${project.name}.git"
developerConnection = "scm:[email protected]:marklogic-community/${project.name}.git"
}
}
from components.java
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
name = "central"
url = mavenCentralUrl
credentials {
username mavenCentralUsername
password mavenCentralPassword
}
}
}
}
task copyTableauSourceFiles(type: Copy, group: taskGroup) {
description = "Copy Tableau-dependent source files into the main source directory so they can be compiled and packaged into a jar for publishing. " +
"You'll first need to add the Tableau jars to the 'dependencies' block as described in src/tableau/README.md ."
from "src/tableau/main/java"
into "src/main/java"
}
task createTableauPublication(group: taskGroup) {
description = "Publish a version of ${project.name} that includes the Tableau-dependent source files under src/tableau/main/java"
dependsOn = ["copyTableauSourceFiles", "publishToMavenLocal"]
doLast {
println "Version ${version} of ${project.name} has been published to your local Maven repository, which defaults to ~/.m2/repository."
println "You can depend on this artifact in another Gradle project by adding mavenLocal() to your list of repositories."
}
}
publishToMavenLocal.mustRunAfter copyTableauSourceFiles
// See https://github.com/snyk/gradle-plugin for more information
snyk {
//arguments = '--all-sub-projects'
severity = 'low'
api = snykToken
autoDownload = true
autoUpdate = true
}