[ 
https://issues.apache.org/jira/browse/CALCITE-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gavin Ray updated CALCITE-5005:
-------------------------------
    Description: 
Every `.kt` file fails with the following error due to the `autoStyleKotlin` 
check.

The fix to this is to modify the `.gitattributes` file to set `eol=clrf` to 
`*.kt` and `*.kts`

{code:diff}
diff --git a/.gitattributes b/.gitattributes
old mode 100644
new mode 100755
index a6cfa289b..2ae8d7037
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,8 +4,8 @@
 *.cs     text diff=csharp
 *.java   text diff=java
 *.html   text diff=html
-*.kt     text diff=kotlin
-*.kts    text diff=kotlin
+*.kt     text diff=kotlin eol=crlf
+*.kts    text diff=kotlin eol=crlf
{code}


{code}
> 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.
{code}

  was:
Every `.kt` file fails with the following error due to the `autoStyleKotlin` 
check.

The fix to this is to modify the `.gitattributes` file to set `eol=clrf` to 
`*.kt` and `*.kts`

```diff

diff --git a/.gitattributes b/.gitattributes
old mode 100644
new mode 100755
index a6cfa289b..2ae8d7037
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,8 +4,8 @@
 *.cs     text diff=csharp
 *.java   text diff=java
 *.html   text diff=html
-*.kt     text diff=kotlin
-*.kts    text diff=kotlin
+*.kt     text diff=kotlin eol=crlf
+*.kts    text diff=kotlin eol=crlf

```

```

> 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.

```


> Calcite fails to build on Linux due to style check because Kotlin files use 
> ␍␊ 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
>
> Every `.kt` file fails with the following error due to the `autoStyleKotlin` 
> check.
> The fix to this is to modify the `.gitattributes` file to set `eol=clrf` to 
> `*.kt` and `*.kts`
> {code:diff}
> diff --git a/.gitattributes b/.gitattributes
> old mode 100644
> new mode 100755
> index a6cfa289b..2ae8d7037
> --- a/.gitattributes
> +++ b/.gitattributes
> @@ -4,8 +4,8 @@
>  *.cs     text diff=csharp
>  *.java   text diff=java
>  *.html   text diff=html
> -*.kt     text diff=kotlin
> -*.kts    text diff=kotlin
> +*.kt     text diff=kotlin eol=crlf
> +*.kts    text diff=kotlin eol=crlf
> {code}
> {code}
> > 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.
> {code}



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

Reply via email to