Skip to content

Commit

Permalink
feat: add rest-builder (rb) template
Browse files Browse the repository at this point in the history
  • Loading branch information
lgdd committed Sep 30, 2021
1 parent fea668a commit 83a0882
Show file tree
Hide file tree
Showing 15 changed files with 709 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lfr/pkg/assets/tpl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gradle/
build/
target/
5 changes: 5 additions & 0 deletions lfr/pkg/assets/tpl/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
subprojects {
configurations.all {
resolutionStrategy.force 'com.liferay:com.liferay.portal.vulcan.api:7.13.0'
}
}
5 changes: 5 additions & 0 deletions lfr/pkg/assets/tpl/rb/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
subprojects {
configurations.all {
resolutionStrategy.force 'com.liferay:com.liferay.portal.vulcan.api:7.13.0'
}
}
69 changes: 69 additions & 0 deletions lfr/pkg/assets/tpl/rb/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{.WorkspacePackage}}</groupId>
<artifactId>{{.WorkspaceName}}-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>{{.WorkspaceCamelCaseName}} :: Modules :: {{.CamelCaseName}}</name>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>5.2.0</version>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.ant.bnd</artifactId>
<version>3.2.6</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<modules>
<module>{{.Name}}-api</module>
<module>{{.Name}}-impl</module>
</modules>
</project>
6 changes: 6 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-api/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bundle-Name: {{.CamelCaseName}} API
Bundle-SymbolicName: {{.Package}}.api
Bundle-Version: 1.0.0
Export-Package:\
{{.Package}}.dto.v1_0,\
{{.Package}}.resource.v1_0
14 changes: 14 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dependencies {
compileOnly group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.10.3"
compileOnly group: "com.liferay", name: "com.liferay.petra.function"
compileOnly group: "com.liferay", name: "com.liferay.petra.string"
compileOnly group: "com.liferay", name: "com.liferay.portal.vulcan.api", version: "7.13.0"
compileOnly group: "com.liferay", name: "javax.xml.bind"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
compileOnly group: "io.swagger.core.v3", name: "swagger-annotations", version: "2.0.5"
compileOnly group: "javax.annotation", name: "javax.annotation-api", version: "1.3.2"
compileOnly group: "javax.validation", name: "validation-api", version: "2.0.1.Final"
compileOnly group: "javax.ws.rs", name: "javax.ws.rs-api"
compileOnly group: "org.apache.felix", name: "org.apache.felix.http.servlet-api", version: "1.1.2"
compileOnly group: "org.osgi", name: "org.osgi.annotation.versioning"
}
87 changes: 87 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0"?>

<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>{{.WorkspaceCamelCaseName}} :: Modules :: {{.CamelCaseName}} :: {{.CamelCaseName}} API</name>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.10.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.petra.function</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.petra.string</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.vulcan.api</artifactId>
<version>7.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>javax.xml.bind</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.servlet-api</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
3 changes: 3 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-impl/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bundle-Name: {{.CamelCaseName}} Impl
Bundle-SymbolicName: {{.Package}}.impl
Bundle-Version: 1.0.0
25 changes: 25 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-impl/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
dependencies {
compile project(":modules:{{.Name}}:{{.Name}}-api")

compileOnly group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.10.3"
compileOnly group: "com.liferay", name: "com.liferay.petra.function"
compileOnly group: "com.liferay", name: "com.liferay.petra.string"
compileOnly group: "com.liferay", name: "com.liferay.portal.odata.api"
compileOnly group: "com.liferay", name: "com.liferay.portal.vulcan.api", version: "7.13.0"
compileOnly group: "com.liferay", name: "javax.xml.bind"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
compileOnly group: "commons-collections", name: "commons-collections"
compileOnly group: "io.swagger.core.v3", name: "swagger-annotations", version: "2.0.5"
compileOnly group: "javax.annotation", name: "javax.annotation-api", version: "1.3.2"
compileOnly group: "javax.validation", name: "validation-api", version: "2.0.1.Final"
compileOnly group: "javax.ws.rs", name: "javax.ws.rs-api"
compileOnly group: "org.apache.felix", name: "org.apache.felix.http.servlet-api", version: "1.1.2"
compileOnly group: "org.osgi", name: "org.osgi.service.component", version: "1.3.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
compileOnly group: "org.osgi", name: "org.osgi.core"

restBuilder group: "com.liferay", name: "com.liferay.portal.tools.rest.builder", version: "1.0.167"
}

group = "{{.Name}}"
126 changes: 126 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0"?>

<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>{{.WorkspaceCamelCaseName}} :: Modules :: {{.CamelCaseName}} :: {{.CamelCaseName}} Service</name>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.10.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.petra.function</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.petra.string</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.odata.api</artifactId>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.vulcan.api</artifactId>
<version>7.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>javax.xml.bind</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.impl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.servlet-api</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component</artifactId>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>{{.Package}}</groupId>
<artifactId>{{.Name}}-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.tools.rest.builder</artifactId>
<version>1.0.167</version>
</plugin>
</plugins>
</build>
</project>
9 changes: 9 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-impl/rest-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiDir: "../{{.Name}}-api/src/main/java"
apiPackagePath: "{{.Package}}"
application:
baseURI: "/{{.Name}}"
className: "{{.CamelCaseName}}Application"
name: "{{.CamelCaseName}}"
author: "{{.User}}"
clientDir: "../{{.Name}}-client/src/main/java"
testDir: "../{{.Name}}-test/src/testIntegration/java"
8 changes: 8 additions & 0 deletions lfr/pkg/assets/tpl/rb/rb-impl/rest-openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
info:
description: "{{.CamelCaseName}} REST API"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
title: "{{.CamelCaseName}}"
version: v1.0
openapi: 3.0.1
1 change: 1 addition & 0 deletions lfr/pkg/cmd/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func init() {
Cmd.AddCommand(createSpringPortlet)
Cmd.AddCommand(createApiModule)
Cmd.AddCommand(createServiceBuilder)
Cmd.AddCommand(createRestBuilder)
Cmd.AddCommand(createDocker)
Cmd.PersistentFlags().StringVarP(&project.PackageName, "package", "p", "org.acme", "base package name")
}
Expand Down
Loading

0 comments on commit 83a0882

Please sign in to comment.