-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
91 lines (79 loc) · 2.85 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
buildscript {
apply plugin: 'maven'
repositories {
mavenLocal()
jcenter()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
dependencies {
classpath 'org.akhikhl.unpuzzle:unpuzzle-eclipse2maven:0.0.23-SNAPSHOT'
}
}
import org.akhikhl.unpuzzle.eclipse2maven.EclipseDownloader
import org.akhikhl.unpuzzle.eclipse2maven.EclipseDeployer
import org.akhikhl.unpuzzle.eclipse2maven.EclipseSource
import org.akhikhl.unpuzzle.osgi2maven.Deployer
ext {
current_os = System.getProperty("os.name")
if(current_os.substring(0, 5).equalsIgnoreCase("linux"))
current_os = "linux"
else if(current_os.substring(0, 7).equalsIgnoreCase("windows"))
current_os = "windows"
current_arch = System.getProperty("os.arch")
if(current_arch == "x86" || current_arch == "i386")
current_arch = "x86_32"
else if(current_arch == "amd64")
current_arch = "x86_64"
}
List<EclipseSource> eclipseSources = []
Binding binding = new Binding()
binding.current_os = project.ext.current_os
binding.current_arch = project.ext.current_arch
binding.group = 'eclipse'
binding.eclipseMirror = 'http://mirror.netcologne.de'
binding.source = { Map options = [:], String url ->
def src = new EclipseSource(url: url)
if(options.sourcesOnly)
src.sourcesOnly = options.sourcesOnly
if(options.languagePacksOnly)
src.languagePacksOnly = options.languagePacksOnly
eclipseSources.add(src)
}
GroovyShell shell = new GroovyShell(binding)
shell.evaluate(project.file('eclipseDownloadConfig.groovy'))
project.ext.eclipseGroup = binding.group
project.ext.eclipseSources = eclipseSources
task('downloadEclipse') {
File markerFile = new File(buildDir, 'eclipseDownloaded')
outputs.file markerFile
doLast {
buildDir.mkdirs()
new EclipseDownloader().downloadAndUnpack(project.ext.eclipseSources, buildDir)
markerFile.text = new java.util.Date()
}
}
task('installEclipse') {
dependsOn project.tasks.downloadEclipse
File outputMarkerFile = new File(buildDir, 'eclipseArtifactsInstalled')
outputs.file outputMarkerFile
doLast {
Deployer mavenDeployer = new Deployer(new File(System.getProperty('user.home'), '.m2/repository').toURI().toURL().toString())
new EclipseDeployer(buildDir, project.ext.eclipseGroup, mavenDeployer).deploy(project.ext.eclipseSources)
outputMarkerFile.text = new java.util.Date()
}
}
task('uploadEclipse') {
dependsOn project.tasks.downloadEclipse
doLast {
def corporateDeployment = rootProject.ext.corporateDeployment
Deployer mavenDeployer = new Deployer(corporateDeployment.url, user: corporateDeployment.user, password: corporateDeployment.password)
new EclipseDeployer(buildDir, project.ext.eclipseGroup, mavenDeployer).deploy(project.ext.eclipseSources)
}
}
if(!project.tasks.findByName('clean'))
task clean {
doLast {
if(buildDir.exists())
FileUtils.deleteDirectory(buildDir);
}
}