{"id":19281863,"url":"https://github.com/elide-dev/plugin-gradle","last_synced_at":"2025-04-05T11:22:30.375Z","repository":{"id":39094608,"uuid":"506818390","full_name":"elide-dev/plugin-gradle","owner":"elide-dev","description":"Build tooling and Gradle plugin for Elide","archived":false,"fork":false,"pushed_at":"2024-06-04T10:25:05.000Z","size":3985,"stargazers_count":3,"open_issues_count":28,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T22:05:43.437Z","etag":null,"topics":["build-tools","elide","graalvm","gradle","gradle-plugin","javascript","jvm","kotlin","kotlin-js","node"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elide-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-23T23:20:53.000Z","updated_at":"2024-06-15T21:43:22.000Z","dependencies_parsed_at":"2024-02-03T17:08:49.217Z","dependency_job_id":"1e8b3e52-6b55-4c71-b677-f7f55acd6e9e","html_url":"https://github.com/elide-dev/plugin-gradle","commit_stats":null,"previous_names":["elide-dev/plugin-gradle","elide-dev/buildtools"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elide-dev%2Fplugin-gradle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elide-dev%2Fplugin-gradle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elide-dev%2Fplugin-gradle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elide-dev%2Fplugin-gradle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elide-dev","download_url":"https://codeload.github.com/elide-dev/plugin-gradle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247326815,"owners_count":20920914,"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":["build-tools","elide","graalvm","gradle","gradle-plugin","javascript","jvm","kotlin","kotlin-js","node"],"created_at":"2024-11-09T21:24:29.292Z","updated_at":"2025-04-05T11:22:30.345Z","avatar_url":"https://github.com/elide-dev.png","language":"Kotlin","readme":"# Elide Plugin for Gradle\n\n![beta](https://img.shields.io/badge/status-beta-blue.svg)\n[![CI](https://github.com/elide-dev/buildtools/actions/workflows/pre-merge.yaml/badge.svg)](https://github.com/elide-dev/buildtools/actions/workflows/pre-merge.yaml)\n[![Kotlin](https://img.shields.io/badge/kotlin-1.8.21-blue.svg?logo=kotlin)](http://kotlinlang.org)\n[![Gradle](https://img.shields.io/badge/gradle-8.x-blue.svg?logo=gradle)](http://gradle.org)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=elide-dev_buildtools\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=elide-dev_buildtools)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=elide-dev_buildtools\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=elide-dev_buildtools)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=elide-dev_buildtools\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=elide-dev_buildtools)\n\nThis plugin for Gradle enables [Elide](https://github.com/elide-dev)-based apps with additional build tooling and tasks.\nIn particular, this plugin is responsible for configuring and running [`esbuild`](https://esbuild.github.io) and\n[`webpack`](https://webpack.js.org) on behalf of the developer.\n\n### Features\n\n-   [x] **Embedded SSR:** Build JS apps, including Kotlin JS, into optimized embedded SSR bundles\n-   [x] **Asset compiler:** Optimize and compile frontend assets, and package them for use in Elide\n\n### Installing the plugin\n\nIt's a standard Gradle plugin, designed to be applied to **multi-module Gradle projects**. You should be able to check\nthe latest version at the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/dev.elide.buildtools.plugin). See\nbelow for specific installation and use instructions.\n\n**Kotlin DSL**\n\n```kotlin\nplugins {\n  id(\"dev.elide.buildtools.plugin\") version \"1.0.0-beta23\"\n}\n```\n\n**Groovy DSL**\n\n```groovy\nplugins {\n    id \"dev.elide.buildtools.plugin\" version \"1.0.0-beta23\"\n}\n```\n\n#### Plugin coordinates\n\n-   **Version:** `1.0.0-beta23`\n-   **Plugin ID:** `dev.elide.buildtools.plugin`\n-   **Classpath Coordinate:** `dev.elide.buildtools:plugin`\n\n---\n\n# Building Elide apps with Gradle\n\nThe plugin supports two build styles with Elide: **(1)** packaging frontend assets to be served by your JVM app, and\n**(2)** packaging scripting languages to be executed server-side, for instance, React, Vue, or Angular apps. JavaScript\nis the only supported language at this time, but more languages may be supported in the future.\n\n## Using the plugin\n\nThe Elide plugin is built to work with the [Kotlin Plugin for Gradle][1], specifically the [Kotlin/JS plugin][2] and the\n[Kotlin/JVM plugin][3] (multi-platform support is on the roadmap). In your Elide app project, you should have modules\nfor your `frontend` and `server` (or whatever you chose to call them).\n\nApply the plugin to both, depending on your needs.\n\n---\n\n### SSR Example\n\nFirst up is your frontend module:\n\n**Client** (module `frontend`)\n\n```kotlin\nplugins {\n    kotlin(\"js\")\n    id(\"com.github.node-gradle.node\")\n    id(\"dev.elide.buildtools.plugin\")\n}\n```\n\nOptionally, you can configure the plugin. Below are some example configuration options:\n\n```kotlin\nplugins {\n    kotlin(\"js\")\n    id(\"com.github.node-gradle.node\")\n    id(\"dev.elide.buildtools.plugin\")\n}\n\nelide {\n    mode = BuildMode.DEVELOPMENT\n\n    js {\n        tool(BundleTool.ESBUILD)\n        target(BundleTarget.EMBEDDED)\n\n        runtime {\n            languageLevel(JsLanguageLevel.ES2020)\n        }\n    }\n}\n```\n\nThis will bundle your SSR app with `esbuild`, using `ES2020` as the language standard. More docs are coming soon for\nfrontend SSR builds, but in the meantime, code completion via the Gradle Kotlin DSL works great.\n\nNext, we'll configure the server module, which needs to know where to find your frontend app:\n\n**Server** (module `server`)\n\n```kotlin\nplugins {\n  kotlin(\"jvm\")\n  id(\"dev.elide.buildtools.plugin\")\n}\n\nelide {\n  mode = BuildMode.DEVELOPMENT\n\n  server {\n    ssr(EmbeddedScriptLanguage.JS) {\n      bundle(project(\":frontend\"))\n    }\n  }\n}\n```\n\nHere, we're configuring the server to consume an **SSR bundle**, in **JavaScript**, from your `frontend` module. That's\nall you need to do for SSR.\n\n---\n\n### Assets Example\n\nServer assets can be packaged and embedded via this plugin, in concert with the Kotlin JVM plugin. See below:\n\n**Server** (module `server`)\n\n```kotlin\nplugins {\n    kotlin(\"jvm\")\n    id(\"dev.elide.buildtools.plugin\")\n}\n\nelide {\n    server {\n        assets {\n            bundler {\n                compression {\n                    modes(CompressionMode.GZIP)\n                }\n            }\n\n            // stylesheet: `main.base`\n            stylesheet(\"main.base\") {\n                sourceFile(\"src/main/assets/basestyles.css\")\n            }\n\n            // stylesheet: `main.styles`\n            stylesheet(\"main.styles\") {\n                sourceFile(\"src/main/assets/coolstyles.css\")\n                dependsOn(\"main.base\")\n            }\n\n            // script: `main.js`\n            script(\"main.js\") {\n                sourceFile(\"src/main/assets/some-script.js\")\n            }\n\n            // text: `util.humans`\n            text(\"util.humans\") {\n                sourceFile(\"src/main/assets/humans.txt\")\n            }\n        }\n    }\n}\n```\n\nThis will bundle the configured assets in Elide's asset format, and will pre-compress them with Gzip. Dependencies are\nexpressed in the asset manifest, allowing for efficient multi-file loading in your frontend.\n\n---\n\n### Combined Example\n\nThe frontend assets task can be combined with an SSR task:\n\n**Client** (module `frontend`)\n\n```kotlin\nplugins {\n    kotlin(\"js\")\n    id(\"com.github.node-gradle.node\")\n    id(\"dev.elide.buildtools.plugin\")\n}\n\nelide {\n    mode = BuildMode.DEVELOPMENT\n\n    js {\n        tool(BundleTool.ESBUILD)\n        target(BundleTarget.EMBEDDED)\n\n        runtime {\n            languageLevel(JsLanguageLevel.ES2020)\n        }\n    }\n}\n```\n\n**Server** (module `server`)\n\n```kotlin\nplugins {\n    kotlin(\"jvm\")\n    id(\"dev.elide.buildtools.plugin\")\n}\n\nelide {\n    server {\n        assets {\n            // settings for the asset bundler\n            bundler {\n                compression {\n                    modes(CompressionMode.GZIP)\n                }\n            }\n\n            // example: adding a stylesheet module\n            stylesheet(\"main.base\") {\n                sourceFile(\"src/main/assets/basestyles.css\")\n            }\n\n            // example: adding a stylesheet module with a dependency\n            stylesheet(\"main.styles\") {\n                sourceFile(\"src/main/assets/coolstyles.css\")\n                dependsOn(\"main.base\")\n            }\n\n            // example: adding a script module\n            script(\"main.js\") {\n                sourceFile(\"src/main/assets/some-script.js\")\n            }\n\n            // example: adding a plain-text asset module\n            text(\"util.humans\") {\n                sourceFile(\"src/main/assets/humans.txt\")\n            }\n        }\n    }\n}\n```\n\n[1]: https://kotlinlang.org/docs/gradle.html\n[2]: https://kotlinlang.org/docs/js-project-setup.html\n[3]: https://kotlinlang.org/docs/jvm-get-started.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felide-dev%2Fplugin-gradle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felide-dev%2Fplugin-gradle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felide-dev%2Fplugin-gradle/lists"}