Skip to content

Commit aee890f

Browse files
authored
GH-527: [Release] Add support for .jar for Windows (#528)
Fixes GH-527. It seems that arrow-testing with ARROW_BUILD_STATIC=ON and GTest_SOURCE=BUNDLED is broken. We'll enable JNI test after we fix it in apache/arrow.
1 parent 37988c5 commit aee890f

File tree

8 files changed

+321
-48
lines changed

8 files changed

+321
-48
lines changed

.github/workflows/rc.yml

Lines changed: 82 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
name: release-source
7777
path: |
7878
apache-arrow-java-*
79-
jni-ubuntu:
79+
jni-linux:
8080
name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }}
8181
runs-on: ${{ matrix.platform.runs_on }}
8282
needs:
@@ -100,7 +100,7 @@ jobs:
100100
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
101101
with:
102102
name: release-source
103-
- name: Extract Download the latest Apache Arrow C++
103+
- name: Extract source archive
104104
run: |
105105
tar -xf apache-arrow-java-*.tar.gz --strip-components=1
106106
- name: Download the latest Apache Arrow C++
@@ -127,7 +127,7 @@ jobs:
127127
path: .docker
128128
key: jni-linux-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }}
129129
restore-keys: jni-linux-${{ matrix.platform.arch }}-
130-
- name: Build C++ libraries
130+
- name: Build
131131
run: |
132132
docker compose run vcpkg-jni
133133
- name: Push Docker image
@@ -159,7 +159,7 @@ jobs:
159159
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
160160
with:
161161
name: release-source
162-
- name: Extract Download the latest Apache Arrow C++
162+
- name: Extract source archive
163163
run: |
164164
tar -xf apache-arrow-java-*.tar.gz --strip-components=1
165165
- name: Download the latest Apache Arrow C++
@@ -176,7 +176,7 @@ jobs:
176176
repository: apache/parquet-testing
177177
path: arrow/cpp/submodules/parquet-testing
178178
- name: Set up Python
179-
uses: actions/setup-python@v5
179+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
180180
with:
181181
cache: 'pip'
182182
python-version: 3.12
@@ -246,7 +246,7 @@ jobs:
246246
path: ccache
247247
key: jni-macos-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }}
248248
restore-keys: jni-macos-${{ matrix.platform.arch }}-
249-
- name: Build C++ libraries
249+
- name: Build
250250
run: |
251251
set -e
252252
# make brew Java available to CMake
@@ -259,12 +259,83 @@ jobs:
259259
with:
260260
name: jni-macos-${{ matrix.platform.arch }}
261261
path: jni-macos-${{ matrix.platform.arch }}.tar.gz
262+
jni-windows:
263+
name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }}
264+
runs-on: ${{ matrix.platform.runs_on }}
265+
needs:
266+
- source
267+
strategy:
268+
fail-fast: false
269+
matrix:
270+
platform:
271+
- runs_on: windows-2019
272+
arch: "x86_64"
273+
steps:
274+
- name: Download source archive
275+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
276+
with:
277+
name: release-source
278+
- name: Extract source archive
279+
shell: bash
280+
run: |
281+
tar -xf apache-arrow-java-*.tar.gz --strip-components=1
282+
- name: Download the latest Apache Arrow C++
283+
shell: bash
284+
run: |
285+
ci/scripts/download_cpp.sh
286+
- name: Set up Java
287+
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
288+
with:
289+
java-version: '11'
290+
distribution: 'temurin'
291+
- name: Download Timezone Database
292+
shell: bash
293+
run: |
294+
arrow/ci/scripts/download_tz_database.sh
295+
- name: Install ccache
296+
shell: bash
297+
run: |
298+
env | sort
299+
version=4.10.2
300+
base_name="ccache-${version}-windows-x86_64"
301+
url="https://github.com/ccache/ccache/releases/download/v${version}/${base_name}.zip"
302+
curl --fail --location --remote-name "${url}"
303+
unzip "${base_name}.zip"
304+
chmod +x "${base_name}/ccache.exe"
305+
mv "${base_name}/ccache.exe" /usr/bin/
306+
rm -rf "${base_name}"{,.zip}
307+
- name: Prepare ccache
308+
shell: bash
309+
run: |
310+
echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV}
311+
- name: Cache ccache
312+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
313+
with:
314+
path: ccache
315+
key: jni-windows-${{ matrix.platform.arch }}-${{ hashFiles('arrow/cpp/**') }}
316+
restore-keys: jni-windows-${{ matrix.platform.arch }}-
317+
- name: Build
318+
shell: cmd
319+
run: |
320+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
321+
REM For ORC
322+
set TZDIR=/c/msys64/usr/share/zoneinfo
323+
bash -c "ci/scripts/jni_windows_build.sh . arrow build jni"
324+
- name: Compress into single artifact to keep directory structure
325+
shell: bash
326+
run: tar -cvzf jni-windows-${{ matrix.platform.arch }}.tar.gz jni/
327+
- name: Upload artifacts
328+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
329+
with:
330+
name: jni-windows-${{ matrix.platform.arch }}
331+
path: jni-windows-${{ matrix.platform.arch }}.tar.gz
262332
binaries:
263333
name: Binaries
264334
runs-on: ubuntu-latest
265335
needs:
266-
- jni-ubuntu
336+
- jni-linux
267337
- jni-macos
338+
- jni-windows
268339
steps:
269340
- name: Download artifacts
270341
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
@@ -278,7 +349,7 @@ jobs:
278349
# tar -xvzf jni-linux-aarch_64.tar.gz
279350
tar -xvzf jni-macos-x86_64.tar.gz
280351
tar -xvzf jni-macos-aarch_64.tar.gz
281-
# tar -xvzf jni-windows.tar.gz
352+
tar -xvzf jni-windows-x86_64.tar.gz
282353
- name: Test that shared libraries exist
283354
run: |
284355
set -x
@@ -303,9 +374,9 @@ jobs:
303374
test -f jni/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib
304375
test -f jni/gandiva_jni/aarch_64/libgandiva_jni.dylib
305376
306-
# test -f jni/arrow_cdata_jni/x86_64/arrow_cdata_jni.dll
307-
# test -f jni/arrow_dataset_jni/x86_64/arrow_dataset_jni.dll
308-
# test -f jni/arrow_orc_jni/x86_64/arrow_orc_jni.dll
377+
test -f jni/arrow_cdata_jni/x86_64/arrow_cdata_jni.dll
378+
test -f jni/arrow_dataset_jni/x86_64/arrow_dataset_jni.dll
379+
test -f jni/arrow_orc_jni/x86_64/arrow_orc_jni.dll
309380
- name: Checkout apache/arrow-testing
310381
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
311382
with:

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ repos:
4747
rev: v0.10.0
4848
hooks:
4949
- id: shellcheck
50+
args:
51+
- "--external-sources"
5052
- repo: https://github.com/scop/pre-commit-shfmt
5153
rev: v3.9.0-1
5254
hooks:

