Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make RUSTFLAGS effective before running cargo commands #594

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ echo "old build-checksum: $old_checksum"
echo "new build-checksum: $new_checksum"

if [ "$new_checksum" != "$old_checksum" ]; then
export RUSTFLAGS=${RUSTFLAGS:-"-C target-cpu=native"}
echo "Running cargo fix..."
cargo fix --all --allow-dirty --allow-staged --allow-no-vcs

echo "Running cargo fmt..."
cargo fmt --all -q --

echo "Building native with [$profile] profile..."
export RUSTFLAGS=${RUSTFLAGS:-"-C target-cpu=native"}
cargo build --profile="$profile" --verbose --locked --frozen
else
echo "native-engine source code and built libraries not modified, no need to rebuild"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;

import org.apache.hadoop.fs.ByteBufferPositionedReadable;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
Expand All @@ -30,13 +29,15 @@
public class JniUtil {
static ReadImpl readImpl;
static ReadImpl readFallback = new ReadFailback();

static {
try {
readImpl = new ReadUsingByteBufferPositionedReadable();
} catch (NoClassDefFoundError e) {
readImpl = readFallback;
}
}

public static void readFullyFromFSDataInputStream(FSDataInputStream in, long pos, ByteBuffer buf)
throws IOException {
try {
Expand Down Expand Up @@ -88,4 +89,4 @@ public void read(FSDataInputStream in, long pos, ByteBuffer buf) throws IOExcept
}
}
}
}
}