{"id":18322458,"url":"https://github.com/sureshg/native-image-playground","last_synced_at":"2025-04-05T23:31:00.098Z","repository":{"id":41976696,"uuid":"413012981","full_name":"sureshg/native-image-playground","owner":"sureshg","description":"GraalVM Native Image Playground!","archived":false,"fork":false,"pushed_at":"2025-04-01T01:25:55.000Z","size":1408,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T01:32:19.144Z","etag":null,"topics":["clikt","graalvm","graalvm-native-image","gradle-kotlin-dsl","java","kotlin","native-image"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sureshg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-03T07:56:22.000Z","updated_at":"2025-04-01T01:25:52.000Z","dependencies_parsed_at":"2024-09-17T20:51:51.571Z","dependency_job_id":"0a510d6b-05c9-48f6-93d9-f1e60b632b09","html_url":"https://github.com/sureshg/native-image-playground","commit_stats":null,"previous_names":[],"tags_count":18,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fnative-image-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fnative-image-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fnative-image-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fnative-image-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sureshg","download_url":"https://codeload.github.com/sureshg/native-image-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415783,"owners_count":20935383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clikt","graalvm","graalvm-native-image","gradle-kotlin-dsl","java","kotlin","native-image"],"created_at":"2024-11-05T18:24:41.986Z","updated_at":"2025-04-05T23:31:00.090Z","avatar_url":"https://github.com/sureshg.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraalVM Native Image Playground\n\n[![GitHub Workflow Status][gha_badge]][gha_url]\n[![GraalVM CE][graalvm_img]][graalvm_url]\n[![Kotlin release][kt_img]][kt_url]\n[![Style guide][ktlint_img]][ktlint_url]\n\n[GraalVM Native Image](https://www.graalvm.org/reference-manual/native-image/) of a kotlin/java app\nand publish the platform binaries using GitHub action.\n\n### Install GraalVM CE Dev\n\n```bash\n# Install GraalVM CE Dev\n$ ./scripts/graalvm-ce-dev.sh\n\n# or Install latest GraalVM CE\n$ sdk i java 24-graalce\n```\n\n### Build\n\n```bash\n# Build the native image\n$ ./gradlew nativeCompile [-Pquick]\n\n# Use trace agent for metadata generation\n$ ./gradlew -Pagent run [--rerun-tasks]\n# Gracefully shutdown the server instead of killing Gradle run.\n$ curl http://localhost:9080/shutdown\n$ ./gradlew metadataCopy\n\n# Run native image tests\n$ ./gradlew nativeTest\n$ ./gradlew -Pagent nativeTest\n\n# GraalVM JIT Mode\n$ ./gradlew build\n$ java --enable-preview \\\n       --add-modules=ALL-SYSTEM \\\n       -jar build/libs/native-image-playground-*-all.jar\n\n# Find out the classes/jars using top modules mentioned in the native-image build output\n$ jdeps -q \\\n        -R \\\n        --ignore-missing-deps \\\n        --multi-release=25 \\\n        build/libs/native-image-playground-*-all.jar\n\n# Build native image from modular jars\n$ native-image \\\n    -p base-module.jar:main-module.jar \\\n    -m dev.suresh.Main\n```\n\n### Run \u0026 Debugging\n\n- Using Distroless\n\n   ```bash\n  # Download https://github.com/sureshg/native-image-playground/releases/latest and extract it\n  $ chmod +x native-image-playground\n\n  # Running \"mostly static native image\" built on GithubAction (Linux amd64)\n  $ docker run \\\n          -it \\\n          --rm \\\n          --platform=linux/amd64 \\\n          --pull always \\\n          --publish 9080:9080 \\\n          --name native-image-playground \\\n          --mount type=bind,source=$(pwd),destination=/app,readonly \\\n          --entrypoint=/app/native-image-playground \\\n          gcr.io/distroless/base\n\n  # Running static image compiled using musl libc\n  $ docker run \\\n          -it \\\n          --rm \\\n          --pull always \\\n          --publish 9080:9080 \\\n          --name native-image-playground \\\n          --mount type=bind,source=$(pwd),destination=/app,readonly \\\n          --entrypoint=/app/native-image-playground \\\n          gcr.io/distroless/static\n\n  # To kill the container\n  $ docker kill native-image-playground\n  ```\n\n- List all runtime options\n\n  ```bash\n  $ build/native/nativeCompile/native-image-playground -XX:PrintFlags= 2\u003e\u00261\n  # Set HeapDump path\n  $ build/native/nativeCompile/native-image-playground -XX:HeapDumpPath=$HOME/heapdump.hprof\n  ```\n\n- Object/Shared Lib Details\n\n  ```bash\n  # Show shared libs (MacOS)\n  $ otool -L build/native/nativeCompile/native-image-playground\n\n  # Show shared libs (Linux)\n  $ ldd build/native/nativeCompile/native-image-playground\n  $ objdump -p build/native/nativeCompile/native-image-playground | grep NEEDED\n  $ libtree -v build/native/nativeCompile/native-image-playground\n\n  # SVM details\n  $ strings -a build/native/nativeCompile/native-image-playground | grep -i com.oracle.svm.core.VM\n  # Show all bundled CA Certs\n  $ strings -a build/native/nativeCompile/native-image-playground | grep -i \"cn=\"\n  ```\n\n- [Mach-O Format Viewer](https://github.com/horsicq/XMachOViewer)\n\n### Resources\n\n* [GraalVM Native Image](https://www.graalvm.org/reference-manual/native-image/)\n* [Libraries and Frameworks Tested with Native Image](https://www.graalvm.org/native-image/libraries-and-frameworks/#libraries-and-frameworks-tested-with-native-image)\n* [GitHub Action for GraalVM](https://github.com/marketplace/actions/github-action-for-graalvm)\n* [Native Image Build Tools](https://graalvm.github.io/native-build-tools/)\n* [Native Image Docs Repo](https://github.com/oracle/graal/tree/master/docs/reference-manual/native-image)\n\n\u003chr\u003e\n\n* [GraalVM CE Version Roadmap](https://www.graalvm.org/release-notes/release-calendar/)\n* [Graalvm CE Builds](https://github.com/graalvm/graalvm-ce-builds/releases/)\n* [Graalvm CE Dev Builds](https://github.com/graalvm/graalvm-ce-dev-builds/releases/)\n* [Graalvm CE Docker Image](https://github.com/graalvm/container/pkgs/container/graalvm-ce)\n\n[graalvm_url]: https://github.com/graalvm/graalvm-ce-dev-builds/releases/\n\n[graalvm_img]: https://img.shields.io/github/v/release/graalvm/graalvm-ce-dev-builds?color=125b6b\u0026label=graalvm-ce-dev\u0026logo=oracle\u0026logoColor=d3eff5\n\n[graalvm_reachability_url]: https://github.com/oracle/graalvm-reachability-metadata/tree/master/metadata\n\n[graalvm_reachability_img]: https://img.shields.io/github/v/release/oracle/graalvm-reachability-metadata?color=125b6b\u0026label=graalvm-reachability\u0026logo=oracle\u0026logoColor=d3eff5\n\n[gl_dashboard_url]: https://www.graalvm.org/dashboard/\n\n[gl_dashboard_img]: https://img.shields.io/badge/GraalVM-Dashboard-125b6b.svg?logo=clyp\u0026logoColor=d3eff5\n\n[nativeimage_cs_url]: https://www.graalvm.org/uploads/quick-references/Native-Image_v2/CheatSheet_Native_Image_v2_(EU_A4).pdf\n\n[nativeimage_cs_img]: https://img.shields.io/badge/NativeImage-CheatSheet-125b6b.svg?logo=oracle\u0026logoColor=d3eff5\n\n[kt_url]: https://github.com/JetBrains/kotlin/releases/latest\n\n[kt_img]: https://img.shields.io/github/v/release/Jetbrains/kotlin?include_prereleases\u0026color=7f53ff\u0026label=Kotlin\u0026logo=kotlin\u0026logoColor=7f53ff\n\n[gha_url]: https://github.com/sureshg/native-image-playground/actions/workflows/graalvm.yml\n\n[gha_badge]: https://img.shields.io/github/actions/workflow/status/sureshg/native-image-playground/graalvm.yml?branch=main\u0026color=green\u0026label=Build\u0026logo=Github-Actions\u0026logoColor=green\n\n[sty_url]: https://kotlinlang.org/docs/coding-conventions.html\n\n[sty_img]: https://img.shields.io/badge/style-Kotlin--Official-40c4ff.svg?logo=kotlin\u0026logoColor=40c4ff\n\n[ktlint_url]: https://ktlint.github.io/\n\n[ktlint_img]: https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg?logo=kotlin\u0026logoColor=FF4081\n\n[//]: # (⬇️  🖌️  🧭🎨️ 🧭✨ 🌊 ⏳ 📫 📖 🎨 🍫 📐)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsureshg%2Fnative-image-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsureshg%2Fnative-image-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsureshg%2Fnative-image-playground/lists"}