From the spotless devs:

Git is not a pure content store, it mucks with line endings. Regardless of what 
you check-in, it will store your files with unix line endings in the repo.

Then, when you checkout, it will modify the line endings to suit your platform. 
Unless you add a .gitattributes file to tell git "forget the platform, do what 
this file says".

Remove lineEndings 'UNIX' in your build.gradle [Jared - we should put 
‘GIT_ATTRIBUTES’ in its place], and add a .gitattributes file in your root 
directory with the content * text eol=lf and your problem will be fixed.



> On Nov 4, 2016, at 10:48 AM, Nabarun Nag <n...@pivotal.io> wrote:
> 
> Thank you Jared. I wanted to confirm that this was not an isolated incident
> specific to my machine.
> 
> Regards
> Naba
> 
> On Fri, Nov 4, 2016 at 10:45 AM Jared Stewart <jstew...@pivotal.io> wrote:
> 
>> @Naba,
>> 
>> I filed a bug report with Spotless this morning.  The Spotless devs have
>> been very responsive so far in my experience, hopefully this will be fixed
>> soon.
>> 
>>> On Nov 4, 2016, at 10:35 AM, Nabarun Nag <n...@pivotal.io> wrote:
>>> 
>>> @Udo, I confirmed that this is not limited to my windows 10 environment.
>> I
>>> ran  the steps on a Windows Server 2016 AMI instance and the same error
>>> occurred in the AMI too. [source checkout time 4th Nov 10:00AM PST]
>>> 
>>> I wanted to know if there is a mandate on what the value of
>>> core.autocrlf should
>>> be set to on a windows machine for geode dev work. For my experiments
>> value
>>> of core.autocrlf was set to true. [recommended for cross platform
>>> development]
>>> 
>>> Regards
>>> Naba
>>> 
>>> 
>>> On Thu, Nov 3, 2016 at 10:18 PM Nabarun Nag <n...@pivotal.io> wrote:
>>> 
>>>> @Jared
>>>> I ran ./gradlew spotlessApply on the Windows 10 machine using git bash
>>>> this is what has happened.
>>>> NOTE: I started the below steps on a fresh git clone of the open side.
>>>> [Steps:
>>>> 1.  git clone
>> https://git-wip-us.apache.org/repos/asf/incubator-geode.git
>>>> open
>>>> 2. cd open
>>>> 3. git checkout -b develop origin/develop]
>>>> 
>>>> *Step 1. ./gradlew clean build -Dskip.tests=true*
>>>> 
>>>> FAILURE: Build failed with an exception.
>>>> 
>>>> * What went wrong:
>>>> Execution failed for task ':geode-core:spotlessJavaCheck'.
>>>>> Format violations were found. Run 'gradlew spotlessApply' to fix them.
>>>> 
>>>> 
>> geode-core\src\main\java\org\apache\geode\internal\statistics\StatArchiveReader.java
>>>> 
>>>> 
>> geode-core\src\test\java\org\apache\geode\cache\query\dunit\PdxLocalQueryVersionedClassDUnitTest.java
>>>> 
>>>> 
>> geode-core\src\test\java\org\apache\geode\internal\cache\execute\ClientServerFunctionExecutionDUnitTest.java
>>>> 
>>>> 
>> geode-core\src\test\java\org\apache\geode\internal\cache\functions\TestFunction.java
>>>> 
>>>> 
>> geode-core\src\test\java\org\apache\geode\internal\statistics\StatArchiveWithMissingResourceTypeRegressionTest.java
>>>> 
>>>> 
>>>> *Step 2: ./gradlew spotlessApply*
>>>> 
>>>> BUILD SUCCESSFUL
>>>> 
>>>> Total time: 12.728 secs
>>>> 
>>>> 
>>>> *Step 3: git status*
>>>> 
>>>> modified:
>>>> 
>> geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveReader.java
>>>>       modified:
>>>> 
>> geode-core/src/test/java/org/apache/geode/cache/query/dunit/PdxLocalQueryVersionedClassDUnitTest.java
>>>>       modified:
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
>>>>       modified:
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/cache/functions/TestFunction.java
>>>>       modified:
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java
>>>> 
>>>> 
>>>> *Step 4 : git add .*
>>>> warning: LF will be replaced by CRLF in
>>>> 
>> geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveReader.java.
>>>> The file will have its original line endings in your working directory.
>>>> warning: LF will be replaced by CRLF in
>>>> 
>> geode-core/src/test/java/org/apache/geode/cache/query/dunit/PdxLocalQueryVersionedClassDUnitTest.java.
>>>> The file will have its original line endings in your working directory.
>>>> warning: LF will be replaced by CRLF in
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java.
>>>> The file will have its original line endings in your working directory.
>>>> warning: LF will be replaced by CRLF in
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/cache/functions/TestFunction.java.
>>>> The file will have its original line endings in your working directory.
>>>> warning: LF will be replaced by CRLF in
>>>> 
>> geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java.
>>>> The file will have its original line endings in your working directory.
>>>> 
>>>> 
>>>> *Step 5: git status*
>>>> On branch develop
>>>> Your branch is up-to-date with 'origin/develop'.
>>>> nothing to commit, working tree clean
>>>> 
>>>> 
>>>> *Step 6: ./gradlew clean build -Dskip.tests=true*
>>>> BUILD SUCCESSFUL
>>>> 
>>>> Total time: 5 mins 28.64 secs
>>>> 
>>>> NOTE: This happens only the first time. I did run the above steps,couple
>>>> of times on  fresh checkouts and I was able to reproduce it every time.
>>>> 
>>>> However, after running spotlessApply and git add . the first time, the
>>>> spotless errors do not reoccur on subsequent builds.
>>>> 
>>>> I will try running this on other machines and check if this occurs in
>>>> other windows environments.
>>>> 
>>>> 
>>>> Regards
>>>> Naba
>>>> 
>>>> On Thu, Nov 3, 2016 at 4:25 PM Udo Kohlmeyer <ukohlme...@pivotal.io>
>>>> wrote:
>>>> 
>>>> @Jared, I mailed with the Spotless project devs and they recommend using
>>>> .gitattributes. But maybe @Naba's problem is Windows10 related... Who
>>>> knows..
>>>> 
>>>> --Udo
>>>> 
>>>> 
>>>> On 4/11/16 10:16 am, Jared Stewart wrote:
>>>>> The only Windows machine I have is running Windows 8, and I am unable
>> to
>>>> reproduce this on that machine.  I don’t think .gitattributes would
>> affect
>>>> this, since we have already configured spotless to always use Unix line
>>>> endings.
>>>>> 
>>>>> Naba - Can you run ‘./gradlew spotlessApply’ and push the results to a
>>>> branch so I can see what Spotless was complaining about?
>>>>> 
>>>>>> On Nov 3, 2016, at 4:09 PM, Udo Kohlmeyer <u...@apache.org> wrote:
>>>>>> 
>>>>>> I think we seriously have to look at using .gitattributes for this...
>>>>>> 
>>>>>> As I initially said, it should be a no brainer.. it should just
>>>> automatically just work.
>>>>>> 
>>>>>> --Udo
>>>>>> 
>>>>>> 
>>>>>> On 4/11/16 9:00 am, Bruce Schuchardt wrote:
>>>>>>> It's been working on my Windows 7 machine under a cygwin shell.   I
>>>> just ran it again using "clean bulid -Dskip.tests=true" from the root
>> Geode
>>>> directory on the develop branch.
>>>>>>> 
>>>>>>> Run spotlessApply and let us know how it modified the files.
>>>>>>> 
>>>>>>> 
>>>>>>> Le 11/3/2016 à 12:38 PM, Nabarun Nag a écrit :
>>>>>>>> I tested gradlew build on a windows 10 machine to test the spotless
>>>> feature.
>>>>>>>> 
>>>>>>>> Steps:
>>>>>>>> 1.  git clone
>>>> https://git-wip-us.apache.org/repos/asf/incubator-geode.git
>>>>>>>> open
>>>>>>>> 2. cd open
>>>>>>>> 3. git checkout -b develop origin/develop
>>>>>>>> 4.  ./gradlew clean build -Dskip.tests=true
>>>>>>>> 
>>>>>>>> The build failed with multiple formatting error on each file.
>>>>>>>> 
>>>>>>>> In my opinion the issue still exists. It will be awesome if someone
>>>> else
>>>>>>>> can verify if the issue still exists by running the build steps on a
>>>>>>>> different windows machine.
>>>>>>>> 
>>>>>>>> Regards
>>>>>>>> Nabarun
>>>>>>>> 
>>>>>>>> On Mon, Oct 24, 2016 at 3:50 PM Bruce Schuchardt <
>>>> bschucha...@pivotal.io>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> The lineEndings setting works great. I've pushed the change to
>>>> develop
>>>>>>>>> 
>>>>>>>>> On Mon, Oct 24, 2016 at 3:47 PM, Dan Smith <dsm...@pivotal.io>
>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> I think we have a fix for the spotless line ending issue on
>> windows;
>>>>>>>>> Bruce
>>>>>>>>>> will check it in shortly:
>>>>>>>>>> 
>>>>>>>>>> diff --git a/build.gradle b/build.gradle
>>>>>>>>>> index a734e05..6e82433 100755
>>>>>>>>>> --- a/build.gradle
>>>>>>>>>> +++ b/build.gradle
>>>>>>>>>> @@ -88,6 +88,7 @@ subprojects {
>>>>>>>>>> 
>>>>>>>>>>   apply plugin: "com.diffplug.gradle.spotless"
>>>>>>>>>>   spotless {
>>>>>>>>>> +    lineEndings = 'unix';
>>>>>>>>>>     java {
>>>>>>>>>>       eclipseFormatFile
>>>>>>>>>> "${rootProject.projectDir}/etc/eclipse-java-google-style.xml"
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Mon, Oct 24, 2016 at 2:50 PM, Bruce Schuchardt <
>>>>>>>>> bschucha...@pivotal.io>
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Running geode-core:spotlessCheck complains that all of the .java
>>>> files
>>>>>>>>>>> have format violations
>>>>>>>>>>> 
>>>>>>>>>>> * What went wrong:
>>>>>>>>>>> Execution failed for task ':geode-core:spotlessJavaCheck'.
>>>>>>>>>>>> Format violations were found. Run 'gradlew spotlessApply' to fix
>>>>>>>>> them.
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\GFConne
>>>>>>>>>>> ctionFactoryImpl.java
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\
>>>>>>>>>> GFConnectionImpl.java
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\spi\JCA
>>>>>>>>>>> LocalTransaction.java
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\spi\JCA
>>>>>>>>>>> ManagedConnection.java
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\spi\JCA
>>>>>>>>>>> ManagedConnectionFactory.java
>>>>>>>>>>> geode-core\src\jca\java\org\apache\geode\internal\ra\spi\JCA
>>>>>>>>>>> ManagedConnectionnMetaData.java
>>>>>>>>>>> etc.
>>>>>>>>>>> 
>>>>>>>>>>> Until this is fixed I can't validate that the changes I check in
>>>>>>>>> conform
>>>>>>>>>>> to the formatting rules.
>>>>>>>>>>> 
>>>> 
>>>> 
>> 
>> 

Reply via email to