{"id":40808627,"url":"https://github.com/zeroc-ice/ice-builder-gradle","last_synced_at":"2026-01-21T21:12:21.851Z","repository":{"id":29276161,"uuid":"32808872","full_name":"zeroc-ice/ice-builder-gradle","owner":"zeroc-ice","description":"Gradle plug-in to automate the compilation of Slice files to Java","archived":false,"fork":false,"pushed_at":"2025-02-21T14:29:39.000Z","size":464,"stargazers_count":24,"open_issues_count":4,"forks_count":10,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-02-21T15:30:27.923Z","etag":null,"topics":["gradle","ice","ice-builder","slice","zeroc-ice"],"latest_commit_sha":null,"homepage":"https://zeroc.com","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroc-ice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2015-03-24T15:54:04.000Z","updated_at":"2025-02-21T14:29:43.000Z","dependencies_parsed_at":"2025-02-21T15:35:03.488Z","dependency_job_id":null,"html_url":"https://github.com/zeroc-ice/ice-builder-gradle","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/zeroc-ice/ice-builder-gradle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroc-ice%2Fice-builder-gradle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroc-ice%2Fice-builder-gradle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroc-ice%2Fice-builder-gradle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroc-ice%2Fice-builder-gradle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroc-ice","download_url":"https://codeload.github.com/zeroc-ice/ice-builder-gradle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroc-ice%2Fice-builder-gradle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28643100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gradle","ice","ice-builder","slice","zeroc-ice"],"created_at":"2026-01-21T21:12:20.953Z","updated_at":"2026-01-21T21:12:21.845Z","avatar_url":"https://github.com/zeroc-ice.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ice Builder for Gradle\n\nThe Ice Builder for Gradle provides a Gradle plug-in named `slice`. This plug-in manages the compilation of [Slice][1]\nfiles to Java. It compiles your Slice files with [`slice2java`][2], and it is also capable of generating Freeze maps and\nindices with [`slice2freezej`][3].\n\nAn [Ice][4] installation with `slice2java` version 3.5.1 or higher is required.\n\n## Contents\n\n- [Build Instructions](#build-instructions)\n- [Using the `slice` Plug-In](#using-the-slice-plug-in)\n  - [Gradle Task](#gradle-task)\n  - [Project Layout](#project-layout)\n  - [Convention Properties](#convention-properties)\n  - [Configuring Slice-to-Java Projects](#configuring-slice-to-java-projects)\n    - [java Properties](#java-properties)\n    - [java Examples](#java-examples)\n  - [Configuring Slice-to-FreezeJ Projects](#configuring-slice-to-freezej-projects)\n    - [freezej Properties](#freezej-properties)\n    - [dict Block](#dict-block)\n      - [dict Properties](#dict-properties)\n      - [dict Examples](#dict-examples)\n    - [index Block](#index-block)\n      - [index Properties](#index-properties)\n      - [index Example](#index-example)\n- [When does the Plug-In Recompile Slice Files?](#when-does-the-plug-in-recompile-slice-files)\n\n## Build Instructions\n\nTo build the `slice` plug-in run:\n\n```shell\n./gradlew build\n```\n\n## Using the slice Plug-in\n\nUsing the plugins DSL:\n```gradle\nplugins {\n  id \"com.zeroc.gradle.ice-builder.slice\" version \"1.5.0\"\n}\n```\n\nUsing legacy plugin application:\n```\nbuildscript {\n  repositories {\n    maven {\n      url \"https://plugins.gradle.org/m2/\"\n    }\n  }\n  dependencies {\n    classpath \"gradle.plugin.com.zeroc.gradle.ice-builder:slice:1.5.0\"\n  }\n}\n\napply plugin: \"com.zeroc.gradle.ice-builder.slice\"\n```\n\nIt is important that the `slice` plug-in is applied after the `java` plug-in in\norder for task dependencies to be properly setup.\n\n### Gradle Task\n\nThe `slice` plug-in adds a task to your project, as shown below:\n\n| Task name    | Type      | Description                             |\n| ------------ | --------- | --------------------------------------- |\n| compileSlice | SliceTask | Generates Java source from Slice files. |\n\nThe plug-in adds the following dependency to tasks added by the `java` plug-in:\n\n| Task name   | Depends On   |\n| ----------- | ------------ |\n| compileJava | compileSlice |\n\nOn Android, it adds the following dependency to each build variant of\n`project.android.libraryVariants`, `project.android.applicationVariants`, and\n`project.android.testVariants`:\n\n| Task name    | Depends On   |\n| ------------ | ------------ |\n| javaCompiler | compileSlice |\n\n### Project Layout\n\nThe plug-in assumes the following project layout:\n\n| Directory      | Meaning                                     |\n| -------------- | ------------------------------------------- |\n| src/main/slice | Location of your project's Slice files.     |\n\nThis default layout can be changed with the property `srcDir`, described below.\n\n### Convention Properties\n\nThe `slice` plug-in defines the following convention properties:\n\n| Property name     | Type    | Default value                                    | Description                                                                                                                                                                                                          |\n| ----------------- | ------- | ------------------------------------------------ | --------------------------------------------- |\n| iceHome           | String  | (see below)                                      | The root directory of the Ice installation.                                                                                                                                                                          |\n| freezeHome        | String  | `iceHome`                                        | The root directory of the Freeze installation.                                                                                                                                                                       |\n| output            | File    | _buildDir_/generated-src                         | The directory that contains the generated source files.                                                                                                                                                              |\n| iceVersion        | String  |                                                  | The Ice version returned by slice2java -v (read only).                                                                                                                                                               |\n| sliceDir          | String  | (platform dependent)                             | The Ice Slice installation directory (read only).                                                                                                                                                                    |\n| slice2java        | String  | (platform dependent)                             | Full path of the slice2java compiler (read only).                                                                                                                                                                    |\n| slice2freezej     | String  | (platform dependent)                             | Full path of the slice2freezej compiler (read only).                                                                                                                                                                 |\n| cppPlatform       | String  | CPP\\_PLATFORM env variable, if set               | See note below. |\n| cppConfiguration  | String  | CPP\\_CONFIGURATION env variable, if set          | See note below. |\n| compat            | Boolean | `false` if `iceVersion` \u003e= 3.7, otherwise `null` | When `iceVersion` \u003e= 3.7, adds `--compat` to the slice2java arguments.                                                                                                                                               |\n\nIf `iceHome` is not set, the plug-in will check the `ICE_HOME` environment\nvariable to determine the location of the Ice installation. If `ICE_HOME` is\nnot set either, the plug-in uses the following defaults on Linux and macOS:\n\n| OS         | Default Ice Installation Directory     |\n| ---------- | -------------------------------------- |\n| Linux      | /usr                                   |\n| macOS      | /usr/local                             |\n\nOn Windows, when neither `iceHome` nor `ICE_HOME` are set, the builder queries\nthe Windows registry to find Ice installations and selects the newest version.\n\nYou can set `iceHome` in your build script as shown below:\n\n```gradle\nslice.iceHome = '/opt/Ice'\n```\n\nThe slice plug-in usually finds the `slice2java` compiler in the `bin` directory of `iceHome`.  On Windows, it prefers\nthe following folders before falling back to `bin`:\n\n * `iceHome`\\\\cpp\\\\bin\\\\`cppPlatform`\\\\`cppConfiguration` when using a source distribution and\n   cpp\\\\bin\\\\`cppPlatform`\\\\`cppConfiguration` folder exists (this corresponds to the layout of a source distribution\n   for Ice version 3.7 or greater).\n\n * `iceHome`\\\\tools when not using a source distribution  and the `tools` folder exists (this corresponds to the layout\n    of a NuGet package).\n\nThe slice plug-in uses the same logic to locate the `slice2freezej` compiler within `freezeHome`.\n\n### Slice Plugin Methods\n\n| Method Name       | Arugment(s) | Description                                                                                                                                                               |\n| ----------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| compareIceVersion | `String`    | Compares `iceVersion` with given string. Returns `-1`, `0`, or `1`, depending on whether `iceVersion` is less than, equal to, or greater than given string, respectively. |\n\n### Configuring Slice-to-Java Projects\n\nUse the `java` block to configure the compilation of Slice files with\n`slice2java`. The `java` block can contain one or more source sets, each with\nits own set of flags for compiling Slice files. You can omit the source set\nname when you have a single set:\n\n```gradle\nslice {\n    java {\n        ...\n    }\n}\n```\n\nOtherwise, the source sets must have unique names, for example:\n\n```gradle\nslice {\n    java {\n        set1 {\n            ...\n        }\n        set2 {\n            ...\n        }\n    }\n}\n```\nEach source set triggers a separate execution of the `slice2java` compiler.\n\n#### `java` Properties\n\nEach source set in the `java` block defines the following convention properties:\n\n| Property name | Type           | Default value  | Description                                             |\n| ------------- | -------------- | :------------: | ------------------------------------------------------- |\n| srcDir        | File           | src/main/slice | The Slice file source directory.                        |\n| args          | String         | -              | The arguments to slice2java.                            |\n| files         | FileCollection | -              | The Slice files in this source set. Overrides `srcDir`. |\n| include       | Set\u003cFile\u003e      | -              | Slice include file search path.                         |\n\nRefer to the [slice2java Command-Line Options][2] for a description of the\noptions you can provide through the `args` property.\n\nNote: the `slice` directory of your Ice installation (`${slice.iceHome}/slice`)\nis automatically added to `include` by the plug-in.\n\n#### `java` Examples\n\nCompile all Slice files in `src/main/slice` with the `--tie` argument:\n\n```gradle\nslice {\n    java {\n        args = \"--tie\"\n    }\n}\n```\n\nCompile `a.ice` with the argument `--stream`, and compile all Slice files in\n`b` without `--stream`. Both compilations add `${projectDir}` to the Slice\ninclude search path:\n\n```gradle\nslice {\n    java {\n        set1 {\n            include = [\"${projectDir}\"]\n            args = \"--stream\"\n            files = [file(\"a.ice\")]\n        }\n        set2 {\n            include = [\"${projectDir}\"]\n            files = fileTree(dir: \"b\", includes: ['**.ice'])\n        }\n    }\n}\n```\n\n### Configuring Slice-to-FreezeJ Projects\n\nUse the `freezej` block to generate Freeze maps and indices with\n`slice2freezej`.\n\nThe plug-in currently supports a single unnamed source set within `freezej`:\n```\nslice {\n  freezej {\n      srcDir = \"src/main/slice\"\n      ...\n  }\n}\n```\n\n#### `freezej` Properties\n\nEach `freezej` block defines the following convention properties:\n\n| Property name | Type           | Default value  | Description                                             |\n| ------------- | -------------- | :------------: | ------------------------------------------------------- |\n| srcDir        | File           | src/main/slice | The Slice file source directory.                        |\n| args          | String         | -              | The arguments to `slice2freezej`.                       |\n| files         | FileCollection | -              | The Slice files in this source set. Overrides `srcDir`. |\n| include       | Set\u003cFile\u003e      | -              | Slice include file search path.                         |\n\nRefer to the [slice2freezej Command-Line Options][5] for a description of the\noptions you can provide through the `args` property.\n\nNote: the `slice` directory of your Ice installation (`${slice.iceHome}/slice`)\nis automatically added to `include` by the plug-in.\n\n#### `dict` Block\n\nA `dict` block describes one ore more Freeze maps (also known as dictionaries)\ngenerated by `slice2freezej`. Each map in such a block must have a unique name.\n```gradle\nslice {\n    freezej {\n        dict {\n            Dict1 {\n                ...\n            }\n            Dict2 {\n                ...\n            }\n        }\n    }\n}\n```\n\n##### `dict` Properties\n\n`dict` defines the following convention properties:\n\n| Property name | Type           | Default value | Description                                |\n| ------------- | -------------- | :-----------: | ------------------------------------------ |\n| javaType      | String         | -             | The name of the generated Java type.       |\n| key           | String         | -             | The Slice type of the key.                 |\n| value         | String         | -             | The Slice type of the value.               |\n| index         | List\\\u003cMap\\\u003c\u003e\u003e  | -             | Secondary index or indices.                |\n\nThe `index` is a list of maps. Valid entries in each map are as follows:\n\n| Key (String)  | Value Type    | Default value | Description                                                                     |\n| ------------- | ------------- | :-----------: | ------------------------------------------------------------------------------- |\n| member        | String        | -             | The name of a data member in the Freeze map value type.                         |\n| caseSensitive | boolean       | true          | If member is a string, this specifies whether the comparison is case sensitive. |\n\n##### dict Examples\n\nGiven the following Slice definitions in `Test.ice`:\n\n```\n// Slice\nmodule Test\n{\n    struct Foo\n    {\n        string s;\n        Struct1 s1;\n    }\n}\n```\n\nGenerate a Freeze map named `StringFooMap` that maps a `string` to the Slice\ntype `Test::Foo`:\n\n```gradle\nslice {\n    freezej {\n        files = [file(\"Test.ice\")]\n        dict {\n            StringFooMap {\n                javaType = \"Test.StringFooMap\"\n                key = \"string\"\n                value = \"Test::Foo\"\n            }\n        }\n    }\n}\n```\n\nGenerate the same Freeze map, but this time with an index on the data member\n`s` of the `Foo` structure:\n\n```gradle\nslice {\n    freezej {\n        files = [file(\"Test.ice\")]\n        dict {\n            StringFooMap {\n                javaType = \"Test.StringFooMap\"\n                key = \"string\"\n                value = \"Test::Foo\"\n                index = [[\"member\" : \"s\"]]\n                // Example: case insensitive\n                // index = [[\"member\" : \"s\", \"caseSensitive\": false]]\n                // Example: two indices.\n                // index = [[\"member\" : \"s\"], ['member': 's1']]\n            }\n        }\n    }\n}\n```\n\nGenerate an `int` to `string` map, and create an index on the `string` value:\n\n```gradle\nslice {\n    freezej {\n        dict {\n            IntToStringMap {\n                javaType = \"Test.IntToStringMap\"\n                key = \"int\"\n                value = \"string\"\n                index = [[]] // list with one empty map to create an index on the full value\n                // Same index but case insensitive:\n                // index = [[\"caseSensitive\": false]]\n            }\n        }\n    }\n}\n```\n#### `index` Block\n\nAn `index` block describes one ore more Freeze Evictor indices generated by\n`slice2freezej`. Each index must have a unique name.\n\n```gradle\nslice {\n    freezej {\n        index {\n            Index1 {\n                ...\n            }\n            Index2 {\n                ...\n            }\n        }\n    }\n}\n```\n\n##### `index` Properties\n\n`index` defines the following convention properties:\n\n| Property name | Type    | Default value | Description                                                                         |\n| ------------- | ------- | :-----------: | ----------------------------------------------------------------------------------- |\n| javaType      | String  | -             | The name of the generated Java type.                                                |\n| type          | String  | -             | The Slice type of the type to be indexed.                                           |\n| member        | String  | -             | The name of the data member in the type to index.                                   |\n| caseSensitive | boolean | true          | If the member is a string, this specifies whether the comparison is case sensitive. |\n\n##### index Example\n\nGiven the following Slice type defined in `Phonebook.ice`:\n\n```\n// Slice\nmodule Demo\n{\n    class Contact\n    {\n        string name;\n        string address;\n        string phone;\n    }\n}\n```\n\nGenerate a Freeze Evictor index `NameIndex` for the data member `name`:\n\n```gradle\nfreezej {\n    files = [file(\"PhoneBook.ice\")]\n    index {\n        NameIndex {\n            javaType = \"NameIndex\"\n            type = \"Demo::Contact\"\n            member = \"name\"\n            caseSensitive = false\n        }\n    }\n}\n```\n\n## When does the Plug-in Recompile Slice Files?\n\nSlice files will be recompiled if either of the following are true:\n * This Slice file or a Slice file included directly or indirectly by this\n Slice file was updated after the last compilation of the Slice file through\n the plug-in.\n * The options used to compile this Slice file have changed.\n\nRemoving a Slice file from a source set will trigger the removal of the\ncorresponding generated `.java` files the next time the source set is built.\n\n[1]: https://doc.zeroc.com/display/Ice/The+Slice+Language\n[2]: https://doc.zeroc.com/display/Ice/slice2java+Command-Line+Options\n[3]: https://doc.zeroc.com/display/Freeze37/Using+a+Map+in+Java\n[4]: https://github.com/zeroc-ice/ice\n[5]: https://doc.zeroc.com/display/Freeze37/slice2freezej+Command-Line+Options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroc-ice%2Fice-builder-gradle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroc-ice%2Fice-builder-gradle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroc-ice%2Fice-builder-gradle/lists"}