Skip to content

Commit b287e33

Browse files
authored
fix the build on windows and try to add a windows build to our github ci (#2407)
1 parent f08ddb5 commit b287e33

16 files changed

Lines changed: 129 additions & 29 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: main jdk17 windows build (multi-locale)
19+
20+
on:
21+
pull_request:
22+
branches: [ main ]
23+
push:
24+
branches: [ main ]
25+
26+
jobs:
27+
build:
28+
runs-on: windows-latest
29+
strategy:
30+
matrix:
31+
java: [ '17' ]
32+
locale: [ 'tr_TR.UTF-8', 'de_DE.UTF-8' ]
33+
env:
34+
LANG: ${{ matrix.locale }}
35+
LC_ALL: ${{ matrix.locale }}
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set up JDK ${{ matrix.java }}
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: 'temurin'
43+
java-version: ${{ matrix.java }}
44+
- name: Build with Maven
45+
run: mvn clean test install javadoc:aggregate
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: main jdk17 windows build
19+
20+
on:
21+
pull_request:
22+
branches: [ main ]
23+
push:
24+
branches: [ main ]
25+
26+
jobs:
27+
build:
28+
runs-on: windows-latest
29+
strategy:
30+
matrix:
31+
java: [ '17' ]
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
path: 'tika build dir'
37+
- name: Set up JDK ${{ matrix.java }}
38+
uses: actions/setup-java@v4
39+
with:
40+
distribution: 'temurin'
41+
java-version: ${{ matrix.java }}
42+
- name: Build with Maven
43+
working-directory: 'tika build dir'
44+
run: mvn clean test install javadoc:aggregate

tika-app/src/test/java/org/apache/tika/cli/TikaCLIAsyncTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public static void setUpClass() throws Exception {
7777
.replace("TIKA_CONFIG", ASYNC_CONFIG.toAbsolutePath().toString());
7878

7979
;
80+
json = json.replace("\\", "/");
8081
Files.writeString(ASYNC_PLUGINS_CONFIG, json, UTF_8);
8182
}
8283

tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,9 @@ private void testRecursiveUnpack(String targetFile, String[] expectedChildrenFil
401401
Path pluginsDir = Paths.get("target/plugins");
402402

403403
String[] params = {"-Z",
404-
"-p", ProcessUtils.escapeCommandLine(pluginsDir.toAbsolutePath().toString()),
405-
ProcessUtils.escapeCommandLine(input.toAbsolutePath().toString()),
406-
ProcessUtils.escapeCommandLine(extractDir
407-
.toAbsolutePath()
408-
.toString())};
404+
"-p", pluginsDir.toAbsolutePath().toString(),
405+
input.toAbsolutePath().toString(),
406+
extractDir.toAbsolutePath().toString()};
409407

410408
TikaCLI.main(params);
411409

@@ -429,7 +427,6 @@ private Set<String> getFileNames(Path extractDir) throws IOException {
429427
return FileVisitResult.CONTINUE;
430428
}
431429

432-
@Override
433430
public @NotNull FileVisitResult visitFile(Path path, @NotNull BasicFileAttributes basicFileAttributes) throws IOException {
434431
names.add(extractDir.relativize(path).toString().replace('\\', '/'));
435432
return FileVisitResult.CONTINUE;

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private static PipesIterator createIterator(Path inputDir) throws IOException {
187187
json = new String(is.readAllBytes(), StandardCharsets.UTF_8);
188188
}
189189
json = json.replace("FETCHER_BASE_PATH", inputDir.toAbsolutePath().toString());
190-
190+
json = json.replace("\\", "/");
191191
try {
192192
return FileSystemPipesIterator.build(new ExtensionConfig("", "", json));
193193
} catch (TikaConfigException e) {

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfileRunner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ private static PipesIterator createIterator(Path inputDir) throws IOException {
181181
json = new String(is.readAllBytes(), StandardCharsets.UTF_8);
182182
}
183183
json = json.replace("FETCHER_BASE_PATH", inputDir.toAbsolutePath().toString());
184+
json = json.replace("\\", "/");
184185

185186
try {
186187
return FileSystemPipesIterator.build(new ExtensionConfig("", "", json));

tika-parsers/tika-parsers-standard/tika-parsers-standard-package/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@
176176
<version>${zstd.version}</version>
177177
<scope>test</scope>
178178
</dependency>
179-
<dependency>
180-
<groupId>${project.groupId}</groupId>
181-
<artifactId>tika-serialization</artifactId>
182-
<scope>test</scope>
183-
</dependency>
184179
<!-- For legal reasons (incompatible license), jai-imageio-jpeg2000 is to be used
185180
only in the tests and may not be distributed. See also LEGAL-195 -->
186181
<dependency>
@@ -201,13 +196,6 @@
201196
<version>${project.version}</version>
202197
<scope>test</scope>
203198
</dependency>
204-
<dependency>
205-
<groupId>${project.groupId}</groupId>
206-
<artifactId>tika-core</artifactId>
207-
<version>${project.version}</version>
208-
<type>test-jar</type>
209-
<scope>test</scope>
210-
</dependency>
211199
<dependency>
212200
<groupId>${project.groupId}</groupId>
213201
<artifactId>tika-parser-zip-commons</artifactId>

tika-pipes/tika-async-cli/src/main/java/org/apache/tika/async/cli/PluginsWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void write(Path output) throws IOException {
5858
if (Files.isDirectory(plugins)) {
5959
pluginString = plugins.toAbsolutePath().toString();
6060
}
61-
json = json.replace("PLUGIN_ROOTS", pluginString);
61+
json = json.replace("PLUGIN_ROOTS", pluginString).replace("\\", "/");
6262
AsyncConfig asyncConfig = new AsyncConfig();
6363

6464
asyncConfig.setNumClients(simpleAsyncConfig.getNumClients() == null ? 2 : simpleAsyncConfig.getNumClients());

tika-pipes/tika-async-cli/src/main/java/org/apache/tika/async/cli/SimpleAsyncConfig.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,21 @@ public BasicContentHandlerFactory.HANDLER_TYPE getHandlerType() {
9191
public String getPluginsDir() {
9292
return pluginsDir;
9393
}
94+
95+
@Override
96+
public String toString() {
97+
return "SimpleAsyncConfig{" +
98+
"inputDir='" + inputDir + '\'' +
99+
", outputDir='" + outputDir + '\'' +
100+
", numClients=" + numClients +
101+
", timeoutMs=" + timeoutMs +
102+
", xmx='" + xmx + '\'' +
103+
", fileList='" + fileList + '\'' +
104+
", tikaConfig='" + tikaConfig + '\'' +
105+
", asyncConfig='" + asyncConfig + '\'' +
106+
", extractBytes=" + extractBytes +
107+
", handlerType=" + handlerType +
108+
", pluginsDir='" + pluginsDir + '\'' +
109+
'}';
110+
}
94111
}

tika-pipes/tika-async-cli/src/test/java/org/apache/tika/async/cli/AsyncProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void setUp() throws Exception {
9999
.replace("PLUGIN_ROOTS", pluginsDir.toAbsolutePath().toString())
100100
.replace("TIKA_CONFIG", tikaConfigPath.toAbsolutePath().toString())
101101
.replace("PLUGINS_CONFIG", pipesConfig.toAbsolutePath().toString());
102-
102+
jsonTemp = jsonTemp.replace("\\", "/");
103103
Files.writeString(pipesConfig, jsonTemp, StandardCharsets.UTF_8);
104104

105105
Path mock = inputDir.resolve("mock.xml");

0 commit comments

Comments
 (0)