Skip to content

Commit

Permalink
make RUSTFLAGS effective before running cargo commands (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyyue authored Sep 26, 2024
1 parent 324ce05 commit ffa7d73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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
}
}
}
}
}

0 comments on commit ffa7d73

Please sign in to comment.