|
1 | 1 | #!/usr/bin/env python3
|
| 2 | +# Copyright 2025 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +"""Generate stubs and function pointers for Windows SDK""" |
2 | 17 |
|
3 | 18 | import argparse
|
4 | 19 | import os
|
5 | 20 | import re
|
6 | 21 | import sys
|
7 | 22 |
|
8 | 23 | HEADER_GUARD_PREFIX = "FIREBASE_ANALYTICS_SRC_WINDOWS_"
|
9 |
| -INCLUDE_PATH = "src/windows" |
| 24 | +INCLUDE_PATH = "src/windows/" |
10 | 25 | INCLUDE_PREFIX = "analytics/" + INCLUDE_PATH
|
| 26 | +COPYRIGHT_NOTICE = """// Copyright 2025 Google LLC |
| 27 | +// |
| 28 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 29 | +// you may not use this file except in compliance with the License. |
| 30 | +// You may obtain a copy of the License at |
| 31 | +// |
| 32 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 33 | +// |
| 34 | +// Unless required by applicable law or agreed to in writing, software |
| 35 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 36 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 37 | +// See the License for the specific language governing permissions and |
| 38 | +// limitations under the License. |
| 39 | +
|
| 40 | +""" |
11 | 41 |
|
12 | 42 | def generate_function_pointers(header_file_path, output_h_path, output_c_path):
|
13 | 43 | """
|
@@ -85,6 +115,7 @@ def generate_function_pointers(header_file_path, output_h_path, output_c_path):
|
85 | 115 | # --- Write the self-contained Header File (.h) ---
|
86 | 116 | header_guard = f"{HEADER_GUARD_PREFIX}{os.path.basename(output_h_path).upper().replace('.', '_')}_"
|
87 | 117 | with open(output_h_path, 'w', encoding='utf-8') as f:
|
| 118 | + f.write(f"{COPYRIGHT_NOTICE}") |
88 | 119 | f.write(f"// Generated from {os.path.basename(header_file_path)}\n")
|
89 | 120 | f.write(f"// This is a self-contained header file.\n\n")
|
90 | 121 | f.write(f"#ifndef {header_guard}\n")
|
@@ -114,6 +145,7 @@ def generate_function_pointers(header_file_path, output_h_path, output_c_path):
|
114 | 145 |
|
115 | 146 | # --- Write the Source File (.c) ---
|
116 | 147 | with open(output_c_path, 'w', encoding='utf-8') as f:
|
| 148 | + f.write(f"{COPYRIGHT_NOTICE}") |
117 | 149 | f.write(f"// Generated from {os.path.basename(header_file_path)}\n\n")
|
118 | 150 | f.write(f'#include "{INCLUDE_PREFIX}{os.path.basename(output_h_path)}"\n')
|
119 | 151 | f.write('#include <stddef.h> // For NULL\n\n')
|
|
0 commit comments