76 lines
2.0 KiB
Groovy
76 lines
2.0 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id "com.github.node-gradle.node" version "7.0.2"
|
|
id "io.freefair.lombok" version "8.0.1"
|
|
id "run.halo.plugin.devtools" version "0.1.1"
|
|
}
|
|
|
|
group 'run.halo.starter'
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
|
|
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
|
maven { url 'https://repo.spring.io/milestone' }
|
|
}
|
|
|
|
dependencies {
|
|
implementation platform('run.halo.tools.platform:plugin:2.20.11')
|
|
compileOnly 'run.halo.app:api'
|
|
|
|
testImplementation 'run.halo.app:api'
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = "UTF-8"
|
|
}
|
|
|
|
node {
|
|
nodeProjectDir = file("${project.projectDir}/ui")
|
|
}
|
|
|
|
task buildFrontend(type: PnpmTask) {
|
|
args = ['build']
|
|
}
|
|
|
|
build {
|
|
// build frontend before build
|
|
tasks.getByName('compileJava').dependsOn('buildFrontend')
|
|
}
|
|
|
|
halo {
|
|
version = '2.20.0'
|
|
}
|
|
|
|
haloPlugin {
|
|
openApi {
|
|
outputDir = file("$rootDir/api-docs/openapi/v3_0")
|
|
// 用于定义 API 分组规则
|
|
groupingRules {
|
|
// 此名称为 group name,定义后 groupedApiMappings 中的 /v3/api-docs/ 后的名称需要与之相同,要避免与 halo 中已经存在的 group 相同避免生成后出现与插件无关的 API
|
|
doubanApi {
|
|
// 分组显示名称
|
|
displayName = 'Extension API for Douban'
|
|
// 分组的 API 规则
|
|
pathsToMatch = ['/apis/douban.moony.la/v1alpha1/**',
|
|
'/apis/api.douban.moony.la/v1alpha1/**'
|
|
]
|
|
}
|
|
}
|
|
groupedApiMappings = [
|
|
'/v3/api-docs/doubanApi': 'doubanApi.json'
|
|
]
|
|
generator {
|
|
// 默认配置可缺省
|
|
outputDir = file("${projectDir}/ui/src/api/generated")
|
|
}
|
|
}
|
|
}
|
|
|