forked from ballerina-platform/ballerina-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
132 lines (119 loc) · 4.11 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
plugins {
id 'base'
id "com.github.spotbugs" version "${githubSpotbugsVersion}"
id "com.dorongold.task-tree" version "${dorongoldTaskTreeVersion}"
id "com.github.johnrengelman.shadow" version "${githubJohnrengelmanShadowVersion}"
id 'maven-publish'
id "net.researchgate.release" version "${researchgateReleaseVersion}"
id 'jacoco'
id "org.sonarqube" version "${sonarqubeGradlePluginVersion}"
}
apply from: "$rootDir/gradle/repositories.gradle"
allprojects {
group = project.group
version = project.version
task printPath {
doLast{
println projectDir
}
}
}
subprojects {
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.name
version = project.version
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ballerina-platform/ballerina-lang")
credentials {
username System.getenv("publishUser")
password System.getenv("publishPAT")
}
}
}
}
release {
// Disable check snapshots temporarily
failOnSnapshotDependencies = false
failOnCommitNeeded = false
tagTemplate = 'v${version}'
buildTasks = ['build']
git {
// To release from any branch
requireBranch = null
}
}
}
dependencies {
constraints {
//implementation 'org.springframework:spring-web:5.0.2.RELEASE'
}
}
def classFilesArray = []
def execFilesArray = []
task copyExecFilesAndJavaClassFiles {
subprojects.forEach { subproject ->
def execFile = new File("${subproject.buildDir}/jacoco/jacoco.exec")
if (execFile.exists()) {
execFilesArray.push(execFile)
fileTree("${subproject.buildDir}/classes").matching {
exclude '**/test/*'
exclude '**/module-info.class'
include '**/*.class'
}.each { file -> classFilesArray.push(file) }
}
}
}
task copyBallerinaClassFiles {
subprojects.forEach { subproject ->
def ballerinaSourceDirectory = new File("${subproject.buildDir}/ballerina-src")
if (ballerinaSourceDirectory.exists() && subproject.projectDir.getParentFile().getName() == "langlib") {
fileTree("${subproject.buildDir}/ballerina-src/target").include("**/*.zip").forEach { zip ->
def jarFiles = zipTree(zip).matching { include '**/*.jar' }
jarFiles.forEach { jar ->
zipTree(jar).matching {
exclude '**/tests/*'
exclude '**/$_init.class'
exclude '**/$value$Caller.class'
exclude '**/$value$Detail.class'
exclude '**/$value$DetailType.class'
exclude '**/$value$EmptyIterator.class'
exclude '**/$value$$anonType$_6.class'
exclude '**/$value$$anonType$_*.class'
exclude '**/$value$_Frame.class'
include '**/*.class'
}.each { file -> classFilesArray.push(file) }
}
}
}
}
}
task createCodeCoverageReport(type: JacocoReport) {
executionData files(execFilesArray)
additionalClassDirs files(classFilesArray)
reports {
xml.required = true
html.required = true
xml.destination new File("${rootDir}/.jacoco/reports/jacoco/report.xml")
html.destination new File("${rootDir}/.jacoco/reports/jacoco/report.html")
}
onlyIf = {
true
}
}
sonarqube {
properties {
property "sonar.projectKey", "ballerina-lang"
property "sonar.organization", "ballerina-platform"
property "sonar.host.url", "https://sonarcloud.io"
}
}
copyBallerinaClassFiles.dependsOn copyExecFilesAndJavaClassFiles
createCodeCoverageReport.dependsOn copyBallerinaClassFiles