Skip to content

Commit

Permalink
use project relative paths in eclipse settings
Browse files Browse the repository at this point in the history
  • Loading branch information
oehme committed Jun 5, 2014
1 parent 3532f83 commit a41f6b2
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.xtext.gradle.tasks;

import com.google.common.base.CharMatcher
import java.io.File
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

Expand All @@ -18,11 +20,19 @@ class XtextEclipseSettings extends DefaultTask {
prefs.load
prefs.putBoolean("is_project_specific", true)
language.outputs.forEach [ output |
prefs.put(output.getKey("directory"), project.file(output.dir).absolutePath)
prefs.put(output.getKey("directory"), project.file(output.dir).projectRelativePath)
]
prefs.save
]
}

def String getKey(OutputConfiguration output, String preferenceName) '''outlet.«output.name».«preferenceName»'''

private def projectRelativePath(File file) {
project.projectDir.toURI.relativize(file.toURI).path.trimTrailingSeparator
}

private def trimTrailingSeparator(String path) {
CharMatcher.anyOf("/\\").trimTrailingFrom(path)
}
}

0 comments on commit a41f6b2

Please sign in to comment.