-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
181 lines (154 loc) · 5.25 KB
/
Copy pathbuild.gradle
File metadata and controls
181 lines (154 loc) · 5.25 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
allprojects {
group = 'net.zamasoft'
version = '2.2.3'
repositories {
mavenCentral()
}
}
// 配布用アーカイブに同梱するサンプルコンパイル用ライブラリ
configurations {
exampleLibs
}
dependencies {
exampleLibs 'javax.servlet:javax.servlet-api:4.0.1'
exampleLibs 'jakarta.servlet:jakarta.servlet-api:5.0.0'
}
task dist {
group = 'distribution'
description = '配布用アーカイブ (zip + tar.gz) を生成する'
dependsOn ':cti-driver:fullJar', ':cti-driver:minJar', 'aggregateJavadoc'
doLast {
def ver = version as String
def distDir = layout.buildDirectory.dir('dist').get().asFile
def archiveName = "cti-java-${ver}"
delete distDir
distDir.mkdirs()
// ドライバ JAR
copy {
from project(':cti-driver').tasks.named('fullJar')
from project(':cti-driver').tasks.named('minJar')
into distDir
}
// Javadoc
copy {
from tasks.named('aggregateJavadoc').get().destinationDir
into new File(distDir, 'apidoc')
}
// サンプルソース
copy {
from 'cti-examples/src/main/java'
into new File(distDir, 'examples/src')
}
copy {
from 'cti-examples/src/main/files'
into new File(distDir, 'examples/files')
}
copy {
from 'cti-examples/src/main/webapp'
into new File(distDir, 'examples/webapp')
}
// スクリプト(@version@ を実際のバージョンに置換)
copy {
from 'cti-examples/src/scripts'
into distDir
filter { String line -> line.replace('@version@', ver) }
}
// サンプルコンパイル用ライブラリ
copy {
from configurations.exampleLibs
into new File(distDir, 'lib')
}
// README
copy {
from 'README.md'
into distDir
}
// zip 生成
def buildDir = layout.buildDirectory.get().asFile
def zipFile = new File(buildDir, "${archiveName}.zip")
ant.zip(destfile: zipFile.absolutePath) {
zipfileset(dir: distDir.absolutePath, prefix: archiveName)
}
// tar.gz 生成
def tarFile = new File(buildDir, "${archiveName}.tar")
ant.tar(tarfile: tarFile.absolutePath, longfile: 'gnu') {
tarfileset(dir: distDir.absolutePath, prefix: archiveName, filemode: '644') {
exclude(name: 'copper')
exclude(name: 'compile-examples.sh')
}
tarfileset(dir: distDir.absolutePath, prefix: archiveName, filemode: '755') {
include(name: 'copper')
include(name: 'compile-examples.sh')
}
}
ant.gzip(
zipfile: new File(buildDir, "${archiveName}.tar.gz").absolutePath,
src: tarFile.absolutePath
)
tarFile.delete()
logger.lifecycle("配布アーカイブを作成しました:")
logger.lifecycle(" build/${archiveName}.zip")
logger.lifecycle(" build/${archiveName}.tar.gz")
}
}
def java8ClientProjects = [
'cti-if',
'cti-driver-ctip',
'cti-driver-rest',
'cti-cli',
'cti-ant',
'cti-examples',
'cti-driver',
] as Set
subprojects {
apply plugin: 'java-library'
apply plugin: 'java'
def clientCompatible = java8ClientProjects.contains(project.name)
java {
if (clientCompatible) {
// Client-side drivers and samples must remain usable on Java 8+.
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
} else {
// Server-side modules are part of the CopperPDF 4 stack and may use Java 21.
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release = clientCompatible ? 8 : 21
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
}
}
// 公開 API の集約 Javadoc(cti-if + cti-driver-ctip)
task aggregateJavadoc(type: Javadoc) {
group = 'documentation'
description = '公開 API の集約 Javadoc を生成する'
source = files(
project(':cti-if').sourceSets.main.allJava,
project(':cti-driver-ctip').sourceSets.main.allJava
)
classpath = files(
project(':cti-if').sourceSets.main.compileClasspath,
project(':cti-driver-ctip').sourceSets.main.compileClasspath
)
destinationDir = file('build/apidoc')
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
options.windowTitle = "CTI Driver API ${version}"
options.docTitle = "CTI Driver API ${version}"
}