Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proto generation fails on Windows with trailing comments #2905

Open
yschimke opened this issue Apr 14, 2024 · 0 comments · May be fixed by #2908
Open

Proto generation fails on Windows with trailing comments #2905

yschimke opened this issue Apr 14, 2024 · 0 comments · May be fixed by #2908

Comments

@yschimke
Copy link

enum ImageState {
    IMAGE_STATE_UNSPECIFIED = 0;
    IMAGE_STATE_READONLY = 1;     /* unlocked */
    IMAGE_STATE_MUSTLOCK = 2;     /* must be locked */
    IMAGE_STATE_LOCKED = 3;       /* locked */
    IMAGE_STATE_LOCKED_EMPTY = 4; /* locked and empty */
    IMAGE_STATE_TEMPORARY = 5;    /* copied to temp file (no lock needed) */
}

fails with

Caused by: java.lang.IllegalStateException: Syntax error in C:\Users\yuri\StudioProjects\emulator-tools\emulator-proto\src\commonMain\proto/avd_service.proto:51:50: no syntax may follow trailing comment
	at com.squareup.wire.schema.internal.parser.SyntaxReader.unexpected(SyntaxReader.kt:424)
	at com.squareup.wire.schema.internal.parser.SyntaxReader.tryAppendTrailingDocumentation(SyntaxReader.kt:467)
	at com.squareup.wire.schema.internal.parser.ProtoParser.readEnumConstant(ProtoParser.kt:569)
	at com.squareup.wire.schema.internal.parser.ProtoParser.readDeclaration(ProtoParser.kt:169)
	at com.squareup.wire.schema.internal.parser.ProtoParser.readEnumElement(ProtoParser.kt:294)
	at com.squareup.wire.schema.internal.parser.ProtoParser.readDeclaration(ProtoParser.kt:148)
	at com.squareup.wire.schema.internal.parser.ProtoParser.readProtoFile(ProtoParser.kt:69)
	at com.squareup.wire.schema.internal.parser.ProtoParser$Companion.parse(ProtoParser.kt:664)
	at com.squareup.wire.schema.RootsKt.parse(Roots.kt:66)
	at com.squareup.wire.schema.internal.CommonSchemaLoader.load(CommonSchemaLoader.kt:166)
	at com.squareup.wire.schema.internal.CommonSchemaLoader.loadSourcePathFiles$wire_schema(CommonSchemaLoader.kt:120)
	at com.squareup.wire.schema.internal.CommonSchemaLoader.loadSchema(CommonSchemaLoader.kt:103)
	at com.squareup.wire.schema.SchemaLoader.loadSchema(SchemaLoader.kt:77)
	at com.squareup.wire.schema.WireRun.execute$wire_schema(WireRun.kt:248)
	at com.squareup.wire.schema.WireRun.execute(WireRun.kt:234)
	at com.squareup.wire.gradle.WireTask.generateWireFiles(WireTask.kt:178)

Check seems harsh

        // Ensure nothing follows a trailing star comment.
        while (pos < data.size) {
          val c = data[pos++]
          if (c == '\n') {
            newline()
            break
          }
          expect(c == ' ' || c == '\t') { "no syntax may follow trailing comment" }
        }
@oldergod oldergod linked a pull request Apr 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant