Unfortunately, this is still broken. It seems, that antlrplugin itself is already adding the generated files to java source sets [1].
E.g. Avro Plugin does behave differently here. Although source code seems to indicate it does the same [2], after contemplating a while I realised, that we are running an older version (0.11.0), where this was not yet implemented - it got included in 0.12.0. So probably Reuven was just right to suggesting to add include/exclude patterns. [1] https://github.com/gradle/gradle/blob/master/subprojects/antlr/src/main/java/org/gradle/api/plugins/antlr/AntlrPlugin.java#L98-L100 [2] https://github.com/commercehub-oss/gradle-avro-plugin/blob/master/src/main/java/com/commercehub/gradle/plugin/avro/AvroPlugin.java#L140 On Sat, Jan 19, 2019 at 7:36 PM Reuven Lax <[email protected]> wrote: > This should be fixed now. > > On Fri, Jan 18, 2019 at 11:15 PM Michael Luckey < > [email protected]> wrote: > >> Something weird is going on here. >> >> A 'clean check' does not reexecute spotlessJava here after execution of >> spotlessApply... a --rerun-tasks triggers that failure repeatedly.... >> >> Regarding the license header, could it be that you executed spotlessApply >> once and now it is fetched from the build cache, with appropriate >> formatting? >> >> On Fri, Jan 18, 2019 at 5:33 PM Reuven Lax <[email protected]> wrote: >> >>> Does this only happen on fresh clones? I created a fresh branch synced >>> to origin/master, and I can't reproduce this still. >>> >>> If spotless is running against generated code, that seems like a bug in >>> our spotless setup. Should be trivial to fix by creating a target block in >>> our spotless config. >>> >>> Reuven >>> >>> On Fri, Jan 18, 2019 at 8:07 AM Ismaël Mejía <[email protected]> wrote: >>> >>>> Just make a fresh clone and run `./gradlew check -p sdks/java/core` it >>>> should break. If you add 'spotlessApply' the build passes but this >>>> should not be the default, no?, the default is 'spotlessCheck' >>>> >>>> On Fri, Jan 18, 2019 at 5:02 PM Reuven Lax <[email protected]> wrote: >>>> > >>>> > I don't get those errors when I run spotlessApply, and I don't see >>>> those errors happening on Jenkins. Are you doing anything special to run >>>> spotless? In general, I don't think spotless was running on generated code >>>> before. >>>> > >>>> > On Fri, Jan 18, 2019 at 6:06 AM Ismaël Mejía <[email protected]> >>>> wrote: >>>> >> >>>> >> When running the build on master we got an error message. >>>> >> Looks related to the recent inclusion/generation of stuff with ANTLR. >>>> >> Can Reuven or someone else involved in this specific changes please >>>> >> take a look? >>>> >> >>>> >> > Task :beam-sdks-java-core:spotlessJava FAILED >>>> >> >>>> >> FAILURE: Build failed with an exception. >>>> >> >>>> >> * What went wrong: >>>> >> Execution failed for task ':beam-sdks-java-core:spotlessJava'. >>>> >> > The following files had format violations: >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationParser.java >>>> >> @@ -1,5 +1,3 @@ >>>> >> >>>> >>>> -//·Generated·from·java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotation.g4·by·ANTLR·4.7 >>>> >> - >>>> >> /* >>>> >> >>>> ·*·Licensed·to·the·Apache·Software·Foundation·(ASF)·under·one >>>> >> >>>> ·*·or·more·contributor·license·agreements.··See·the·NOTICE·file >>>> >> @@ -19,609 +17,737 @@ >>>> >> ·*/ >>>> >> package·org.apache.beam.sdk.schemas.parser.generated; >>>> >> >>>> >> +import·java.util.List; >>>> >> +import·org.antlr.v4.runtime.*; >>>> >> import·org.antlr.v4.runtime.atn.*; >>>> >> import·org.antlr.v4.runtime.dfa.DFA; >>>> >> -import·org.antlr.v4.runtime.*; >>>> >> import·org.antlr.v4.runtime.misc.*; >>>> >> import·org.antlr.v4.runtime.tree.*; >>>> >> -import·java.util.List; >>>> >> -import·java.util.Iterator; >>>> >> -import·java.util.ArrayList; >>>> >> >>>> >> >>>> @SuppressWarnings({"all",·"warnings",·"unchecked",·"unused",·"cast"}) >>>> >> public·class·FieldSpecifierNotationParser·extends·Parser·{ >>>> >> >>>> >>>> -\tstatic·{·RuntimeMetaData.checkVersion("4.7",·RuntimeMetaData.VERSION);·} >>>> >> +··static·{ >>>> >> >>>> +····RuntimeMetaData.checkVersion("4.7",·RuntimeMetaData.VERSION); >>>> >> +··} >>>> >> >>>> >> -\tprotected·static·final·DFA[]·_decisionToDFA; >>>> >> >>>> -\tprotected·static·final·PredictionContextCache·_sharedContextCache·= >>>> >> -\t\tnew·PredictionContextCache(); >>>> >> -\tpublic·static·final·int >>>> >> >>>> >>>> -\t\tT__0=1,·T__1=2,·T__2=3,·T__3=4,·T__4=5,·IDENTIFIER=6,·WILDCARD=7,·WS=8; >>>> >> -\tpublic·static·final·int >>>> >> >>>> >>>> -\t\tRULE_fieldSpecifier·=·0,·RULE_dotExpression·=·1,·RULE_dotExpressionComponent·=·2,· >>>> >> >>>> >>>> -\t\tRULE_qualifiedComponent·=·3,·RULE_qualifierList·=·4,·RULE_arrayQualifier·=·5,· >>>> >> -\t\tRULE_mapQualifier·=·6; >>>> >> -\tpublic·static·final·String[]·ruleNames·=·{ >>>> >> >>>> >>>> -\t\t"fieldSpecifier",·"dotExpression",·"dotExpressionComponent",·"qualifiedComponent",· >>>> >> -\t\t"qualifierList",·"arrayQualifier",·"mapQualifier" >>>> >> -\t}; >>>> >> +··protected·static·final·DFA[]·_decisionToDFA; >>>> >> >>>> >>>> +··protected·static·final·PredictionContextCache·_sharedContextCache·=·new·PredictionContextCache(); >>>> >> +··public·static·final·int·T__0·=·1, >>>> >> +······T__1·=·2, >>>> >> +······T__2·=·3, >>>> >> +······T__3·=·4, >>>> >> +······T__4·=·5, >>>> >> +······IDENTIFIER·=·6, >>>> >> ... (1268 more lines that didn't fit) >>>> >> Violations also present in: >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationVisitor.java >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationBaseListener.java >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationBaseVisitor.java >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationLexer.java >>>> >> >>>> >>>> sdks/java/core/build/generated-src/antlr/main/java/org/apache/beam/sdk/schemas/parser/generated/FieldSpecifierNotationListener.java >>>> >> Run 'gradlew spotlessApply' to fix these violations. >>>> >>>
