@ohos-ports/protoc 36.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,157 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ //
31
+ // Wrappers for primitive (non-message) types. These types were needed
32
+ // for legacy reasons and are not recommended for use in new APIs.
33
+ //
34
+ // Historically these wrappers were useful to have presence on proto3 primitive
35
+ // fields, but proto3 syntax has been updated to support the `optional` keyword.
36
+ // Using that keyword is now the strongly preferred way to add presence to
37
+ // proto3 primitive fields.
38
+ //
39
+ // A secondary usecase was to embed primitives in the `google.protobuf.Any`
40
+ // type: it is now recommended that you embed your value in your own wrapper
41
+ // message which can be specifically documented.
42
+ //
43
+ // These wrappers have no meaningful use within repeated fields as they lack
44
+ // the ability to detect presence on individual elements.
45
+ // These wrappers have no meaningful use within a map or a oneof since
46
+ // individual entries of a map or fields of a oneof can already detect presence.
47
+
48
+ syntax = "proto3";
49
+
50
+ package google.protobuf;
51
+
52
+ option cc_enable_arenas = true;
53
+ option go_package = "google.golang.org/protobuf/types/known/wrapperspb";
54
+ option java_package = "com.google.protobuf";
55
+ option java_outer_classname = "WrappersProto";
56
+ option java_multiple_files = true;
57
+ option objc_class_prefix = "GPB";
58
+ option csharp_namespace = "Google.Protobuf.WellKnownTypes";
59
+
60
+ // Wrapper message for `double`.
61
+ //
62
+ // The JSON representation for `DoubleValue` is JSON number.
63
+ //
64
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
65
+ // has no plan to be removed.
66
+ message DoubleValue {
67
+ // The double value.
68
+ double value = 1;
69
+ }
70
+
71
+ // Wrapper message for `float`.
72
+ //
73
+ // The JSON representation for `FloatValue` is JSON number.
74
+ //
75
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
76
+ // has no plan to be removed.
77
+ message FloatValue {
78
+ // The float value.
79
+ float value = 1;
80
+ }
81
+
82
+ // Wrapper message for `int64`.
83
+ //
84
+ // The JSON representation for `Int64Value` is JSON string.
85
+ //
86
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
87
+ // has no plan to be removed.
88
+ message Int64Value {
89
+ // The int64 value.
90
+ int64 value = 1;
91
+ }
92
+
93
+ // Wrapper message for `uint64`.
94
+ //
95
+ // The JSON representation for `UInt64Value` is JSON string.
96
+ //
97
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
98
+ // has no plan to be removed.
99
+ message UInt64Value {
100
+ // The uint64 value.
101
+ uint64 value = 1;
102
+ }
103
+
104
+ // Wrapper message for `int32`.
105
+ //
106
+ // The JSON representation for `Int32Value` is JSON number.
107
+ //
108
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
109
+ // has no plan to be removed.
110
+ message Int32Value {
111
+ // The int32 value.
112
+ int32 value = 1;
113
+ }
114
+
115
+ // Wrapper message for `uint32`.
116
+ //
117
+ // The JSON representation for `UInt32Value` is JSON number.
118
+ //
119
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
120
+ // has no plan to be removed.
121
+ message UInt32Value {
122
+ // The uint32 value.
123
+ uint32 value = 1;
124
+ }
125
+
126
+ // Wrapper message for `bool`.
127
+ //
128
+ // The JSON representation for `BoolValue` is JSON `true` and `false`.
129
+ //
130
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
131
+ // has no plan to be removed.
132
+ message BoolValue {
133
+ // The bool value.
134
+ bool value = 1;
135
+ }
136
+
137
+ // Wrapper message for `string`.
138
+ //
139
+ // The JSON representation for `StringValue` is JSON string.
140
+ //
141
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
142
+ // has no plan to be removed.
143
+ message StringValue {
144
+ // The string value.
145
+ string value = 1;
146
+ }
147
+
148
+ // Wrapper message for `bytes`.
149
+ //
150
+ // The JSON representation for `BytesValue` is JSON string.
151
+ //
152
+ // Not recommended for use in new APIs, but still useful for legacy APIs and
153
+ // has no plan to be removed.
154
+ message BytesValue {
155
+ // The bytes value.
156
+ bytes value = 1;
157
+ }
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@ohos-ports/protoc",
3
+ "version": "36.0.0-beta.0",
4
+ "upstreamVersion": "v36.0",
5
+ "description": "Installs the protocol buffer compiler \"protoc\" for you.",
6
+ "bin": {
7
+ "protoc": "protoc.cjs"
8
+ },
9
+ "engines": {
10
+ "node": ">=20.0.0"
11
+ },
12
+ "type": "commonjs",
13
+ "license": "Apache-2.0",
14
+ "author": "Timo Stamm <ts@timostamm.com>",
15
+ "homepage": "https://github.com/ohos-ports/ohos-ports",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
19
+ "directory": "ports/protoc/36.0.0"
20
+ },
21
+ "keywords": [
22
+ "Protocol Buffers",
23
+ "protobuf",
24
+ "protoc",
25
+ "installation",
26
+ "openharmony",
27
+ "ohos"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "files": [
33
+ "protoc.cjs",
34
+ "assets.json",
35
+ "README.md",
36
+ "bin/",
37
+ "include/"
38
+ ],
39
+ "optionalDependencies": {
40
+ "@ohos-ports/protoc-openharmony-arm64": "^36.0.0-beta.0"
41
+ }
42
+ }
package/protoc.cjs ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Modified protoc launcher for @ohos-ports/protoc
5
+ // Resolves openharmony binary from @ohos-ports/protoc-openharmony-arm64 dependency
6
+
7
+ var import_node_path = require("node:path");
8
+ var import_node_child_process = require("node:child_process");
9
+ var import_node_fs = require("node:fs");
10
+
11
+ var rootDir = __dirname.endsWith("src") ? import_node_path.dirname(__dirname) : __dirname;
12
+ var assets = JSON.parse(
13
+ import_node_fs.readFileSync(import_node_path.join(rootDir, "assets.json"), "utf-8")
14
+ );
15
+
16
+ var asset = assets.find(
17
+ function (a) { return a.arch === process.arch && a.platform === process.platform; }
18
+ );
19
+
20
+ if (!asset) {
21
+ throw new Error(
22
+ "No protoc executable available for your platform (" + process.platform + ") and architecture (" + process.arch + ")"
23
+ );
24
+ }
25
+
26
+ var command = import_node_path.join(rootDir, "bin", asset.executable);
27
+
28
+ // If binary not found locally, try resolving from the platform-specific dependency
29
+ if (!import_node_fs.existsSync(command)) {
30
+ var depPkg = "@ohos-ports/protoc-" + process.platform + "-" + process.arch;
31
+ try {
32
+ var depPath = require.resolve(depPkg + "/package.json");
33
+ var depDir = import_node_path.dirname(depPath);
34
+ command = import_node_path.join(depDir, "bin", asset.executable);
35
+ } catch (e) {
36
+ // Fallback: try node_modules path directly
37
+ var nmPath = import_node_path.join(rootDir, "node_modules", depPkg, "bin", asset.executable);
38
+ if (import_node_fs.existsSync(nmPath)) {
39
+ command = nmPath;
40
+ }
41
+ }
42
+ }
43
+
44
+ var p = import_node_child_process.spawnSync(command, process.argv.slice(2), {
45
+ stdio: "inherit"
46
+ });
47
+
48
+ if (p.error !== void 0) {
49
+ throw p.error;
50
+ }
51
+ process.exit(p.status !== null ? p.status : 0);