Skip to content

Commit fc74ad7

Browse files
authored
Merge pull request #19 from linwumingshi/feature/grpc
feat: ✨ Add Grpc support
2 parents 828b5fd + f61b845 commit fc74ad7

10 files changed

+254
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You no longer need to write unit tests in your project to
1515
Start `smart-doc` to scan source code analysis and generate API documents.
1616
You can run the `gradle` command directly or click on the preset` goal` of the `smart-doc-maven-plugin` in the IDE to generate API documentation.
1717
smart-doc-gradle-plugin will also make smart-doc's ability to generate API documentation more powerful.
18-
[About smart-doc](https://smart-doc-group.github.io/#/)
18+
[About smart-doc](https://smart-doc-group.github.io)
1919
## Best Practice
2020
smart-doc + [Torna](http://torna.cn) form an industry-leading document generation and management solution, using `smart-doc` to complete Java source code analysis and extract annotations to generate API documents without intrusion,
2121
and automatically push the documents to the `Torna` enterprise-level interface document management platform.
@@ -121,7 +121,7 @@ Only three configuration items are required to use the `smart-doc-gradle-plugin`
121121
**Detailed configuration content:**
122122

123123
`smart-doc` provides a lot of configuration options. For more configuration options,
124-
please refer to the [official documentation](https://smart-doc-group.github.io/#/diy/config?id=allconfig)
124+
please refer to the [official documentation](https://smart-doc-group.github.io/guide/advanced/config)
125125

126126
### Generated document
127127
#### Use Gradle command
@@ -188,7 +188,7 @@ publish to https://plugins.gradle.org/
188188
gradlew publishPlugins
189189
```
190190
## Other reference
191-
- [Smart-doc manual](https://smart-doc-group.github.io/#/)
191+
- [Smart-doc manual](https://smart-doc-group.github.io)
192192

193193
## Who is using
194194
These are only part of the companies using `smart-doc`, for reference only. If you are using `smart-doc`, please [add your company here](https://github.com/TongchengOpenSource/smart-doc/issues/12) to tell us your scenario to make smart-doc better.

README_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
![smart-doc+torna](https://gitee.com/smart-doc-team/smart-doc/raw/master/images/smart-doc-torna.png)
1919

20-
[smart-doc+Torna文档自动化](https://smart-doc-group.github.io/#/zh-cn/integrated/torna)
20+
[smart-doc+Torna文档自动化](https://smart-doc-group.github.io/zh/guide/integrated/torna)
2121
## Getting started
2222
### Add plugin
2323
Using the plugins DSL:
@@ -119,7 +119,7 @@ https://gitee.com/devin-alan/smart-doc-gradle-plugin-demo
119119
仅仅需要上面一行配置就能启动`smart-doc-gradle-plugin`插件。
120120

121121
`smart-doc`提供很多配置项,
122-
详细配置请参考[官方文档](https://smart-doc-group.github.io/#/zh-cn/diy/config?id=allconfig)
122+
详细配置请参考[官方文档](https://smart-doc-group.github.io/zh/guide/advanced/config)
123123

124124
### Generated document
125125
#### Use Gradle command

src/main/java/com/ly/doc/gradle/constant/GlobalConstants.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ public interface GlobalConstants {
126126
*/
127127
String JAVADOC_MARKDOWN_TASK = "javadocMarkdown";
128128

129+
/**
130+
* Generate gRPC html document
131+
*/
132+
String GRPC_HTML_TASK = "gRPCHtml";
133+
134+
/**
135+
* Generate gRPC adoc document
136+
*/
137+
String GRPC_ADOC_TASK = "gRPCAdoc";
138+
139+
/**
140+
* Generate gRPC markdown document
141+
*/
142+
String GRPC_MARKDOWN_TASK = "gRPCMarkdown";
143+
129144
/**
130145
* Plugin extension name
131146
*/

src/main/java/com/ly/doc/gradle/constant/TaskConstants.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,18 @@ public class TaskConstants {
6666
taskMap.put(GlobalConstants.SWAGGER_TASK, SwaggerTask.class);
6767
// create websocket markdown
6868
taskMap.put(GlobalConstants.WEBSOCKET_MARKDOWN_TASK, WebSocketMarkdownTask.class);
69-
// create javadoc
69+
// create javadoc html
7070
taskMap.put(GlobalConstants.JAVADOC_HTML_TASK, JavadocHtmlTask.class);
7171
// create javadoc adoc
7272
taskMap.put(GlobalConstants.JAVADOC_ADOC_TASK, JavadocAdocTask.class);
7373
// create javadoc markdown
7474
taskMap.put(GlobalConstants.JAVADOC_MARKDOWN_TASK, JavadocMarkdownTask.class);
75+
// create gRPC html
76+
taskMap.put(GlobalConstants.GRPC_HTML_TASK, GrpcHtmlTask.class);
77+
// create gRPC adoc
78+
taskMap.put(GlobalConstants.GRPC_ADOC_TASK, GrpcAdocTask.class);
79+
// create gRPC markdown
80+
taskMap.put(GlobalConstants.GRPC_MARKDOWN_TASK, GrpcMarkdownTask.class);
7581

7682
}
7783
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
23+
package com.ly.doc.gradle.task;
24+
25+
import com.ly.doc.builder.grpc.GrpcAsciidocBuilder;
26+
import com.ly.doc.builder.rpc.RpcAdocBuilder;
27+
import com.ly.doc.model.ApiConfig;
28+
import com.thoughtworks.qdox.JavaProjectBuilder;
29+
import org.gradle.api.logging.Logger;
30+
31+
/**
32+
* grpc asciidoc task.
33+
*
34+
* @author linwumingshi
35+
* @since 3.0.7
36+
*/
37+
public class GrpcAdocTask extends DocBaseTask {
38+
39+
@Override
40+
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
41+
try {
42+
GrpcAsciidocBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
43+
} catch (Exception e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
23+
package com.ly.doc.gradle.task;
24+
25+
import com.ly.doc.builder.grpc.GrpcHtmlBuilder;
26+
import com.ly.doc.builder.rpc.RpcHtmlBuilder;
27+
import com.ly.doc.model.ApiConfig;
28+
import com.thoughtworks.qdox.JavaProjectBuilder;
29+
import org.gradle.api.logging.Logger;
30+
31+
/**
32+
* grpc html task.
33+
*
34+
* @author linwumingshi
35+
* @since 3.0.7
36+
*/
37+
public class GrpcHtmlTask extends DocBaseTask {
38+
39+
@Override
40+
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
41+
try {
42+
GrpcHtmlBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
43+
} catch (Exception e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
23+
package com.ly.doc.gradle.task;
24+
25+
import com.ly.doc.builder.grpc.GrpcMarkdownBuilder;
26+
import com.ly.doc.model.ApiConfig;
27+
import com.thoughtworks.qdox.JavaProjectBuilder;
28+
import org.gradle.api.logging.Logger;
29+
30+
/**
31+
* grpc markdown task.
32+
*
33+
* @author linwumingshi
34+
* @since 3.0.7
35+
*/
36+
public class GrpcMarkdownTask extends DocBaseTask {
37+
38+
@Override
39+
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
40+
try {
41+
GrpcMarkdownBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
42+
} catch (Exception e) {
43+
e.printStackTrace();
44+
}
45+
}
46+
}

src/main/java/com/ly/doc/gradle/task/JavadocAdocTask.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
123
package com.ly.doc.gradle.task;
224

325
import com.ly.doc.builder.javadoc.JavadocAdocBuilder;
426
import com.ly.doc.model.ApiConfig;
527
import com.thoughtworks.qdox.JavaProjectBuilder;
628
import org.gradle.api.logging.Logger;
729

8-
public class JavadocAdocTask extends DocBaseTask{
30+
/**
31+
* javadoc asciidoc task.
32+
*
33+
* @author shalousun
34+
* @since 3.0.5
35+
*/
36+
public class JavadocAdocTask extends DocBaseTask {
937

1038
@Override
1139
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {

src/main/java/com/ly/doc/gradle/task/JavadocHtmlTask.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
123
package com.ly.doc.gradle.task;
224

325
import com.ly.doc.builder.javadoc.JavadocHtmlBuilder;
426
import com.ly.doc.model.ApiConfig;
527
import com.thoughtworks.qdox.JavaProjectBuilder;
628
import org.gradle.api.logging.Logger;
729

8-
public class JavadocHtmlTask extends DocBaseTask{
30+
/**
31+
* javadoc html task.
32+
*
33+
* @author shalousun
34+
* @since 3.0.5
35+
*/
36+
public class JavadocHtmlTask extends DocBaseTask {
937
@Override
1038
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
1139
try {

src/main/java/com/ly/doc/gradle/task/JavadocMarkdownTask.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
1+
/*
2+
* smart-doc
3+
*
4+
* Copyright (C) 2018-2024 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
123
package com.ly.doc.gradle.task;
224

325
import com.ly.doc.builder.javadoc.JavadocMarkdownBuilder;
426
import com.ly.doc.model.ApiConfig;
527
import com.thoughtworks.qdox.JavaProjectBuilder;
628
import org.gradle.api.logging.Logger;
729

8-
public class JavadocMarkdownTask extends DocBaseTask{
30+
/**
31+
* javadoc markdown task.
32+
*
33+
* @author shalousun
34+
* @since 3.0.5
35+
*/
36+
public class JavadocMarkdownTask extends DocBaseTask {
937
@Override
1038
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
1139
try {

0 commit comments

Comments
 (0)