Skip to content

Commit

Permalink
Normalize EOL to CRLF when building a source distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecLad committed Jan 24, 2016
1 parent 8b381a3 commit a5be357
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ task configureDistSource << {
distSource.from(f.path) {
into RelativePath.parse(true, f.path).parent.pathString
if (f.executable) fileMode 0755
// TODO: apply the CrLf filter where appropriate. Unfortunately, this will be very difficult
// to do until JGit adds better attribute support (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372).
// More specifically, we need to be able to query attributes for the current TreeWalk position
// (implemented by https://git.eclipse.org/r/#/c/35377/).
if (f.containsNativeText) filter(FixCrLfFilter, eol: exportEOL)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of Octetoscope.
Copyright (C) 2013-2015 Octetoscope contributors (see /AUTHORS.txt)
Copyright (C) 2013-2016 Octetoscope contributors (see /AUTHORS.txt)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -24,5 +24,5 @@ repositories {
}

dependencies {
compile 'org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r'
compile 'org.eclipse.jgit:org.eclipse.jgit:4.2.0.201601211800-r'
}
9 changes: 7 additions & 2 deletions buildSrc/src/main/groovy/BuildUtils.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of Octetoscope.
Copyright (C) 2013-2015 Octetoscope contributors (see /AUTHORS.txt)
Copyright (C) 2013-2016 Octetoscope contributors (see /AUTHORS.txt)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -117,7 +117,12 @@ public final class BuildUtils {
if (mode != FileMode.REGULAR_FILE && mode != FileMode.EXECUTABLE_FILE)
throw new RuntimeException("Can't export an entry with mode $mode.")

results.add(new ExportedFileInfo(path: wtItem.entryPathString, executable: mode == FileMode.EXECUTABLE_FILE))
def attrs = treeWalk.getAttributes()

results.add(new ExportedFileInfo(
path: wtItem.entryPathString,
executable: mode == FileMode.EXECUTABLE_FILE,
containsNativeText: !attrs.isCustom("eol") && attrs.isSet("text")))
}

return results
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/groovy/ExportedFileInfo.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of Octetoscope.
Copyright (C) 2015 Octetoscope contributors (see /AUTHORS.txt)
Copyright (C) 2015-2016 Octetoscope contributors (see /AUTHORS.txt)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -19,9 +19,10 @@
public final class ExportedFileInfo {
String path
boolean executable
boolean containsNativeText

@Override
String toString() {
return "$path${executable ? " (executable)" : ""}"
return "$path${executable ? " (executable)" : ""}${containsNativeText ? " (native text)" : ""}"
}
}

0 comments on commit a5be357

Please sign in to comment.