Last active
January 1, 2016 12:19
-
-
Save xconnecting/8143811 to your computer and use it in GitHub Desktop.
[Gradle] Install eclipse and eclipse plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project.ext.tempDir = 'tmp' | |
project.ext.targetEclipseDir = 'd:/eclipseGroovy' | |
ant.condition(property: "os", value: "windows") { os(family: "windows") } | |
ant.condition(property: "os", value: "unix" ) { os(family: "unix") } | |
task clean << { delete 'tmp' } | |
task installEclipse << { | |
new File(tempDir).mkdirs() | |
ant.get(dest:tempDir, skipexisting:true){ | |
url(url:"http://ftp.jaist.ac.jp/pub/eclipse/technology/epp/downloads/release/kepler/SR1/eclipse-rcp-kepler-SR1-win32-x86_64.zip") | |
} | |
ant.unzip(dest:tempDir, overwrite:"false"){ | |
fileset(dir: project.tempDir){ include (name:'*.zip')} | |
} | |
ant.move(toDir: project.targetEclipseDir){ | |
fileset(dir: "${tempDir}/eclipse") | |
} | |
// ant.copy(file:'files/eclipse.ini', toDir: targetEclipseDir) | |
} | |
def getCommandList(String command){ | |
def commandList = [ | |
"${targetEclipseDir}/eclipse", | |
"-application", | |
"org.eclipse.equinox.p2.director", | |
"-noSplash" | |
]+ | |
command.replaceAll(/,[^\\]\n/, ',').replaceAll(/[^\\]\n/, ' ').split(/\s+/) + | |
[ | |
"-vmargs", | |
"-Dlogback.configurationFile=logback.xml" | |
] | |
if(ant.properties.os == 'windows'){ | |
commandList = ['cmd', '/c']+ commandList | |
} | |
commandList.flatten() | |
} | |
task installPlugins(type:Exec) { | |
ext.command = """\ | |
-repository http://dist.springsource.org/snapshot/GRECLIPSE/e4.3/,^ | |
http://dist.springsource.com/release/TOOLS/gradle^ | |
-installIUs org.codehaus.groovy.eclipse.feature.feature.group,^ | |
org.springsource.ide.eclipse.gradle.feature.feature.group^ | |
-d ${targetEclipseDir}""" | |
commandLine getCommandList(command) | |
} | |
task uninstallPlugins(type:Exec) { | |
ext.command = """\ | |
-repository http://dist.springsource.org/snapshot/GRECLIPSE/e4.3/,^ | |
http://dist.springsource.com/release/TOOLS/gradle^ | |
-uninstallIUs org.codehaus.groovy.eclipse.feature.feature.group,^ | |
org.springsource.ide.eclipse.gradle.feature.feature.group^ | |
-d ${targetEclipseDir}""" | |
commandLine getCommandList(command) | |
} | |
installPlugins.mustRunAfter installEclipse | |
task wrapper(type: Wrapper) { gradleVersion = '1.9' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment