contrib/jwrapper: Auto-generate licence
authorFrédéric Vachon <fredvac@gmail.com>
Mon, 4 Aug 2014 01:52:03 +0000 (21:52 -0400)
committerFrédéric Vachon <fredvac@gmail.com>
Thu, 7 Aug 2014 01:23:56 +0000 (21:23 -0400)
Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

contrib/jwrapper/src/code_generator.nit

index 189aa27..8192855 100644 (file)
@@ -71,6 +71,7 @@ class CodeGenerator
                        imports.add("import android::{import_}\n")
                end
 
+               file_out.write(gen_licence)
                file_out.write("module {module_name}\n")
                file_out.write(imports.join(""))
                file_out.write("\n")
@@ -78,6 +79,28 @@ class CodeGenerator
                file_out.write(wrappers.join(""))
        end
 
+       fun gen_licence: String
+       do
+               return """# This file is part of NIT (http://www.nitlanguage.org).
+#
+# Copyright [Year] [Author name] <Author e-mail>
+#
+# Licensed 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.
+
+# This code has been generated using `javap`
+"""
+       end
+
        fun gen_class_header(jtype: JavaType): String
        do
                var temp = new Array[String]