Generate copyright year in swagger template code
- exclude generated source code from checkstyle by default
Change-Id: I3f79183a8aae1f24d36558860555b5b0298cd8c3
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};