[ 
https://issues.apache.org/jira/browse/CALCITE-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17489748#comment-17489748
 ] 

Julian Hyde commented on CALCITE-5005:
--------------------------------------

When I apply your patch it causes the precise problem that you claim it solves. 
Autostyle succeeds on MacOS and Linux without your patch, and it fails with 
your patch.

If this problem occurs for Kotlin, I'm wondering why it doesn't also occur for 
Java. Is there anything in the Kotlin language specification that mandates 
particular line endings?

> Calcite fails to build on Linux due to style check because Kotlin files use 
> CR-LF line-endings
> ----------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5005
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5005
>             Project: Calcite
>          Issue Type: Bug
>          Components: build
>            Reporter: Gavin Ray
>            Priority: Major
>          Time Spent: 10m
>
> Every `.kt` file fails with the following error due to the `autoStyleKotlin` 
> check.
> {noformat}
> > Task :buildSrc:autostyleKotlinGradleCheck FAILED
> > Task :buildSrc:buildext:autostyleKotlinCheck FAILED
> > Task :buildSrc:fmpp:autostyleKotlinCheck FAILED
> > Task :buildSrc:javacc:autostyleKotlinCheck FAILED
> FAILURE: Build completed with 4 failures.
> Task failed with an exception.
> -----------
> * What went wrong:
> Execution failed for task ':buildSrc:buildext:autostyleKotlinCheck'.
> > The following files have format violations:
>     
> subprojects/buildext/src/main/kotlin/org/apache/calcite/buildtools/buildext/BuildExtPlugin.kt
>       @@ -1,27 +1,27 @@
>       -/*␍␊
>       -·*·Licensed·to·the·Apache·Software·Foundation·(ASF)·under·one·or·more␍␊
>       
> -·*·contributor·license·agreements.··See·the·NOTICE·file·distributed·with␍␊
>       
> -·*·this·work·for·additional·information·regarding·copyright·ownership.␍␊
>       
> -·*·The·ASF·licenses·this·file·to·You·under·the·Apache·License,·Version·2.0␍␊
>       
> -·*·(the·"License");·you·may·not·use·this·file·except·in·compliance·with␍␊
>       -·*·the·License.··You·may·obtain·a·copy·of·the·License·at␍␊
>       -·*␍␊
>       -·*···http://www.apache.org/licenses/LICENSE-2.0␍␊
>       -·*␍␊
>       
> -·*·Unless·required·by·applicable·law·or·agreed·to·in·writing,·software␍␊
>       -·*·distributed·under·the·License·is·distributed·on·an·"AS·IS"·BASIS,␍␊
>       
> -·*·WITHOUT·WARRANTIES·OR·CONDITIONS·OF·ANY·KIND,·either·express·or·implied.␍␊
>       
> -·*·See·the·License·for·the·specific·language·governing·permissions·and␍␊
>       -·*·limitations·under·the·License.␍␊
>       -·*␍␊
>       -·*/␍␊
>       -␍␊
>       -package·org.apache.calcite.buildtools.buildext␍␊
>       -␍␊
>       -import·org.gradle.api.Plugin␍␊
>       -import·org.gradle.api.Project␍␊
>       -␍␊
>       -class·BuildExtPlugin·:·Plugin<Project>·{␍␊
>       -····override·fun·apply(target:·Project)·{␍␊
>       -····}␍␊
>       -}␍␊
>       +/*␊
>       +·*·Licensed·to·the·Apache·Software·Foundation·(ASF)·under·one·or·more␊
>       
> +·*·contributor·license·agreements.··See·the·NOTICE·file·distributed·with␊
>       +·*·this·work·for·additional·information·regarding·copyright·ownership.␊
>       
> +·*·The·ASF·licenses·this·file·to·You·under·the·Apache·License,·Version·2.0␊
>       
> +·*·(the·"License");·you·may·not·use·this·file·except·in·compliance·with␊
>       +·*·the·License.··You·may·obtain·a·copy·of·the·License·at␊
>       +·*␊
>       +·*···http://www.apache.org/licenses/LICENSE-2.0␊
>       +·*␊
>       +·*·Unless·required·by·applicable·law·or·agreed·to·in·writing,·software␊
>       +·*·distributed·under·the·License·is·distributed·on·an·"AS·IS"·BASIS,␊
>       
> +·*·WITHOUT·WARRANTIES·OR·CONDITIONS·OF·ANY·KIND,·either·express·or·implied.␊
>       +·*·See·the·License·for·the·specific·language·governing·permissions·and␊
>       +·*·limitations·under·the·License.␊
>       +·*␊
>       +·*/␊
>       +␊
>       +package·org.apache.calcite.buildtools.buildext␊
>       +␊
>       +import·org.gradle.api.Plugin␊
>     ... (6 more lines that didn't fit)
>   Violations also present in:
>     
> subprojects/buildext/src/main/kotlin/org/apache/calcite/buildtools/buildext/dsl/ParenthesisBalancer.kt
>   Run './gradlew autostyleApply' to fix the violations.
> {noformat}
> The fix to this is to modify the {{.gitattributes}} file to set {{eol=clrf}} 
> to {{\*.kt}} and {{\*.kts}}. See attached PR.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to