README.md 2.6 KB
Newer Older
梦境迷离's avatar
梦境迷离 已提交
1
<img align="right" width="30%" height="30%" src="img.png" alt="https://bitlap.org"/>
梦境迷离's avatar
梦境迷离 已提交
2

梦境迷离's avatar
梦境迷离 已提交
3
# scala-macro-tools
I
IceMimosa 已提交
4

梦境迷离's avatar
梦境迷离 已提交
5 6 7 8
[![Build](https://github.com/bitlap/scala-macro-tools/actions/workflows/ScalaCI.yml/badge.svg)](https://github.com/bitlap/scala-macro-tools/actions/workflows/ScalaCI.yml)
[![codecov](https://codecov.io/gh/bitlap/scala-macro-tools/branch/master/graph/badge.svg?token=IA596YRTOT)](https://codecov.io/gh/bitlap/scala-macro-tools)
[![Maven Central deprecated](https://img.shields.io/maven-central/v/io.github.jxnu-liguobin/scala-macro-tools_2.13.svg?label=Maven%20Central%20deprecated)](https://search.maven.org/search?q=g:%22io.github.jxnu-liguobin%22%20AND%20a:%22scala-macro-tools_2.13%22)
[![Maven Central](https://img.shields.io/maven-central/v/org.bitlap/scala-macro-tools_2.13.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.bitlap%22%20AND%20a:%22scala-macro-tools_2.13%22)
I
IceMimosa 已提交
9 10
[![Version](https://img.shields.io/jetbrains/plugin/v/17202-scala-macro-tools)](https://plugins.jetbrains.com/plugin/17202-scala-macro-tools)

梦境迷离's avatar
梦境迷离 已提交
11
Motivation
梦境迷离's avatar
梦境迷离 已提交
12
--
梦境迷离's avatar
梦境迷离 已提交
13

梦境迷离's avatar
梦境迷离 已提交
14
Learn Scala macro and abstract syntax tree.
梦境迷离's avatar
梦境迷离 已提交
15

梦境迷离's avatar
梦境迷离 已提交
16
> The project is currently experimental
梦境迷离's avatar
梦境迷离 已提交
17

梦境迷离's avatar
梦境迷离 已提交
18
[中文说明](./README_CN.md) | [English](./README.md)
19

梦境迷离's avatar
梦境迷离 已提交
20
# Environment
21

梦境迷离's avatar
梦境迷离 已提交
22 23
- Compile passed in Java 8、11
- Compile passed in Scala 2.11.12、2.12.14、2.13.6
24

梦境迷离's avatar
梦境迷离 已提交
25
# Features
26 27 28 29 30 31 32

- `@toString`
- `@json`
- `@builder`
- `@synchronized`
- `@log`
- `@apply`
梦境迷离's avatar
梦境迷离 已提交
33
- `@constructor`
梦境迷离's avatar
梦境迷离 已提交
34
- `@equalsAndHashCode`
35
- `@jacksonEnum`
梦境迷离's avatar
梦境迷离 已提交
36
- `@elapsed`
梦境迷离's avatar
梦境迷离 已提交
37
- `@JavaCompatible`
梦境迷离's avatar
梦境迷离 已提交
38
- `ProcessorCreator`
梦境迷离's avatar
梦境迷离 已提交
39

梦境迷离's avatar
梦境迷离 已提交
40
> The intellij plugin named `Scala-Macro-Tools` in marketplace.
41

梦境迷离's avatar
梦境迷离 已提交
42 43 44
# Document

[https://bitlap.org/lab/smt](https://bitlap.org/lab/smt)
45

梦境迷离's avatar
梦境迷离 已提交
46
# How to use
梦境迷离's avatar
梦境迷离 已提交
47

梦境迷离's avatar
梦境迷离 已提交
48
Add library dependency
梦境迷离's avatar
梦境迷离 已提交
49

梦境迷离's avatar
梦境迷离 已提交
50
```scala
梦境迷离's avatar
梦境迷离 已提交
51
"org.bitlap.tools" %% "scala-macro-tools" % "<VERSION>"
梦境迷离's avatar
梦境迷离 已提交
52 53
```

梦境迷离's avatar
梦境迷离 已提交
54
The artefacts have been uploaded to Maven Central. Importing the library into your build system (e.g gradle, sbt), is not enough. You need to follow an extra step.
梦境迷离's avatar
梦境迷离 已提交
55

梦境迷离's avatar
梦境迷离 已提交
56 57 58
| Scala 2.11                   | Scala 2.12                   | Scala 2.13                                          |
| ---------------------------- | ---------------------------- | --------------------------------------------------- |
| Import macro paradise plugin | Import macro paradise plugin | Enable compiler flag `-Ymacro-annotations` required |
梦境迷离's avatar
梦境迷离 已提交
59 60 61 62 63

```scala
addCompilerPlugin("org.scalamacros" % "paradise_<your-scala-version>" % "<plugin-version>")
```

梦境迷离's avatar
梦境迷离 已提交
64
Where `<your-scala-version>` must be the full scala version. For example 2.12.13, and not 2.12.
梦境迷离's avatar
梦境迷离 已提交
65

梦境迷离's avatar
梦境迷离 已提交
66
If that doesn't work, google for alternatives.
梦境迷离's avatar
梦境迷离 已提交
67

梦境迷离's avatar
梦境迷离 已提交
68
In version scala`2.13.x`, the functionality of macro paradise has been included in the scala compiler directly. However,
梦境迷离's avatar
梦境迷离 已提交
69
you must still enable the compiler flag `-Ymacro-annotations`.