1# Copyright 2023 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5 6def Generate(jni_objs, *, gen_jni_class, script_name): 7 sb = [] 8 sb.append(f"""\ 9// 10// This file is a placeholder. It was generated by {script_name} 11// 12 13package {gen_jni_class.package_with_dots}; 14 15public class {gen_jni_class.name} {{ 16 public static boolean TESTING_ENABLED; 17 public static boolean REQUIRE_MOCK; 18""") 19 20 for jni_obj in jni_objs: 21 for native in jni_obj.proxy_natives: 22 sig_params = native.proxy_params.to_java_declaration() 23 sb.append(f""" 24 public static native {native.proxy_return_type.to_java()} {native.proxy_name}\ 25({sig_params});""") 26 27 sb.append('\n}\n') 28 return ''.join(sb) 29