-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
103 lines (86 loc) · 2.77 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
plugins {
id "com.github.node-gradle.node" version "7.0.2"
id "run.halo.plugin.devtools" version "0.1.1"
id "io.freefair.lombok" version "8.0.1"
id 'java'
}
group 'run.halo.unsplash'
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.18.0-SNAPSHOT')
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")
}
tasks.register('buildFrontend', PnpmTask) {
args = ['build']
dependsOn('installDepsForUI')
}
tasks.register('installDepsForUI', PnpmTask) {
args = ['install']
}
build {
// build frontend before build
tasks.named('compileJava').configure {
dependsOn('buildFrontend')
}
}
tasks.register('generateApiKeysFile') {
def outputDir = layout.buildDirectory.dir("resources/main").get().asFile
def apiKeysFile = file("$outputDir/apiKeys.properties")
doLast {
if (!outputDir.exists()) {
outputDir.mkdirs()
}
def unsplashApiKey = System.getenv('UNSPLASH_API_KEY') ?: project.findProperty('unsplashApiKey') ?: ""
def pexelsApiKey = System.getenv('PEXELS_API_KEY') ?: project.findProperty('pexelsApiKey') ?: ""
def pixabayApiKey = System.getenv('PIXABAY_API_KEY') ?: project.findProperty('pixabayApiKey') ?: ""
apiKeysFile.withWriter('UTF-8') { writer ->
writer.writeLine("unsplash=$unsplashApiKey")
writer.writeLine("pexels=$pexelsApiKey")
writer.writeLine("pixabay=$pixabayApiKey")
}
println "API keys properties file generated at: $apiKeysFile"
}
}
tasks.named("jar").configure {
dependsOn("generateApiKeysFile")
}
halo {
version = "2.20"
}
haloPlugin {
openApi {
groupingRules {
extensionApis {
displayName = 'Extension API for Image Stream Plugin'
pathsToMatch = [
'/apis/unsplash.halo.run/v1alpha1/**',
'/apis/pexels.halo.run/v1alpha1/**',
'/apis/pixabay.halo.run/v1alpha1/**'
]
}
}
groupedApiMappings = [
'/v3/api-docs/extensionApis': 'extensionApis.json'
]
generator {
outputDir = file("${projectDir}/ui/src/api/generated")
}
}
}