-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
130 lines (114 loc) · 3.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.PHONY: clean compare-upstream
LATEST_UPSTREAM_COMMIT=96d9522
PLUGIN_SRC = \
bin/protoc_plugin.dart \
lib/**/*.dart
OUTPUT_DIR=out
PLUGIN_NAME=protoc-gen-dart
PLUGIN_PATH=bin/$(PLUGIN_NAME)
TEST_PROTO_LIST = \
_leading_underscores \
google/protobuf/any \
google/protobuf/api \
google/protobuf/duration \
google/protobuf/empty \
google/protobuf/field_mask \
google/protobuf/source_context \
google/protobuf/struct \
google/protobuf/timestamp \
google/protobuf/type \
google/protobuf/unittest_import \
google/protobuf/unittest_optimize_for \
google/protobuf/unittest_well_known_types \
google/protobuf/unittest \
google/protobuf/wrappers \
custom_option \
dart_name \
default_value_escape \
entity \
enum_extension \
enum_name \
extend_unittest \
ExtensionEnumNameConflict \
ExtensionNameConflict \
foo \
high_tagnumber \
import_clash \
import_public \
json_name \
map_api \
map_api2 \
map_enum_value \
map_field \
message_set \
mixins \
multiple_files_test \
nested_any \
nested_extension \
nested_message \
non_nested_extension \
oneof \
reserved_names \
reserved_names_extension \
reserved_names_message \
duplicate_names_import \
package1 \
package2 \
package3 \
proto2_repeated \
proto3_optional \
proto3_repeated \
service \
service2 \
service3 \
toplevel_import \
toplevel \
using_any
TEST_PROTO_DIR=$(OUTPUT_DIR)/protos
TEST_PROTO_LIBS=$(foreach f, $(TEST_PROTO_LIST), \
$(TEST_PROTO_DIR)/$(f).pb.dart \
$(TEST_PROTO_DIR)/$(f).pbenum.dart \
$(TEST_PROTO_DIR)/$(f).pbserver.dart \
$(TEST_PROTO_DIR)/$(f).pbjson.dart)
TEST_PROTO_SRC_DIR=test/protos
TEST_PROTO_SRCS=$(foreach proto, $(TEST_PROTO_LIST), \
$(TEST_PROTO_SRC_DIR)/$(proto).proto)
PREGENERATED_SRCS=protos/descriptor.proto protos/plugin.proto protos/dart_options.proto
$(TEST_PROTO_LIBS): $(PLUGIN_SRC) $(TEST_PROTO_SRCS)
mkdir -p $(TEST_PROTO_DIR)
protoc\
--experimental_allow_proto3_optional\
--dart_out="disable_constructor_args:$(TEST_PROTO_DIR)"\
-Iprotos\
-I$(TEST_PROTO_SRC_DIR)\
--plugin=protoc-gen-dart=$(realpath $(PLUGIN_PATH))\
$(TEST_PROTO_SRCS)
mkdir -p $(TEST_PROTO_DIR)/constructor_args
protoc\
--experimental_allow_proto3_optional\
--dart_out="$(TEST_PROTO_DIR)/constructor_args"\
-Iprotos\
-I$(TEST_PROTO_SRC_DIR)\
--plugin=protoc-gen-dart=$(realpath $(PLUGIN_PATH))\
$(TEST_PROTO_SRCS)
dart format $(TEST_PROTO_DIR)
update-pregenerated: $(PLUGIN_PATH) $(PREGENERATED_SRCS)
protoc --dart_out=lib/src/generated -Iprotos --plugin=protoc-gen-dart=$(realpath $(PLUGIN_PATH)) $(PREGENERATED_SRCS)
rm lib/src/generated/descriptor.pb{json,server}.dart
rm lib/src/generated/dart_options.pb{enum,json,server}.dart
rm lib/src/generated/plugin.pb{json,server}.dart
dart format lib/src/generated
protos: $(PLUGIN_PATH) $(TEST_PROTO_LIBS)
run-tests: protos
dart test
dart run -Dprotobuf.omit_enum_names=false test/omit_enum_names_test.dart
dart run -Dprotobuf.omit_enum_names=true test/omit_enum_names_test.dart
update-goldens: protos
rm -rf test/goldens
dart test
clean:
rm -rf $(OUTPUT_DIR)
compare-upstream:
git submodule init
git submodule update
cd protobuf.dart && git diff --name-only $(LATEST_UPSTREAM_COMMIT) | grep -E "^protoc_plugin" | xargs -I{} echo {}