/
build.gradle.kts
129 lines (108 loc) · 3.38 KB
/
build.gradle.kts
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
group = "com.labijie.infra"
version = Constants.projectVersion
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Constants.kotlinVersion}")
api("org.jetbrains.kotlin:kotlin-reflect:${Constants.kotlinVersion}")
implementation(gradleApi())
api("io.github.gradle-nexus:publish-plugin:${Constants.publishingPluginVersion}")
api("org.jetbrains.kotlin:kotlin-allopen:${Constants.kotlinVersion}")
api("org.jetbrains.kotlin:kotlin-gradle-plugin:${Constants.kotlinVersion}")
api("${Constants.mybatisPluginLib}:${Constants.mybatisPluginVersion}")
api("com.google.devtools.ksp:symbol-processing-gradle-plugin:${Constants.kspPluginVersion}")
api(Constants.gitPropertiesPluginArtifact)
api(Constants.checkUpdatePluginArtifact)
}
//force version
//configurations.all {
// resolutionStrategy {
// eachDependency {
// if(requested.group.startsWith("org.jetbrains.kotlin") && requested.name.startsWith("kotlin-")){
// useVersion(Constants.kotlinVersion)
// }
// }
// }
//}
plugins {
kotlin("jvm") version Constants.kotlinVersion
id("com.gradle.plugin-publish") version Constants.gradlePublishPluginVersion
if(Constants.testPlugin) {
id("com.labijie.infra") version Constants.projectVersion apply false
}
id("maven-publish")
id("java-gradle-plugin")
id("java-library")
}
gradlePlugin {
plugins {
create("InfraPlugin") {
id = "com.labijie.infra"
displayName = "infra gradle plugin"
description = "Build toolkit to help you configure gradle project"
implementationClass = "com.labijie.infra.gradle.InfraPlugin"
tags = listOf("infra", "labijie", "template")
}
}
website = "https://github.com/hongque-pro/infra-gradle-plugin"
vcsUrl = "https://github.com/hongque-pro/infra-gradle-plugin.git"
}
//for com.gradle.plugin-publish
//refer: https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html
publishing {
repositories {
maven {
name = "Folder"
url = uri("../local-plugin-repository")
}
}
}
//refer: https://docs.gradle.org/current/userguide/signing_plugin.html
//signing {
// publishing.publications.forEach {
// System.out.println(it.name)
// }
// isRequired = false
//}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
// Or shorter:
jvmToolchain(17)
// For example:
jvmToolchain(17)
}
fun getProxyMavenRepository(): String {
val proxy: String? = System.getenv("MAVEN_PROXY")?.ifBlank { null }
return proxy ?: "https://maven.aliyun.com/nexus/content/groups/public/"
}
repositories {
mavenLocal()
maven {
setUrl(getProxyMavenRepository())
isAllowInsecureProtocol = true
}
mavenCentral()
gradlePluginPortal()
}
tasks.withType(JavaCompile::class.java) {
sourceCompatibility = "17"
targetCompatibility = "17"
}
tasks.withType(Javadoc::class.java) {
this.isFailOnError = false
}
if (tasks.findByName("test") != null) {
tasks.withType(Test::class.java) {
useJUnitPlatform()
}
}
registerPubTasks()