Giter Site home page Giter Site logo

Windows support about google-java-format HOT 12 CLOSED

google avatar google commented on May 11, 2024
Windows support

from google-java-format.

Comments (12)

cushon avatar cushon commented on May 11, 2024 2

https://ci.appveyor.com/project/eaftan/google-java-format/build/1.0.2

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

Two tests in DiagnosticTest fail on Windows due to hard-coded line separators in combination with java.io.PrintWriter dynamic behaviour:

    /**
     * Line separator string.  This is the value of the line.separator
     * property at the moment that the stream was created.
     */
    private final String lineSeparator;

How do you want it to be fixed?

  • remove \n from end of expected string and use contains instead of isEqualTo

assertThat(err.toString()).contains("<stdin>:2:4: error: Invalid character constant");

  • replace \n with System.lineSeparator()

assertThat(err.toString()).isEqualTo("<stdin>:2:4: error: Invalid character constant" + System.lineSeparator());?

See #40

from google-java-format.

jbduncan avatar jbduncan commented on May 11, 2024

I recently suggested in junit-team/junit5#398 the use of AppVeyor to prevent these sorts of Windows-related errors from cropping up in the future.

What does the google-java-format team think about using AppVeyor here?

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

AppVeyor would report: Tests run: 509, Failures: 270, Errors: 0, Skipped: 1 ... all CRLF related.

from google-java-format.

jbduncan avatar jbduncan commented on May 11, 2024

Haha, well then! Looks like a pretty convincing case for using AppVeyor to me.

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

After converting all .[in|out]put files to \n line separators, the test reports: Tests run: 507, Failures: 15, Errors: 0, Skipped: 1

Maybe a .gitattributes could help:

*.input -text
*.output -text

The remaining 15 failures are extra \n characters where none are expected. Like in MainTest.importRemovalLines, there's an empty line rendered between the import and class block.

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

#79 proposes a dynamic way for the line separator issue, which does not override the user choice of which line separator to use.

If the line separator used in output should be forced/user-defined, may be, another command line option can be introduced using an enum named OutputLineSeparator:

  • AUTO_DETECT // use the separator used in input, implemented in #79
  • DEFAULT // use the system-dependend default separator via System.lineSeparator()
  • UNIX // force "\n"as line separator
  • MAC // force "\r" as line separator
  • WINDOWS / force "\r\n" as line separator

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

Now, travis and local Windows machine agree: Tests run: 517, Failures: 0, Errors: 0, Skipped: 1

from google-java-format.

sormuras avatar sormuras commented on May 11, 2024

If only Travis starts a build and there was a AppVeyor build ... this issue was solved. (-:

from google-java-format.

jbduncan avatar jbduncan commented on May 11, 2024

Ooh, great to see an AppVeyor build up and running! Thank you @eaftan and @cushon.

from google-java-format.

eaftan avatar eaftan commented on May 11, 2024

Thank you guys for letting us know about AppVeyor. We've been looking for a Windows CI solution for several of our projects.

from google-java-format.

jbduncan avatar jbduncan commented on May 11, 2024

You're very welcome @eaftan. 👍

I look forward to seeing it being adopted across more Google OSS projects.

from google-java-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.