spring-io / spring-asciidoctor-backends

A backend for Asciidoctor used to produce Spring styled HTML
Apache License 2.0
80 stars 16 forks source link

Build fails on Windows #28

Open toedter opened 3 years ago

toedter commented 3 years ago

Since I wanted to find the Windows-related issues, I tried to build the project on Windows, but it failed:

Here is the log:

gradlew build Downloading https://services.gradle.org/distributions/gradle-6.8.2-bin.zip ..........10%..........20%..........30%...........40%..........50%..........60%..........70%...........80%..........90%..........100%

Welcome to Gradle 6.8.2!

Here are the highlights of this release:

For more details see https://docs.gradle.org/6.8.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

Task :npm_install npm notice npm notice New minor version of npm available! 7.6.0 -> 7.10.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.10.0 npm notice Run npm install -g npm@7.10.0 to update! npm notice npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

added 1474 packages, and audited 1475 packages in 1m

106 packages are looking for funding run npm fund for details

found 0 vulnerabilities npm notice npm notice New minor version of npm available! 7.6.0 -> 7.10.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.10.0 npm notice Run npm install -g npm@7.10.0 to update! npm notice

Task :gulp

spring-doc-resources@0.2.0 build gulp build --output $npm_config_output

[14:55:44] Using gulpfile D:\dev\git\spring-asciidoctor-backends\gulpfile.js [14:55:44] Starting 'build'...[2m 7s] [14:55:44] Starting 'info'... [14:55:44] Writing to $npm_config_output [14:55:44] Finished 'info' after 798 ╬╝s [14:55:44] Starting 'css'... [14:55:47] Finished 'css' after 3.13 s [14:55:47] Starting 'img'... [14:55:47] Finished 'img' after 24 ms [14:55:47] Starting 'jsSetup'... [14:55:48] Finished 'jsSetup' after 977 ms [14:55:48] Starting 'jsSite'... [14:55:50] Finished 'jsSite' after 1.7 s [14:55:50] Finished 'build' after 5.84 s

Task :prettierCheckFormat FAILED

spring-doc-resources@0.2.0 checkFormat prettier --check .

Checking formatting... [warn] src\main\css\asciidoctor.css [warn] src\main\css\codetools.css [warn] src\main\css\components.css [warn] src\main\css\elements.css [warn] src\main\css\generic.css [warn] src\main\css\highlight.css [warn] src\main\css\layout.css [warn] src\main\css\settings-dark.css [warn] src\main\css\settings.css [warn] src\main\css\site.css [warn] src\main\css\tabs.css [warn] src\main\css\toc.css [warn] src\main\js\setup\layout.js [warn] src\main\js\setup\switchtheme.js [warn] src\main\js\site\codetools.js [warn] src\main\js\site\tabs.js [warn] src\main\js\site\toc.js [warn] src\main\ruby\lib\spring-asciidoctor-backends\body_template.html [warn] Code style issues found in the above file(s). Forgot to run Prettier?

FAILURE: Build failed with an exception.

BUILD FAILED in 2m 34s 10 actionable tasks: 10 executed

mikomatic commented 3 years ago

I'm having the same issue here.

This seems to come from the default windows git configuration when core.autocrlf=true. Line feeds are converted to CRLF when cloning the repo, and then the command prettier --check . fails because of this.

I could continue the build by launching manually the npm run format = prettier --write . which "fixes" the files with the intended line endings.

One suggestion i could make to make it work without changing user configuration would be, based on prettier documentation (emphasis by me)

If you want to make sure that your entire git repository only contains Linux-style line endings in files covered by Prettier:

  • [...]
  • *Add text=auto eol=lf to the repo’s .gitattributes file. You may need to ask Windows users to re-clone your repo after this change to ensure git has not converted LF to CRLF on checkout.**

https://prettier.io/docs/en/options.html#end-of-line

NOTE: even the build continues, the tests also fails (some for the same line-ending mismatch reason)