Generate copyright year in swagger template code

- exclude generated source code from checkstyle by default

Change-Id: I3f79183a8aae1f24d36558860555b5b0298cd8c3
This commit is contained in:
Yuta HIGUCHI 2018-03-07 16:42:11 -08:00 committed by Thomas Vachuska
parent 4e360499cc
commit bcc2ce9c3f
8 changed files with 23 additions and 10 deletions

View File

@ -39,7 +39,7 @@
<onos-build-conf.version>1.13.0-SNAPSHOT</onos-build-conf.version> <onos-build-conf.version>1.13.0-SNAPSHOT</onos-build-conf.version>
<netty4.version>4.1.8.Final</netty4.version> <netty4.version>4.1.8.Final</netty4.version>
<openflowj.version>3.2.0.onos</openflowj.version> <openflowj.version>3.2.0.onos</openflowj.version>
<onos-maven-plugin.version>1.11</onos-maven-plugin.version> <onos-maven-plugin.version>${project.version}</onos-maven-plugin.version>
<onos-yang-tools.version>2.4</onos-yang-tools.version> <onos-yang-tools.version>2.4</onos-yang-tools.version>
<osgi.version>5.0.0</osgi.version> <osgi.version>5.0.0</osgi.version>
<karaf.version>3.0.8</karaf.version> <karaf.version>3.0.8</karaf.version>
@ -714,6 +714,7 @@
<artifactId>grpc-core</artifactId> <artifactId>grpc-core</artifactId>
<version>${grpccore.version}</version> <version>${grpccore.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -70,6 +70,7 @@
<module>tools/package/archetypes</module> <module>tools/package/archetypes</module>
<module>tools/package/branding</module> <module>tools/package/branding</module>
<module>tools/package/maven-plugin</module>
<module>pipelines</module> <module>pipelines</module>
</modules> </modules>

View File

@ -33,6 +33,7 @@ import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.time.Year;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -502,7 +503,9 @@ public class SwaggerGenerator {
src = src.replace("${api.package}", apiPackage) src = src.replace("${api.package}", apiPackage)
.replace("${web.context}", webContext) .replace("${web.context}", webContext)
.replace("${api.title}", apiTitle) .replace("${api.title}", apiTitle)
.replace("${api.description}", apiDescription); .replace("${api.description}", apiDescription)
.replace("${year}", Year.now().toString());
Files.write(src.getBytes(), reg); Files.write(src.getBytes(), reg);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Unable to write " + reg, e); throw new RuntimeException("Unable to write " + reg, e);

View File

@ -1,7 +1,5 @@
/* /*
* Auto-generated by OnosSwaggerMojo. * Copyright ${year}-present Open Networking Foundation
*
* Copyright 2016-present Open Networking Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* Auto-generated by OnosSwaggerMojo.
*
*/ */
package ${api.package}; package ${api.package};

View File

@ -54,4 +54,8 @@
<!-- Suppressions for yangutils generated code --> <!-- Suppressions for yangutils generated code -->
<suppress files="org.onosproject.yang.gen.v1.*" checks="Javadoc.*" /> <suppress files="org.onosproject.yang.gen.v1.*" checks="Javadoc.*" />
<!-- Suppress checks for Maven-generated code -->
<suppress files="[/\\]target[/\\]" checks=".*"/>
</suppressions> </suppressions>

View File

@ -26,7 +26,7 @@
<groupId>org.onosproject</groupId> <groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId> <artifactId>onos-maven-plugin</artifactId>
<version>1.11-SNAPSHOT</version> <version>1.13.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging> <packaging>maven-plugin</packaging>
<description>Maven plugin for packaging ONOS applications or generating <description>Maven plugin for packaging ONOS applications or generating

View File

@ -41,6 +41,7 @@ import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.time.Year;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -477,7 +478,8 @@ public class OnosSwaggerMojo extends AbstractMojo {
src = src.replace("${api.package}", apiPackage) src = src.replace("${api.package}", apiPackage)
.replace("${web.context}", webContext) .replace("${web.context}", webContext)
.replace("${api.title}", apiTitle) .replace("${api.title}", apiTitle)
.replace("${api.description}", apiTitle); .replace("${api.description}", apiTitle)
.replace("${year}", Year.now().toString());
Files.write(src.getBytes(), reg); Files.write(src.getBytes(), reg);
} catch (IOException e) { } catch (IOException e) {
getLog().warn("Unable to write " + reg); getLog().warn("Unable to write " + reg);

View File

@ -1,7 +1,5 @@
/* /*
* Auto-generated by OnosSwaggerMojo. * Copyright ${year}-present Open Networking Foundation
*
* Copyright 2015-present Open Networking Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* Auto-generated by OnosSwaggerMojo.
*
*/ */
package ${api.package}; package ${api.package};