Skip to content

feat: ✨ Add Grpc support #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You no longer need to write unit tests in your project to
Start `smart-doc` to scan source code analysis and generate API documents.
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.
smart-doc-gradle-plugin will also make smart-doc's ability to generate API documentation more powerful.
[About smart-doc](https://smart-doc-group.github.io/#/)
[About smart-doc](https://smart-doc-group.github.io)
## Best Practice
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,
and automatically push the documents to the `Torna` enterprise-level interface document management platform.
Expand Down Expand Up @@ -121,7 +121,7 @@ Only three configuration items are required to use the `smart-doc-gradle-plugin`
**Detailed configuration content:**

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

### Generated document
#### Use Gradle command
Expand Down Expand Up @@ -188,7 +188,7 @@ publish to https://plugins.gradle.org/
gradlew publishPlugins
```
## Other reference
- [Smart-doc manual](https://smart-doc-group.github.io/#/)
- [Smart-doc manual](https://smart-doc-group.github.io)

## Who is using
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.
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

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

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

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

### Generated document
#### Use Gradle command
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/ly/doc/gradle/constant/GlobalConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ public interface GlobalConstants {
*/
String JAVADOC_MARKDOWN_TASK = "javadocMarkdown";

/**
* Generate gRPC html document
*/
String GRPC_HTML_TASK = "gRPCHtml";

/**
* Generate gRPC adoc document
*/
String GRPC_ADOC_TASK = "gRPCAdoc";

/**
* Generate gRPC markdown document
*/
String GRPC_MARKDOWN_TASK = "gRPCMarkdown";

/**
* Plugin extension name
*/
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/ly/doc/gradle/constant/TaskConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,18 @@ public class TaskConstants {
taskMap.put(GlobalConstants.SWAGGER_TASK, SwaggerTask.class);
// create websocket markdown
taskMap.put(GlobalConstants.WEBSOCKET_MARKDOWN_TASK, WebSocketMarkdownTask.class);
// create javadoc
// create javadoc html
taskMap.put(GlobalConstants.JAVADOC_HTML_TASK, JavadocHtmlTask.class);
// create javadoc adoc
taskMap.put(GlobalConstants.JAVADOC_ADOC_TASK, JavadocAdocTask.class);
// create javadoc markdown
taskMap.put(GlobalConstants.JAVADOC_MARKDOWN_TASK, JavadocMarkdownTask.class);
// create gRPC html
taskMap.put(GlobalConstants.GRPC_HTML_TASK, GrpcHtmlTask.class);
// create gRPC adoc
taskMap.put(GlobalConstants.GRPC_ADOC_TASK, GrpcAdocTask.class);
// create gRPC markdown
taskMap.put(GlobalConstants.GRPC_MARKDOWN_TASK, GrpcMarkdownTask.class);

}
}
47 changes: 47 additions & 0 deletions src/main/java/com/ly/doc/gradle/task/GrpcAdocTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.grpc.GrpcAsciidocBuilder;
import com.ly.doc.builder.rpc.RpcAdocBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

/**
* grpc asciidoc task.
*
* @author linwumingshi
* @since 3.0.7
*/
public class GrpcAdocTask extends DocBaseTask {

@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
try {
GrpcAsciidocBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
}
47 changes: 47 additions & 0 deletions src/main/java/com/ly/doc/gradle/task/GrpcHtmlTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.grpc.GrpcHtmlBuilder;
import com.ly.doc.builder.rpc.RpcHtmlBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

/**
* grpc html task.
*
* @author linwumingshi
* @since 3.0.7
*/
public class GrpcHtmlTask extends DocBaseTask {

@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
try {
GrpcHtmlBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
}
46 changes: 46 additions & 0 deletions src/main/java/com/ly/doc/gradle/task/GrpcMarkdownTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.grpc.GrpcMarkdownBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

/**
* grpc markdown task.
*
* @author linwumingshi
* @since 3.0.7
*/
public class GrpcMarkdownTask extends DocBaseTask {

@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
try {
GrpcMarkdownBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
}
30 changes: 29 additions & 1 deletion src/main/java/com/ly/doc/gradle/task/JavadocAdocTask.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.javadoc.JavadocAdocBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

public class JavadocAdocTask extends DocBaseTask{
/**
* javadoc asciidoc task.
*
* @author shalousun
* @since 3.0.5
*/
public class JavadocAdocTask extends DocBaseTask {

@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/com/ly/doc/gradle/task/JavadocHtmlTask.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.javadoc.JavadocHtmlBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

public class JavadocHtmlTask extends DocBaseTask{
/**
* javadoc html task.
*
* @author shalousun
* @since 3.0.5
*/
public class JavadocHtmlTask extends DocBaseTask {
@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
try {
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/com/ly/doc/gradle/task/JavadocMarkdownTask.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
/*
* smart-doc
*
* Copyright (C) 2018-2024 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.ly.doc.gradle.task;

import com.ly.doc.builder.javadoc.JavadocMarkdownBuilder;
import com.ly.doc.model.ApiConfig;
import com.thoughtworks.qdox.JavaProjectBuilder;
import org.gradle.api.logging.Logger;

public class JavadocMarkdownTask extends DocBaseTask{
/**
* javadoc markdown task.
*
* @author shalousun
* @since 3.0.5
*/
public class JavadocMarkdownTask extends DocBaseTask {
@Override
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
try {
Expand Down