File: README.md

package info (click to toggle)
lightvalue 0.8.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 268 kB
  • sloc: java: 1,415; sh: 12; makefile: 4
file content (81 lines) | stat: -rw-r--r-- 3,130 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
LightValue
==========

LightValue is made to generate models for libraries as value classes, which are also JSON serialization friendly.

The primary goal is:

* **NO mandatory runtime DEPENDENCIES** for generated value classes. 

Usage of Gradle Plugin
-----

### Include in gradle project

```groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.kravemir.lightvalue:lightvalue-gradle-plugin:0.8.1'
    }
}

apply plugin: 'java'
apply plugin: 'org.kravemir.lightvalue'
```

### Default convention

Default convention creates a lightvalue configuration for each java sourceset, if Java plugin as applied.

Read more about default convention approach in [Convention over configuration](https://guides.gradle.org/designing-gradle-plugins/#convention_over_configuration) guide.

See [examples](#examples), as they utilize default convention.

### Custom convention

To use own custom conventions, apply only `LightValueBasePlugin`, or create custom tasks of type `LightValueGeneratorTask`.

### Configuration

Each configuration is of `LightValueConfiguration` java type, and has following properties and methods:


| Name                       | Description                                                  |
| -------------------------- | ------------------------------------------------------------ |
| **`name`** *(read-only)*   | Name of configuration                                        |
| **`source`**               | method adds  `path` (single parameter) to list of sources    |
| **`outputDir`**            | property defines output directory for generation of value classes |
| **`registerInSourceSets`** | method registers generated output to `sourceSets`(varargs parameter), and adds dependency to each source set compile java task |

### Examples

| Name                                                    | Description                                                  |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| [01. Hello Value Models](examples/01-hello-value-model) | Just, a Hello World for LightValue models using gradle       |
| [02. Data Types](examples/02-data-types)                | [TODO] will contain supported data types                     |
| [03. JSON](examples/03-json)                            | Usage optional integration with Jackson                      |
| [04. multi project](examples/04-multiproject)           | [TODO] will contain example how to use in multi (sub)projects and depedencies |

Usage of Java library
---------------------

TODO: not yet documented

Quality Assurance
-----------------

The quality assurance is based on [Testing Gradle plugins](https://guides.gradle.org/testing-gradle-plugins/) guide:

* manual tests based on [examples](examples), and check that:
    * end-user API remains unchanged across versions,
    * generated stuff works as expected,
* unit tests in [generator's tests](lightvalue-generator/src/test),
* and, nothing else now,...

License
-------

The whole project licensed is under Apache-2.0 license.