Skip to content

Commit 808b058

Browse files
authored
Generate one enum per enum case for the testing.
This is a workaround for apple#904, the underlying problem is still there, but this makes the generated source file for testing "work" in that it doesn't hit the compile failure. A real solution is still needed for large enums.
1 parent ed9913b commit 808b058

File tree

4 files changed

+79333
-7766
lines changed

4 files changed

+79333
-7766
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,12 @@ Protos/generated_swift_names_enum_cases.proto: Protos/mined_words.txt
461461
@echo '// Swift compile errors are probably bugs in protoc-gen-swift' >> $@
462462
@echo 'syntax = "proto3";' >> $@
463463
@echo 'package protobuf_unittest_generated;' >> $@
464-
@echo 'enum GeneratedSwiftReservedEnum {' >> $@
465-
@echo ' NONE = 0;' >> $@
466-
@cat Protos/mined_words.txt | awk 'BEGIN{n = 1} {print " " $$1 " = " n ";"; n += 1 }' >> $@
467-
@echo '}' >> $@
464+
@#See https://github.com/apple/swift-protobuf/issues/904 for why this isn't one enum.
465+
@#echo 'enum GeneratedSwiftReservedEnum {' >> $@
466+
@#echo ' NONE = 0;' >> $@
467+
@#cat Protos/mined_words.txt | awk 'BEGIN{n = 1} {print " " $$1 " = " n ";"; n += 1 }' >> $@
468+
@#echo '}' >> $@
469+
@cat Protos/mined_words.txt | awk 'BEGIN{n = 1} {print "enum GeneratedSwiftReservedEnum" n " { NONE_" n " = 0; " $$1 " = 1; }"; n += 1 }' >> $@
468470

469471
Protos/generated_swift_names_messages.proto: Protos/mined_words.txt
470472
@echo Building $@

0 commit comments

Comments
 (0)