Skip to content

Commit

Permalink
Update Dockerfile and remove unnecessary import
Browse files Browse the repository at this point in the history
Removed unused import `Status::Success` in `src/lib.rs` file, providing clearer code structure. Updated Dockerfile by including cbindgen installation and configuration. This change allows the generation of C bindings for Rust code to create a header file for the application, improving compatibility with C applications.
  • Loading branch information
MairwunNx committed Mar 26, 2024
1 parent 860b6e8 commit 5fe3b31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ RUN --mount=type=cache,target=/lib/target/,id=rust-cache-${APP_NAME}-${TARGETPLA
--mount=type=cache,target=/usr/local/cargo/registry/ \
<<EOF
set -e
cargo install cbindgen && \
cargo build --locked --release --target-dir ./target && \
cp ./target/release/lib${ARTIFACT_NAME}.a /bin/lib${ARTIFACT_NAME}.a
cbindgen --crate ${APP_NAME} --output ${APP_NAME}.h && \
cp ./target/release/lib${ARTIFACT_NAME}.a /bin/lib${ARTIFACT_NAME}.a && \
cp ./${APP_NAME}.h /bin/${APP_NAME}.h
EOF

FROM scratch AS final
ARG ARTIFACT_NAME
ARG APP_NAME
COPY --from=0 /etc/passwd /etc/passwd
USER defaultusr
COPY --from=build /bin/lib$ARTIFACT_NAME.a /lib$ARTIFACT_NAME.a
COPY --from=build /bin/$APP_NAME.h /$APP_NAME.h

1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use skia_safe::textlayout::{FontCollection, ParagraphBuilder, ParagraphStyle, Te
use antlr::jbytecodelexer::{BytecodeAccFlag, BytecodeConstantPoolTag, BytecodeDescriptor, BytecodeInstr, BytecodeKeyword, BytecodeLiterals, BytecodeMethodReference, BytecodeNumber, BytecodePrimitive, BytecodeSignature, FilePathIdentifier, QualifiedIdentifier, SlCommentLiteral, SpecialPrimitives, StringLiteral};

use crate::antlr::jbytecodelexer::JBytecodeLexer;
use crate::Status::Success;

mod antlr;

Expand Down

0 comments on commit 5fe3b31

Please sign in to comment.