forked from micronaut-projects/micronaut-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
155 lines (134 loc) · 5.65 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
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
classpath "io.spring.nohttp:nohttp-gradle:0.0.5.RELEASE"
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
classpath 'io.github.groovylang.groovydoc:groovydoc-gradle-plugin:1.0.1'
classpath "io.micronaut.docs:micronaut-docs-asciidoc-extensions:$micronautDocsVersion"
classpath "io.micronaut.docs:micronaut-docs-gradle-plugins:$micronautDocsVersion"
classpath "com.adarshr:gradle-test-logger-plugin:2.1.0"
}
}
plugins {
id "com.diffplug.gradle.spotless" version "5.8.2" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}
repositories {
mavenCentral()
}
version project.projectVersion
subprojects { Project subproject ->
repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
//TODO remove when https://github.com/micronaut-projects/micronaut-docs/issues/24 is implemented
maven { url "https://repo.grails.org/grails/core" }
}
version project.projectVersion
group "io.micronaut.starter"
ext {
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
}
apply plugin:"groovy"
apply plugin: 'idea'
apply plugin: 'checkstyle'
apply from: rootProject.file('gradle/license.gradle')
apply plugin: "com.adarshr.test-logger"
if (subproject.hasProperty("publish") && subproject.publish) {
apply plugin:"java-library"
apply from: rootProject.file("gradle/publishing.gradle")
jar {
manifest {
attributes('Automatic-Module-Name': "${subproject.group}.${subproject.name}".replaceAll('[^\\w\\.\\$_]', "_"))
attributes('Implementation-Version': projectVersion)
attributes('Implementation-Title': title)
}
}
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (project.name.startsWith("test-")) {
// Gradle TestKit needs Groovy 2.5
if (details.requested.group == "org.codehaus.groovy") {
details.useVersion("2.5.11")
}
if (details.requested.name == "spock-core") {
details.useVersion("1.3-groovy-2.5")
}
} else {
//multiple actions can be specified
if (details.requested.group == "org.codehaus.groovy") {
details.useVersion(groovyVersion)
}
if (details.requested.name == "spock-core") {
details.useVersion(spockVersion)
}
}
}
}
}
dependencies {
if (project.name.startsWith("test-")) {
implementation gradleTestKit()
} else {
annotationProcessor enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion")
implementation enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"
testAnnotationProcessor enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion")
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
}
testImplementation("org.codehaus.groovy:groovy:$groovyVersion")
testImplementation("org.spockframework:spock-core:$spockVersion") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
}
}
idea {
module {
outputDir file('build/classes/java/main')
testOutputDir file('build/classes/groovy/test')
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
apply from: "${rootProject.projectDir}/gradle/checkstyle.gradle"
if (!project.name.startsWith("test-")) {
apply from: "${rootProject.projectDir}/gradle/test.gradle"
}
}
apply from:"https://raw.githubusercontent.com/micronaut-projects/micronaut-docs/v${micronautDocsVersion}/gradle/docs.gradle"
Project starterCli = project('micronaut-cli')
starterCli.afterEvaluate {
task generateManpageAsciiDoc(type: JavaExec) {
dependsOn(starterCli.tasks.getByName('classes'))
group = "Documentation"
description = "Generate AsciiDoc manpage"
classpath(starterCli.configurations.compile, starterCli.configurations.getByName('generateConfig'), starterCli.sourceSets.main.runtimeClasspath)
main 'picocli.codegen.docgen.manpage.ManPageGenerator'
args starterCli.mainClassName, "--outdir=${project.buildDir}/generated-picocli-docs", "-v", "--factory=io.micronaut.starter.cli.MicronautFactory" //, "--template-dir=src/docs/mantemplates"
}
task copyManPages(type: Copy) {
dependsOn(generateManpageAsciiDoc)
group = "Documentation"
from file("${project.buildDir}/generated-picocli-docs")
include "**/*.adoc"
into file("${rootProject.buildDir.absolutePath}/generated/")
filter { String line ->
if (line == ':doctype: manpage' || line.startsWith('= ')) {
return ""
} else if (line.startsWith('==')) {
return '=' + line
} else {
return line
}
}
}
publishGuide.dependsOn(copyManPages)
}