-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.gradle
158 lines (131 loc) · 4.76 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
148
149
150
151
152
153
154
155
156
157
158
buildscript {
ext.repos = {
mavenLocal()
mavenCentral()
google()
}
repositories repos
}
plugins {
id 'org.owasp.dependencycheck' version '6.5.3' apply false
id 'com.github.ben-manes.versions' version '0.42.0' apply false
id('io.github.gradle-nexus.publish-plugin') version '1.1.0'
}
ext {
junitJupiterVersion = '5.10.2'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def javaLibraryProjects() {
subprojects.findAll { new File(it.projectDir, 'build.gradle').file }
}
allprojects {
// skip checking test configurations (like lint) or test libraries for vulnerabilities
apply plugin: 'org.owasp.dependencycheck'
buildscript {
repositories repos
}
repositories repos
configurations.all {
// Check for updates every build
// A module with a *-SNAPSHOT version coming from a Maven repository will be considered changing by default.
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
dependencyCheck {
failOnError = false // let's ignore errors to make builds more stable
analyzedTypes = ['jar'] // the default artifact types that will be analyzed.
// OWASP Dependency Check plugin for Jenkins needs an XML report, but humans may also need an HTML one
format = 'ALL'
// Specifies if the build should be failed if a CVSS score equal to or above a specified level is identified.
failBuildOnCVSS = 7
// specify a list of known issues which contain false-positives
suppressionFiles = ["$rootDir/dependencycheck-root-suppression.xml"]
}
}
configure(javaLibraryProjects()) {
apply plugin: 'java-library'
apply plugin: 'com.github.ben-manes.versions'
}
configure(javaLibraryProjects()) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories repos
java {
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.java
groupId "$group"
artifactId "$project.ext.artifactId"
version "$version"
pom {
name = "$project.ext.artifactName"
description = "$project.ext.artifactDescription"
url = 'https://github.com/skjolber/ndef-tools-for-android'
organization {
name = 'Thomas Rorvik Skjolberg'
url = 'https://github.com/skjolber'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/skjolber/ndef-tools-for-android/issues'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/skjolber/ndef-tools-for-android'
connection = 'scm:[email protected]:skjolber/ndef-tools-for-android.git'
developerConnection = 'scm:[email protected]:skjolber/ndef-tools-for-android.git'
}
developers {
developer {
id = 'skjolber'
name = 'Thomas Rørvik Skjølberg'
}
}
}
}
}
if(project.hasProperty("signing.gnupg.keyName")) {
signing {
useGpgCmd()
// set
// signing.gnupg.keyName=xxx
// signing.gnupg.passphrase=yyy
// via command line or global gradle properties
// then run
// w17 build publishToSonatype --info --stacktrace
sign(publishing.publications)
}
}
}
test {
useJUnitPlatform {
includeEngines 'junit-jupiter', 'junit-vintage'
}
}
dependencies {
// JUnit Jupiter API and TestEngine implementation
testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}")
}
}
nexusPublishing {
repositories {
sonatype()
}
}