On 05/08/2013, at 9:20 PM, Harald Schmitt <li...@hschmitt.de> wrote:
> Hi, > > I did a first try to support symbolic links when using tarTree() for untar. > https://github.com/gradle/gradle/pull/182 > For the other way round, I realized that there are some bits missing, to > implement support for symbolic links with the Tar task type. > The interface Symlink > https://github.com/gradle/gradle/blob/master/subprojects/native/src/main/java/org/gradle/internal/nativeplatform/filesystem/Symlink.java > needs two more functions > public boolean isSymlink(File linkCandidate); > public RelativePath symlinkTarget(File link); > > Determining whether it is a symbolic link could be achieved with pure > java code as the ANT class SymbolicLinkUtils does it, but it could be > much faster using native tools. > But to query the target relative path , I don't know whether this can be > done in java? > > I'd need someone to implement the native part. Is there someone willing? > Is this something that will go into gradle? The native toolkit that we use (https://github.com/adammurdoch/native-platform) already has some support for symlinks. It's missing a method to detect if a file is a symlink, but I can add that. It might take me a few days to get it done, though. We can also use the Java 7 file attributes stuff to determine if a file is a symbolic link. There's also the trick where we can use File.getCanonicalFile() to determine if something is a symlink or not. What you could do to get started is to add the methods that you need on Symlink with dummy implementations or implementations that only work on Java 7 or that use the Ant stuff for now. Then you can continue on with the Tar stuff while I add the native support in the native toolkit and wire it in. -- Adam Murdoch Gradle Co-founder http://www.gradle.org VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting http://www.gradleware.com