You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2020/01/29 07:33:11 UTC

Autostyle errors on Windows

I'm running the build on Windows and getting autostyle failures. I'm
using cygwin but otherwise it is a standard build. What am I doing
wrong?

$ java -version
java version "13.0.2" 2020-01-14
$ git clone https://github.com/apache/calcite.git
$ cd calcite
$ ./gradlew build
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

Autostyle seems to expect \n at the ends of lines and get \r\n, or vice versa.

Julian

Re: Autostyle errors on Windows

Posted by Vladimir Sitnikov <si...@gmail.com>.
>I made another commit so that .kt and .kts files are treated as text

Frankly speaking, we have  * text=auto which means git would treat all
files as text if their first 8000 bytes does not have 00 byte.
In other words, kt files were already treated as text files.

>gradlew, sqlline, sqlsh

That indeed makes sense.

>I am still having trouble starting sqlline and sqlsh. I get
>ClassNotFoundException. I suspect the classpath-in-a-jar trick doesn't
>work on Windows/Cygwin.

That is strange, as classpath-jar is a very common trick to shorten the
command line.
I don't have Cygwin setup though.

What appears in Class-Path attribute in your case?

>I also wish Autostyle weren't so picky about line endings. Javac etc.
>ignore them, so Autostyle should too.

I see it might be painful, however:
a) Test cases are often full of `isLinux` to deal with LF vs CRLF in test
outputs.
b) Git makes it extremely hard to fix "improperly committed files" (e.g.
see
https://www.edwardthomson.com/blog/advent_day_21_renormalizing_line_endings.html
 )

Of course, we do have .gitattributes, so we are likely protected from
committing wrong data to the repository,
however, if your local file does not correspond to Git expectations, then
Git **won't** complain.

Sample:
$ unix2dos core/build.gradle.kts # in macOS files are expected to have LF
endings
$ git diff
warning: CRLF will be replaced by LF in core/build.gradle.kts.
The file will have its original line endings in your working directory

^^ diff does not show the file as "modified".
If the file is included as a test sample, then users might be surprised by
the results.


In other words:
A) I expect that Autostyle verifications are fully compatible with Git
clones.
In other words, if the repository was cloned via standard Git approaches,
then Autostyle won't complain.

B) Autostyle will complain if the checkout folder is moved to another OS.
For instance, if someone downloads source_release.zip, then the files can't
be compatible with both LF and CRLF.
I'm not sure it is a common case though.

Do you have other suggestions?

Vladimir

Re: Autostyle errors on Windows

