-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
197 lines (167 loc) · 6.25 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
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
/*
* Copyright 2018 Wooga GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import com.wooga.gradle.PlatformUtils
plugins {
id 'java-library'
id 'groovy'
id 'maven-publish'
id 'signing'
id 'nebula.release' version '17.2.2'
id 'jacoco'
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id 'net.wooga.snyk' version '0.13.0'
id "net.wooga.snyk-wdk-java" version "0.7.0"
id "net.wooga.cve-dependency-resolution" version "0.5.0"
}
group "net.wooga"
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
List<String> cliTasks = project.rootProject.gradle.startParameter.taskNames
if (cliTasks.contains("rc")) {
cliTasks.remove("rc")
cliTasks.add("candidate")
project.rootProject.gradle.startParameter.setTaskNames(cliTasks)
}
configurations {
rustLib {
transitive = false
}
}
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
}
dependencies {
rustLib project('rust')
testImplementation "org.codehaus.groovy:groovy-all:2.5.16"
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
testImplementation 'org.spockframework:spock-junit4:2.3-groovy-3.0'
testImplementation "com.wooga.spock.extensions:spock-unity-version-manager-extension:[0.4.0,4)"
}
cveHandler.configurations("compileClasspath", "testCompileClasspath", "testRuntimeClasspath")
snyk {
projectTags = ["team": "atlas", "component": "library", "platform": "jvm", "language": "java"]
//TODO: add when snyk adds rust support
// registerProject(file("rust/Cargo.toml")) {
// projectTags.put("platform", "jni")
// projectTags.put("language", "rust")
// projectEnvironment = "internal"
// }
//
registerProject(project.findProject(":rust")) {
projectEnvironment = "internal"
}
}
task collectLibs() {
dependsOn configurations.rustLib
doLast {
configurations.rustLib.resolve().each { artifact ->
copy {
from { artifact }
into file("${buildDir}/rustLibs/native")
}
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs += ["-h", file("${buildDir}/headers")]
}
sourceSets.main.resources {
srcDir(file("${buildDir}/rustLibs/native"))
}
processResources.dependsOn(collectLibs)
java {
sourceCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
publishing {
publications {
main(MavenPublication) {
from(components["java"])
pom {
name = 'Unity Version Manager JNI'
description = 'A JNI library to execute unity version manager from java.'
url = 'https://github.com/wooga/unity-version-manager-jni'
artifactId = project.name
inceptionYear = "2018"
scm {
connection = 'scm:git:https://github.com/wooga/unity-version-manager-jni.git'
developerConnection = 'scm:git:https://github.com/wooga/unity-version-manager-jni.git'
url = 'https://github.com/wooga/unity-version-manager-jni.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'manfred.endres'
name = 'Manfred Endres'
email = 'manfred.endres@wooga.net'
}
}
}
}
}
}
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : System.getenv('OSSRH_USERNAME')
password = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : System.getenv('OSSRH_PASSWORD')
}
}
}
signing {
def signingKeyId = project.hasProperty("signingKeyId") ? project.property('signingKeyId') : System.getenv('OSSRH_SIGNING_KEY_ID')
def signingKey = project.hasProperty("signingKey") ? project.property('signingKey') : System.getenv('OSSRH_SIGNING_KEY')
def signingPassword = project.hasProperty('signingPassphrase') ? project.property('signingPassphrase') : System.getenv("OSSRH_SIGNING_PASSPHRASE")
useInMemoryPgpKeys(signingKeyId.toString(), signingKey.toString(), signingPassword.toString())
sign publishing.publications.main
}
postRelease.dependsOn(tasks.publish)
afterEvaluate {
tasks."final".dependsOn(tasks.publishToSonatype, tasks.closeAndReleaseSonatypeStagingRepository)
tasks."candidate".dependsOn(tasks.publishToSonatype, tasks.closeAndReleaseSonatypeStagingRepository)
tasks.publishToSonatype.mustRunAfter(tasks.postRelease)
tasks.closeSonatypeStagingRepository.mustRunAfter(tasks.publishToSonatype)
tasks.publish.mustRunAfter(tasks.release)
println("check if running with rosseta2")
if(PlatformUtils.isMac()) {
def out = new ByteArrayOutputStream()
project.exec {
executable 'sysctl'
args '-n', '-i', 'sysctl.proc_translated'
//store the output instead of printing to the console:
standardOutput = out
}
println("runs on rosseta: ${out.toString().trim()}")
}
}