Skip to content

Commit 324671f

Browse files
committed
make java-linker actually inspect the classfile to find the main function, make the generated shim metadata alphabetical
1 parent 75153b3 commit 324671f

File tree

6 files changed

+450
-147
lines changed

6 files changed

+450
-147
lines changed

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ SHIM_METADATA_GEN_DIR := shim-metadata-gen
1414
ASM_PROCESSOR_DIR := asm-processor
1515
LIBRARY_DIR := library
1616
LIBRARY_JAR := $(LIBRARY_DIR)/build/libs/library-0.1.0.jar
17+
RUST_SOURCES := $(shell find $(SHIM_METADATA_GEN_DIR)/src -type f -name '*.rs')
1718

1819
# === Default Target ===
1920
ifeq ($(IS_CI),1)
@@ -39,7 +40,6 @@ help:
3940
@echo " make rust-components - Install needed Rust components"
4041
@echo " make rust - Build the Rust root project"
4142
@echo " make java-linker - Build the Java Linker subproject"
42-
@echo " make shim-metadata-gen - Generate library shim metadata"
4343
@echo " make asm-processor - Build the ASM processor"
4444
@echo " make library - Build the standard library shim"
4545
@echo " make gen-files - Generate necessary files from templates"
@@ -75,11 +75,9 @@ clean-java-linker:
7575
cd $(JAVA_LINKER_DIR) && cargo clean
7676

7777
# === Library Shim Metadata Generator ===
78-
$(SHIM_METADATA_GEN_DIR)/core.json: library
78+
$(SHIM_METADATA_GEN_DIR)/core.json: $(RUST_SOURCES) library clean-shim-metadata-gen-json-files
7979
@if [ "$(IS_CI)" = "1" ]; then \
8080
echo "$(CYAN)CI mode: skipping shim-metadata-gen$(RESET)"; \
81-
elif [ -f $@ ]; then \
82-
echo "$(CYAN)core.json already exists, skipping shim-metadata-gen$(RESET)"; \
8381
else \
8482
echo "$(CYAN)🛠️ Generating library shim metadata...$(RESET)"; \
8583
cd $(SHIM_METADATA_GEN_DIR) && cargo run -- ../$(LIBRARY_JAR) ./core.json; \
@@ -88,7 +86,14 @@ $(SHIM_METADATA_GEN_DIR)/core.json: library
8886
clean-shim-metadata-gen:
8987
@echo "$(CYAN)🧹 Cleaning shim-metadata-gen...$(RESET)"
9088
cd $(SHIM_METADATA_GEN_DIR) && cargo clean
91-
rm -f $(SHIM_METADATA_GEN_DIR)/core.json
89+
90+
clean-shim-metadata-gen-json-files:
91+
@if [ "$(IS_CI)" = "1" ]; then \
92+
echo "$(CYAN)CI mode: skipping cleaning shim-metadata-gen JSON files$(RESET)"; \
93+
else \
94+
echo "$(CYAN)🧹 Cleaning shim-metadata-gen JSON files...$(RESET)"; \
95+
rm -f $(SHIM_METADATA_GEN_DIR)/*.json; \
96+
fi
9297

9398
# === ASM Processor (Gradle) ===
9499
asm-processor:

java-linker/Cargo.lock

Lines changed: 35 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java-linker/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ edition = "2024"
55

66
[dependencies]
77
regex = "1.11.1"
8+
ristretto_classfile = "0.17.0"
89
tempfile = "3.19.1"
910
zip = "2.5.0"

0 commit comments

Comments
 (0)