在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):zeroc-ice/ice-builder-gradle开源软件地址(OpenSource Url):https://github.com/zeroc-ice/ice-builder-gradle开源编程语言(OpenSource Language):Groovy 100.0%开源软件介绍(OpenSource Introduction):Ice Builder for GradleThe Ice Builder for Gradle provides a Gradle plug-in named An Ice installation with ContentsBuild InstructionsTo build the ./gradlew build Using the slice Plug-inUsing the plugins DSL: plugins {
id "com.zeroc.gradle.ice-builder.slice" version "1.5.0"
} Using legacy plugin application:
It is important that the Gradle TaskThe
The plug-in adds the following dependency to tasks added by the
On Android, it adds the following dependency to each build variant of
Project LayoutThe plug-in assumes the following project layout:
This default layout can be changed with the property Convention PropertiesThe
If
On Windows, when neither You can set slice.iceHome = '/opt/Ice' The slice plug-in usually finds the
The slice plug-in uses the same logic to locate the Slice Plugin Methods
Configuring Slice-to-Java ProjectsUse the slice {
java {
...
}
} Otherwise, the source sets must have unique names, for example: slice {
java {
set1 {
...
}
set2 {
...
}
}
} Each source set triggers a separate execution of the
|
Property name | Type | Default value | Description |
---|---|---|---|
srcDir | File | src/main/slice | The Slice file source directory. |
args | String | - | The arguments to slice2java. |
files | FileCollection | - | The Slice files in this source set. Overrides srcDir . |
include | Set | - | Slice include file search path. |
Refer to the slice2java Command-Line Options for a description of the
options you can provide through the args
property.
Note: the slice
directory of your Ice installation (${slice.iceHome}/slice
)
is automatically added to include
by the plug-in.
java
ExamplesCompile all Slice files in src/main/slice
with the --tie
argument:
slice {
java {
args = "--tie"
}
}
Compile a.ice
with the argument --stream
, and compile all Slice files in
b
without --stream
. Both compilations add ${projectDir}
to the Slice
include search path:
slice {
java {
set1 {
include = ["${projectDir}"]
args = "--stream"
files = [file("a.ice")]
}
set2 {
include = ["${projectDir}"]
files = fileTree(dir: "b", includes: ['**.ice'])
}
}
}
Use the freezej
block to generate Freeze maps and indices with
slice2freezej
.
The plug-in currently supports a single unnamed source set within freezej
:
slice {
freezej {
srcDir = "src/main/slice"
...
}
}
freezej
PropertiesEach freezej
block defines the following convention properties:
Property name | Type | Default value | Description |
---|---|---|---|
srcDir | File | src/main/slice | The Slice file source directory. |
args | String | - | The arguments to slice2freezej . |
files | FileCollection | - | The Slice files in this source set. Overrides srcDir . |
include | Set | - | Slice include file search path. |
Refer to the slice2freezej Command-Line Options for a description of the
options you can provide through the args
property.
Note: the slice
directory of your Ice installation (${slice.iceHome}/slice
)
is automatically added to include
by the plug-in.
dict
BlockA dict
block describes one ore more Freeze maps (also known as dictionaries)
generated by slice2freezej
. Each map in such a block must have a unique name.
slice {
freezej {
dict {
Dict1 {
...
}
Dict2 {
...
}
}
}
}
dict
Propertiesdict
defines the following convention properties:
Property name | Type | Default value | Description |
---|---|---|---|
javaType | String | - | The name of the generated Java type. |
key | String | - | The Slice type of the key. |
value | String | - | The Slice type of the value. |
index | List<Map<>> | - | Secondary index or indices. |
The index
is a list of maps. Valid entries in each map are as follows:
Key (String) | Value Type | Default value | Description |
---|---|---|---|
member | String | - | The name of a data member in the Freeze map value type. |
caseSensitive | boolean | true | If member is a string, this specifies whether the comparison is case sensitive. |
Given the following Slice definitions in Test.ice
:
// Slice
module Test
{
struct Foo
{
string s;
Struct1 s1;
}
}
Generate a Freeze map named StringFooMap
that maps a string
to the Slice
type Test::Foo
:
slice {
freezej {
files = [file("Test.ice")]
dict {
StringFooMap {
javaType = "Test.StringFooMap"
key = "string"
value = "Test::Foo"
}
}
}
}
Generate the same Freeze map, but this time with an index on the data member
s
of the Foo
structure:
slice {
freezej {
files = [file("Test.ice")]
dict {
StringFooMap {
javaType = "Test.StringFooMap"
key = "string"
value = "Test::Foo"
index = [["member" : "s"]]
// Example: case insensitive
// index = [["member" : "s", "caseSensitive": false]]
// Example: two indices.
// index = [["member" : "s"], ['member': 's1']]
}
}
}
}
Generate an int
to string
map, and create an index on the string
value:
slice {
freezej {
dict {
IntToStringMap {
javaType = "Test.IntToStringMap"
key = "int"
value = "string"
index = [[]] // list with one empty map to create an index on the full value
// Same index but case insensitive:
// index = [["caseSensitive": false]]
}
}
}
}
index
BlockAn index
block describes one ore more Freeze Evictor indices generated by
slice2freezej
. Each index must have a unique name.
slice {
freezej {
index {
Index1 {
...
}
Index2 {
...
}
}
}
}
index
Propertiesindex
defines the following convention properties:
Property name | Type | Default value | Description |
---|---|---|---|
javaType | String | - | The name of the generated Java type. |
type | String | - | The Slice type of the type to be indexed. |
member | String | - | The name of the data member in the type to index. |
caseSensitive | boolean | true | If the member is a string, this specifies whether the comparison is case sensitive. |
Given the following Slice type defined in Phonebook.ice
:
// Slice
module Demo
{
class Contact
{
string name;
string address;
string phone;
}
}
Generate a Freeze Evictor index NameIndex
for the data member name
:
freezej {
files = [file("PhoneBook.ice")]
index {
NameIndex {
javaType = "NameIndex"
type = "Demo::Contact"
member = "name"
caseSensitive = false
}
}
}
Slice files will be recompiled if either of the following are true:
Removing a Slice file from a source set will trigger the removal of the
corresponding generated .java
files the next time the source set is built.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论