Posted by Julian Hyde <jh...@apache.org>.
I didn't have core.eol in my git config; I was operating using the
default settings (for cygwin's git, anyway). I set 'core.eol=crlf' and
things improved.

I made another commit so that .kt and .kts files are treated as text
(therefore converted to Windows line endings on Windows), and shell
scripts (gradlew, sqlline, sqlsh) always have Unix line-endings.

Thanks, Vladimir, for supporting skipAutostyle under buildSrc. I
forced-pushed your commit to fix a typo in the commit message.

I am still having trouble starting sqlline and sqlsh. I get
ClassNotFoundException. I suspect the classpath-in-a-jar trick doesn't
work on Windows/Cygwin.

I also wish Autostyle weren't so picky about line endings. Javac etc.
ignore them, so Autostyle should too.

Julian


On Wed, Jan 29, 2020 at 12:34 AM Amir Gajst <am...@sisense.com> wrote:
>
> I had a similar problem. Try *removing core.eol *from your git config.
>
> On Wed, Jan 29, 2020 at 10:03 AM Julian Hyde <jh...@apache.org> wrote:
>
> > What is in the file is fine, and yet autostyle is complaining. So I
> > think it is a bug in our autostyle setup.
> >
> > I can't figure out how to disable autostyle. I've tried things like
> > "gradlew -PskipAutostyle".
> >
> > Julian
> >
> > On Tue, Jan 28, 2020 at 11:39 PM Vladimir Sitnikov
> > <si...@gmail.com> wrote:
> > >
> > > I guess it expects EOL to match Git configuration.
> > >
> > > >Autostyle seems to expect \n at the ends of lines and get \r\n, or vice
> > > versa
> > >
> > > I guess it should show what is in the file, and what it expects.
> > >
> > > Vladimir
> >
>
>
> --
>
>
>
> [image: Sisense]
> <https://www.sisense.com/?source=xink&utm_source=xink&utm_medium=email&utm_campaign=emailsignature2018>
> *Amir Gajst*
> Software Engineer
> +972-54-4766239
> amir.gajst
> [image: Instagram] <https://www.instagram.com/sisense/>   [image: LinkedIn]
> <https://www.linkedin.com/company/sisense>   [image: Facebook]
> <https://www.facebook.com/Sisense>   [image: Twitter]
> <https://twitter.com/Sisense>
> <https://t.xink.io/Tracking/Index/0NgBAPDBAADdv0QA0> Read more about
> Sisense Q4 2019 Release >>
> <https://t.xink.io/Tracking/Index/0NgBAPDBAADdv0QA0>

Re: Autostyle errors on Windows

Posted by Amir Gajst <am...@sisense.com>.
I had a similar problem. Try *removing core.eol *from your git config.

On Wed, Jan 29, 2020 at 10:03 AM Julian Hyde <jh...@apache.org> wrote:

> What is in the file is fine, and yet autostyle is complaining. So I
> think it is a bug in our autostyle setup.
>
> I can't figure out how to disable autostyle. I've tried things like
> "gradlew -PskipAutostyle".
>
> Julian
>
> On Tue, Jan 28, 2020 at 11:39 PM Vladimir Sitnikov
> <si...@gmail.com> wrote:
> >
> > I guess it expects EOL to match Git configuration.
> >
> > >Autostyle seems to expect \n at the ends of lines and get \r\n, or vice
> > versa
> >
> > I guess it should show what is in the file, and what it expects.
> >
> > Vladimir
>


-- 



[image: Sisense]
<https://www.sisense.com/?source=xink&utm_source=xink&utm_medium=email&utm_campaign=emailsignature2018>
*Amir Gajst*
Software Engineer
+972-54-4766239
amir.gajst
[image: Instagram] <https://www.instagram.com/sisense/>   [image: LinkedIn]
<https://www.linkedin.com/company/sisense>   [image: Facebook]
<https://www.facebook.com/Sisense>   [image: Twitter]
<https://twitter.com/Sisense>
<https://t.xink.io/Tracking/Index/0NgBAPDBAADdv0QA0> Read more about
Sisense Q4 2019 Release >>
<https://t.xink.io/Tracking/Index/0NgBAPDBAADdv0QA0>

Re: Autostyle errors on Windows

Posted by Vladimir Sitnikov <si...@gmail.com>.
>yet autostyle is complaining

What is the exact error message?

>think it is a bug in our autostyle setup

The idea behind that is it should discover most settings from Git
configuration (e.g. git global config options), .gitattributes,
.editorconfig, and so on.

> I've tried things like "gradlew -PskipAutostyle".

That option was not considered in buildSrc, and I added it there as well.

Vladimir

Re: Autostyle errors on Windows

Posted by Julian Hyde <jh...@apache.org>.
What is in the file is fine, and yet autostyle is complaining. So I
think it is a bug in our autostyle setup.

I can't figure out how to disable autostyle. I've tried things like
"gradlew -PskipAutostyle".

Julian

On Tue, Jan 28, 2020 at 11:39 PM Vladimir Sitnikov
<si...@gmail.com> wrote:
>
> I guess it expects EOL to match Git configuration.
>
> >Autostyle seems to expect \n at the ends of lines and get \r\n, or vice
> versa
>
> I guess it should show what is in the file, and what it expects.
>
> Vladimir

Re: Autostyle errors on Windows

Posted by Vladimir Sitnikov <si...@gmail.com>.
I guess it expects EOL to match Git configuration.

>Autostyle seems to expect \n at the ends of lines and get \r\n, or vice
versa

I guess it should show what is in the file, and what it expects.

Vladimir