-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
144 lines (130 loc) · 3.62 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'de.undercouch.download' version '4.0.2'
}
group = 'io.github.isotes'
version = '1.1.0'
sourceCompatibility = 1.8
repositories {
jcenter()
}
task downloadTestResources() {
def testProjectsDir = "${buildDir}/test-projects/Hilo2015"
def testProjectsUrl = "https://raw.githubusercontent.com/microsoft/VCSamples/92bcad05210499e017c66c4c62c927dcc680d4ee/VC2015Samples/Hilo/C%2B%2B"
outputs.dir testProjectsDir
doLast {
download {
src "${testProjectsUrl}/Hilo.sln"
dest testProjectsDir
overwrite false
}
['Annotator', 'Browser', 'Common', 'RegistrationHelper'].each { proj ->
mkdir testProjectsDir + "/${proj}"
download {
src "${testProjectsUrl}/${proj}/${proj}.vcxproj"
dest testProjectsDir + "/${proj}/"
overwrite false
}
}
}
}
dependencies {
api 'io.github.isotes:vs-model:1.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
testImplementation 'com.google.truth:truth:1.0.1'
testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1'
}
test {
dependsOn downloadTestResources
useJUnitPlatform()
}
javadoc {
source = sourceSets.main.allJava
// JavaDoc for XMLBeans 3.1.0 is not online
options.with {
links 'https://docs.oracle.com/javase/8/docs/api/',
'https://xmlbeans.apache.org/docs/3.0.0/reference/',
'https://isotes.github.io/javadoc/vs-model-1.0.0/'
}
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
// workaround for 'The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.'
options.addStringOption('source', '1.8')
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'vs-utils'
description = 'Utility classes to work with MSBuild solution and project files'
url = 'https://github.com/isotes/vs-utils'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Robert Sauter'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/isotes/vs-utils.git'
developerConnection = 'scm:svn:https://github.com/isotes/vs-utils.git'
url = 'https://github.com/isotes/vs-utils'
}
}
}
}
repositories {
maven {
if (project.hasProperty('publishOssrh') && publishOssrh) {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
authentication {
basic(BasicAuthentication)
}
credentials {
username = ossrhUsername
password = ossrhPassword
}
} else {
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
}
signing {
required { !version.endsWith('SNAPSHOT') }
if (required) {
sign publishing.publications.mavenJava
}
}