forked from axelor/axelor-open-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
154 lines (128 loc) · 4.07 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
import com.axelor.common.VersionUtils
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
buildscript {
apply from: "gradle/repos.gradle"
dependencies {
classpath 'com.adarshr:gradle-test-logger-plugin:4.0.0'
}
}
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: com.axelor.gradle.support.ChangelogSupport
apply from: "version.gradle"
def gitGitRevision(p) {
def gitFolder = "$p.projectDir/.git/"
if( !new File(gitFolder).exists() ) {
gitFolder = "$rootProject.projectDir/.git/"
}
if( !new File(gitFolder).exists() ) {
return null
}
def head = new File(gitFolder + "HEAD").text.split(":")
def isCommit = head.length == 1
if(isCommit) return head[0].trim()
def refPath = head[1].trim()
def refHead = new File(gitFolder + refPath)
if (refHead.exists()) {
return refHead.text.trim()
}
def packedRefsFile = new File(gitFolder + "packed-refs")
if (packedRefsFile.exists()) {
def packedRefs = packedRefsFile.text
def matcher = packedRefs =~ /(?m)^([0-9a-f]+) ${refPath}$/
if (matcher.find()) {
return matcher.group(1)
}
}
return null
}
configure(subprojects - project(':axelor-front')) {
apply from: "${rootDir}/gradle/libs.gradle"
apply from: "${rootDir}/gradle/common.gradle"
apply from: "${rootDir}/gradle/jacoco.gradle"
apply plugin: com.axelor.gradle.support.JavaSupport
apply plugin: com.axelor.gradle.support.EclipseSupport
apply plugin: com.axelor.gradle.support.LicenseSupport
apply plugin: com.axelor.gradle.support.PublishSupport
apply plugin: 'com.adarshr.test-logger'
group = "com.axelor"
version = rootProject.version
testlogger {
theme 'mocha'
slowThreshold 3000
}
afterEvaluate {
test {
useJUnitPlatform()
}
}
jar {
manifest {
def gitRev = gitGitRevision(project);
attributes(
'Build-Jdk-Spec': System.properties['java.specification.version'],
'Build-Jdk': System.properties['java.version'],
'Build-Date': ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")),
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Axelor',
'Implementation-Vendor-Id': 'com.axelor',
'Implementation-Vendor-Url': 'http://axelor.com',
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Axelor')
if (gitRev) {
attributes['Implementation-Build'] = gitRev
}
}
from("${rootDir}") {
include "LICENSE"
into "META-INF"
}
}
project.afterEvaluate {
publishing {
publications.all {
pom {
name = 'Axelor AOP - ' + project.name
description = project.description
url = 'https://github.com/axelor/axelor-open-platform'
organization {
name = 'Axelor'
url = 'https://axelor.com'
}
licenses {
license {
name = 'GNU Affero General Public License version 3'
url = 'https://www.gnu.org/licenses/agpl-3.0.html'
distribution = 'repo'
}
}
}
}
}
}
}
task updateVersion(type: com.axelor.gradle.tasks.UpdateVersion) {
description "Update version text in source files."
group "Axelor"
processFiles = fileTree(projectDir) {
include '**/src/**/resources/**/*.xml'
include '**/src/**/resources/domain-models.xsd'
include '**/src/**/resources/object-views.xsd'
include '**/src/**/resources/data-import.xsd'
include '**/src/**/data/**/*.xml'
include '**/data/**/*config.xml'
}
}
changelog {
version = VersionUtils.getVersion().version.replace("-SNAPSHOT", "")
output.set(file("CHANGELOG.md"))
inputPath.set(file("changelogs/unreleased"))
types.set(["Feature", "Change", "Deprecate", "Remove", "Fix", "Security"])
header.set("${version.get()} (${new Date().format("yyyy-MM-dd")})")
}
apply from: "gradle/javadoc.gradle"
apply from: "gradle/style.gradle"
apply from: "gradle/deps-versions.gradle"