ci/scripts/download_cpp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ fi
4747
if [ -z "${url}" ]; then
4848
url="https://www.apache.org/dyn/closer.lua?action=download&filename=arrow/arrow-${version}/apache-arrow-${version}.tar.gz"
4949
fi
50-
wget --output-document "apache-arrow-${version}.tar.gz" "${url}"
50+
curl --location --output "apache-arrow-${version}.tar.gz" "${url}"
5151
tar xf "apache-arrow-${version}.tar.gz"
5252
mv "apache-arrow-${version}" arrow

ci/scripts/jni_build.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919

20-
set -euxo pipefail
20+
set -euo pipefail
2121

22+
# shellcheck source=ci/scripts/util_log.sh
23+
. "$(dirname "${0}")/util_log.sh"
24+
25+
github_actions_group_begin "Prepare arguments"
2226
source_dir=${1}
2327
arrow_install_dir=${2}
2428
build_dir=${3}/java_jni
2529
# The directory where the final binaries will be stored when scripts finish
2630
dist_dir=${4}
2731
prefix_dir="${build_dir}/java-jni"
32+
github_actions_group_end
2833

29-
echo "=== Clear output directories and leftovers ==="
30-
# Clear output directories and leftovers
34+
github_actions_group_begin "Clear output directories and leftovers"
3135
rm -rf "${build_dir}"
36+
github_actions_group_end
3237

33-
echo "=== Building Arrow Java C Data Interface native library ==="
38+
github_actions_group_begin "Building Arrow Java C Data Interface native library"
3439

3540
case "$(uname)" in
3641
Linux)
@@ -71,10 +76,14 @@ if [ "${ARROW_JAVA_BUILD_TESTS}" = "ON" ]; then
7176
fi
7277
cmake --build "${build_dir}" --target install
7378

