Generate copyright year in swagger template code
- exclude generated source code from checkstyle by default
Change-Id: I3f79183a8aae1f24d36558860555b5b0298cd8c3
diff --git a/lib/pom.xml b/lib/pom.xml
index de64efb..1ec77c7 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -39,7 +39,7 @@
<onos-build-conf.version>1.13.0-SNAPSHOT</onos-build-conf.version>
<netty4.version>4.1.8.Final</netty4.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>
<osgi.version>5.0.0</osgi.version>
<karaf.version>3.0.8</karaf.version>
@@ -714,6 +714,7 @@
<artifactId>grpc-core</artifactId>
<version>${grpccore.version}</version>
</dependency>
+
</dependencies>
<build>
diff --git a/pom.xml b/pom.xml
index 0c2eeb2..c6672d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,6 +70,7 @@
<module>tools/package/archetypes</module>
<module>tools/package/branding</module>
+ <module>tools/package/maven-plugin</module>
<module>pipelines</module>
</modules>
diff --git a/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/SwaggerGenerator.java b/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/SwaggerGenerator.java
index 88850e8..e567c81 100644
--- a/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/SwaggerGenerator.java
+++ b/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/SwaggerGenerator.java
@@ -33,6 +33,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
+import java.time.Year;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -502,7 +503,9 @@
src = src.replace("${api.package}", apiPackage)
.replace("${web.context}", webContext)
.replace("${api.title}", apiTitle)
- .replace("${api.description}", apiDescription);
+ .replace("${api.description}", apiDescription)
+ .replace("${year}", Year.now().toString());
+
Files.write(src.getBytes(), reg);
} catch (IOException e) {
throw new RuntimeException("Unable to write " + reg, e);
diff --git a/tools/build/buck-plugin/src/main/resources/registrator.javat b/tools/build/buck-plugin/src/main/resources/registrator.javat
index 703feb2..6596450 100644
--- a/tools/build/buck-plugin/src/main/resources/registrator.javat
+++ b/tools/build/buck-plugin/src/main/resources/registrator.javat
@@ -1,7 +1,5 @@
/*
- * Auto-generated by OnosSwaggerMojo.
- *
- * Copyright 2016-present Open Networking Foundation
+ * Copyright ${year}-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (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.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * Auto-generated by OnosSwaggerMojo.
+ *
*/
package ${api.package};
diff --git a/tools/build/conf/src/main/resources/onos/suppressions.xml b/tools/build/conf/src/main/resources/onos/suppressions.xml
index bfa6412..dce87bc 100644
--- a/tools/build/conf/src/main/resources/onos/suppressions.xml
+++ b/tools/build/conf/src/main/resources/onos/suppressions.xml
@@ -54,4 +54,8 @@
<!-- Suppressions for yangutils generated code -->
<suppress files="org.onosproject.yang.gen.v1.*" checks="Javadoc.*" />
+
+ <!-- Suppress checks for Maven-generated code -->
+ <suppress files="[/\\]target[/\\]" checks=".*"/>
+
</suppressions>
diff --git a/tools/package/maven-plugin/pom.xml b/tools/package/maven-plugin/pom.xml
index 0b33262..608ee23 100644
--- a/tools/package/maven-plugin/pom.xml
+++ b/tools/package/maven-plugin/pom.xml
@@ -26,7 +26,7 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>1.11-SNAPSHOT</version>
+ <version>1.13.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>Maven plugin for packaging ONOS applications or generating
diff --git a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
index fb0eab5..0d44913 100644
--- a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
+++ b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
@@ -41,6 +41,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
+import java.time.Year;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -477,7 +478,8 @@
src = src.replace("${api.package}", apiPackage)
.replace("${web.context}", webContext)
.replace("${api.title}", apiTitle)
- .replace("${api.description}", apiTitle);
+ .replace("${api.description}", apiTitle)
+ .replace("${year}", Year.now().toString());
Files.write(src.getBytes(), reg);
} catch (IOException e) {
getLog().warn("Unable to write " + reg);
diff --git a/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat b/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
index 1e15d45..6596450 100644
--- a/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
+++ b/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
@@ -1,7 +1,5 @@
/*
- * Auto-generated by OnosSwaggerMojo.
- *
- * Copyright 2015-present Open Networking Foundation
+ * Copyright ${year}-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (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.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * Auto-generated by OnosSwaggerMojo.
+ *
*/
package ${api.package};