Skip to content

Commit 3d06c82

Browse files
Fixing rust build for parquet-data-format (#19611)
1 parent ac9f5d1 commit 3d06c82

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,5 @@ doc-tools/missing-doclet/bin/
8282
/modules/parquet-data-format/src/main/resources/native/
8383
/modules/parquet-data-format/jni/target/debug
8484

85+
**/Cargo.lock
86+
/modules/parquet-data-format/jni/

modules/parquet-data-format/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ tasks.register('buildRust', Exec) {
157157
description = 'Build the Rust JNI library using Cargo'
158158
group = 'build'
159159

160-
workingDir file('src/main/rust')
160+
workingDir = file("${projectDir}/src/main/rust")
161161

162162
// Determine the target directory and library name based on OS
163163
def osName = System.getProperty('os.name').toLowerCase()
@@ -166,7 +166,7 @@ tasks.register('buildRust', Exec) {
166166

167167
// Use debug build for development, release for production
168168
def buildType = project.hasProperty('rustRelease') ? 'release' : 'debug'
169-
def targetDir = "target/${buildType}"
169+
def targetDir = file("${workingDir}/target/")
170170

171171
// Find cargo executable - try common locations
172172
def cargoExecutable = 'cargo'
@@ -184,9 +184,9 @@ tasks.register('buildRust', Exec) {
184184
}
185185

186186
def cargoArgs = [cargoExecutable, 'build']
187-
if (buildType == 'release') {
188-
cargoArgs.add('--release')
189-
}
187+
// if (buildType == 'release') {
188+
cargoArgs.add('--release')
189+
// }
190190

191191
if (osName.contains('windows')) {
192192
commandLine cargoArgs
@@ -195,10 +195,10 @@ tasks.register('buildRust', Exec) {
195195
}
196196

197197
// Set environment variables for cross-compilation if needed
198-
environment 'CARGO_TARGET_DIR', file('jni/target').absolutePath
198+
environment 'CARGO_TARGET_DIR', targetDir.absolutePath
199199

200-
inputs.files fileTree('src/main/rust/src')
201-
inputs.file 'src/main/rust/Cargo.toml'
200+
inputs.files fileTree("${workingDir}/src")
201+
inputs.file "${workingDir}/Cargo.toml"
202202
// outputs.files file("jni/${targetDir}/${libPrefix}opensearch_datafusion_jni${libExtension}")
203203
// System.out.println("Building Rust library in ${buildType} mode");
204204

0 commit comments

Comments
 (0)