79+
github_actions_group_end
80+
81+
github_actions_group_begin "Copying artifacts"
7482
mkdir -p "${dist_dir}"
7583
# For Windows. *.dll are installed into bin/ on Windows.
7684
if [ -d "${prefix_dir}/bin" ]; then
7785
mv "${prefix_dir}"/bin/* "${dist_dir}"/
7886
else
7987
mv "${prefix_dir}"/lib/* "${dist_dir}"/
8088
fi
89+
github_actions_group_end

ci/scripts/jni_macos_build.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020
# This script is like java_jni_build.sh, but is meant for release artifacts
2121
# and hardcodes assumptions about the environment it is being run in.
2222

23-
set -ex
23+
set -euo pipefail
2424

25+
# shellcheck source=ci/scripts/util_log.sh
26+
. "$(dirname "${0}")/util_log.sh"
27+
28+
github_actions_group_begin "Prepare arguments"
2529
source_dir="$(cd "${1}" && pwd)"
2630
arrow_dir="$(cd "${2}" && pwd)"
2731
build_dir="${3}"
@@ -36,20 +40,29 @@ i386)
3640
esac
3741
# The directory where the final binaries will be stored when scripts finish
3842
dist_dir="${4}"
43+
github_actions_group_end
3944

40-
echo "=== Clear output directories and leftovers ==="
41-
# Clear output directories and leftovers
45+
github_actions_group_begin "Clear output directories and leftovers"
4246
rm -rf "${build_dir}"
4347
rm -rf "${dist_dir}"
4448

4549
mkdir -p "${build_dir}"
4650
build_dir="$(cd "${build_dir}" && pwd)"
51+
github_actions_group_end
52+
53+
: "${ARROW_USE_CCACHE:=ON}"
54+
if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
55+
github_actions_group_begin "ccache statistics before build"
56+
ccache -sv 2>/dev/null || ccache -s
57+
github_actions_group_end
58+
fi
4759

48-
echo "=== Building Arrow C++ libraries ==="
60+
github_actions_group_begin "Building Arrow C++ libraries"
4961
install_dir="${build_dir}/cpp-install"
5062
: "${ARROW_ACERO:=ON}"
5163
export ARROW_ACERO
5264
: "${ARROW_BUILD_TESTS:=ON}"
65+
export ARROW_BUILD_TESTS
5366
: "${ARROW_DATASET:=ON}"
5467
export ARROW_DATASET
5568
: "${ARROW_GANDIVA:=ON}"
@@ -58,15 +71,9 @@ export ARROW_GANDIVA
5871
export ARROW_ORC
5972
: "${ARROW_PARQUET:=ON}"
6073
: "${ARROW_S3:=ON}"
61-
: "${ARROW_USE_CCACHE:=ON}"
6274
: "${CMAKE_BUILD_TYPE:=Release}"
6375
: "${CMAKE_UNITY_BUILD:=ON}"
6476

65-
if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
66-
echo "=== ccache statistics before build ==="
67-
ccache -sv 2>/dev/null || ccache -s
68-
fi
69-
7077
export ARROW_TEST_DATA="${arrow_dir}/testing/data"
7178
export PARQUET_TEST_DATA="${arrow_dir}/cpp/submodules/parquet-testing/data"
7279
export AWS_EC2_METADATA_DISABLED=TRUE
@@ -99,8 +106,10 @@ cmake \
99106
-Dre2_SOURCE=BUNDLED \
100107
-GNinja
101108
cmake --build "${build_dir}/cpp" --target install
109+
github_actions_group_end
102110

103111
if [ "${ARROW_RUN_TESTS:-}" == "ON" ]; then
112+
github_actions_group_begin "Running Arrow C++ libraries tests"
104113
# MinIO is required
105114
exclude_tests="arrow-s3fs-test"
106115
# unstable
@@ -113,6 +122,7 @@ if [ "${ARROW_RUN_TESTS:-}" == "ON" ]; then
113122
--parallel "$(sysctl -n hw.ncpu)" \
114123
--test-dir "${build_dir}/cpp" \
115124
--timeout 300
125+
github_actions_group_end
116126
fi
117127

118128
export JAVA_JNI_CMAKE_ARGS="-DProtobuf_ROOT=${build_dir}/cpp/protobuf_ep-install"
@@ -123,11 +133,12 @@ export JAVA_JNI_CMAKE_ARGS="-DProtobuf_ROOT=${build_dir}/cpp/protobuf_ep-install
123133
"${dist_dir}"
124134

125135
if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
126-
echo "=== ccache statistics after build ==="
136+
github_actions_group_begin "ccache statistics after build"
127137
ccache -sv 2>/dev/null || ccache -s
138+
github_actions_group_end
128139
fi
129140

130-
echo "=== Checking shared dependencies for libraries ==="
141+
github_actions_group_begin "Checking shared dependencies for libraries"
131142
pushd "${dist_dir}"
132143
archery linking check-dependencies \
133144
--allow CoreFoundation \
@@ -147,3 +158,4 @@ archery linking check-dependencies \
147158
"arrow_orc_jni/${normalized_arch}/libarrow_orc_jni.dylib" \
148159
"gandiva_jni/${normalized_arch}/libgandiva_jni.dylib"
149160
popd
161+
github_actions_group_end

0 commit comments

Comments
 (0)