Skip to content

Commit

Permalink
merged changes from updateTasks branch
Browse files Browse the repository at this point in the history
  • Loading branch information
akhikhl committed May 7, 2014
2 parents 1ed3cf9 + 5fec4da commit a58ec74
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 48 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Maintainer Status](http://stillmaintained.com/akhikhl/unpuzzle.png)](http://stillmaintained.com/akhikhl/unpuzzle)
[![Build Status](https://travis-ci.org/akhikhl/unpuzzle.png?branch=master)](https://travis-ci.org/akhikhl/unpuzzle)
[![Latest Version](http://img.shields.io/badge/latest_version-0.0.8-3f6498.svg)](https://github.com/akhikhl/unpuzzle/tree/v0.0.8)
[![Latest Version](http://img.shields.io/badge/latest_version-0.0.9-3f6498.svg)](https://github.com/akhikhl/unpuzzle/tree/v0.0.9)
[![License](http://img.shields.io/badge/license-MIT-d63434.svg)](#copyright-and-license)

**Unpuzzle** is a set of tools for mavenizing OSGi-bundles. You can consume Unpuzzle in two forms:
Expand All @@ -18,7 +18,7 @@ All versions of Unpuzzle are available at jcenter and maven-central under the gr
- [installEclipse](#installeclipse)
- [uninstallEclipse](#uninstalleclipse)
- [uploadEclipse](#uploadeclipse)
- [cleanUnpuzzle](#cleanunpuzzle)
- [cleanEclipse](#cleaneclipse)
4. [Configuration DSL](#configuration-dsl)
5. [uploadEclipse configuration](#uploadeclipse-configuration)
6. [Configuration hierarchy](#configuration-hierarchy)
Expand Down Expand Up @@ -111,9 +111,9 @@ You can define other maven group by providing your own [configuration](#gradle-p

uploadEclipse task depends on [downloadEclipse](#downloadeclipse] task.

### cleanUnpuzzle
### cleanEclipse

**cleanUnpuzzle** task cleans everything specific to Unpuzzle plugin. Particularly, it uninstalls installed maven artifacts and deletes directory $HOME/.unpuzzle.
**cleanEclipse** task cleans everything specific to Unpuzzle plugin. Particularly, it uninstalls installed maven artifacts and deletes directory $HOME/.unpuzzle.

## Configuration DSL

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {

ext {
group = 'org.akhikhl.unpuzzle'
version = '0.0.8'
version = '0.0.9'
groovy_version = '1.8.6'
spock_version = '0.7-groovy-1.8'
}
Expand Down
2 changes: 1 addition & 1 deletion examples/deployEclipseKepler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'org.akhikhl.unpuzzle:unpuzzle-eclipse2maven:0.0.8'
classpath 'org.akhikhl.unpuzzle:unpuzzle-eclipse2maven:0.0.9'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Configurer {
protected static final Logger log = LoggerFactory.getLogger(Configurer)

private final Project project
boolean loadDefaultConfig = true

Configurer(Project project) {
this.project = project
Expand All @@ -51,16 +52,12 @@ class Configurer {
project.afterEvaluate {

project.task('downloadEclipse') {
group = 'unpuzzle'
description = 'Downloads eclipse distribution into $HOME/.unpuzzle directory'
doLast {
downloadEclipse()
}
}

project.task('installEclipse') {
group = 'unpuzzle'
description = 'Mavenizes and installs bundles of the eclipse distribution into local maven repository'
outputs.upToDateWhen {
installEclipseUpToDate()
}
Expand All @@ -70,8 +67,6 @@ class Configurer {
}

project.task('uninstallEclipse') {
group = 'unpuzzle'
description = 'Uninstalls mavenized artifacts of the eclipse distribution from local maven repository'
outputs.upToDateWhen {
uninstallEclipseUpToDate()
}
Expand All @@ -81,17 +76,13 @@ class Configurer {
}

project.task('uploadEclipse') {
group = 'unpuzzle'
description = 'Uploads mavenized artifacts of the eclipse distribution to remote maven repository'
dependsOn project.tasks.downloadEclipse
doLast {
uploadEclipse()
}
}

project.task('cleanUnpuzzle') {
group = 'unpuzzle'
description = 'Cleans $HOME/.unpuzzle directory, uninstalls mavenized artifacts'
project.task('cleanEclipse') {
dependsOn project.tasks.uninstallEclipse
outputs.upToDateWhen {
!effectiveConfig.unpuzzleDir.exists()
Expand All @@ -101,7 +92,32 @@ class Configurer {
effectiveConfig.unpuzzleDir.deleteDir()
}
}
} // project.afterEvaluate

if(!project.tasks.downloadEclipse.group)
updateTasks('unpuzzle')
} // project.afterEvaluate
}

void updateTasks(String taskGroup) {
Config econfig = new Config()
Config.merge(econfig, project.unpuzzle)
if(econfig.selectedVersionConfig != null && econfig.localMavenRepositoryDir != null) {
def mavenGroupPath
if(econfig.selectedVersionConfig.eclipseMavenGroup)
mavenGroupPath = new File(econfig.localMavenRepositoryDir, econfig.selectedVersionConfig.eclipseMavenGroup).absolutePath
else
mavenGroupPath = econfig.localMavenRepositoryDir.absolutePath
project.tasks.downloadEclipse.group = taskGroup
project.tasks.downloadEclipse.description = "Downloads eclipse version ${econfig.selectedEclipseVersion} into ${econfig.unpuzzleDir} directory"
project.tasks.installEclipse.group = taskGroup
project.tasks.installEclipse.description = "Mavenizes and installs bundles of the eclipse version ${econfig.selectedEclipseVersion} into ${mavenGroupPath}"
project.tasks.uninstallEclipse.group = taskGroup
project.tasks.uninstallEclipse.description = "Uninstalls mavenized bundles of the eclipse version ${econfig.selectedEclipseVersion} from ${mavenGroupPath}"
project.tasks.uploadEclipse.group = taskGroup
project.tasks.uploadEclipse.description = "Uploads mavenized bundles of the eclipse version ${econfig.selectedEclipseVersion} to remote maven repository"
project.tasks.cleanEclipse.group = taskGroup
project.tasks.cleanEclipse.description = "uninstalls all mavenized artifacts, cleans ${econfig.unpuzzleDir} directory"
}
}

void downloadEclipse() {
Expand All @@ -119,9 +135,12 @@ class Configurer {
}

private EclipseVersionConfig getSelectedVersionConfig() {
EclipseVersionConfig vconf = effectiveConfig.selectedVersionConfig
if(!vconf)
throw new GradleException("Eclipse version ${effectiveConfig.selectedEclipseVersion} is not configured")
EclipseVersionConfig vconf
if(effectiveConfig.selectedEclipseVersion != null) {
vconf = effectiveConfig.selectedVersionConfig
if(!vconf)
throw new GradleException("Eclipse version ${effectiveConfig.selectedEclipseVersion} is not configured")
}
return vconf
}

Expand All @@ -148,14 +167,17 @@ class Configurer {
new EclipseDeployer(effectiveConfig.unpuzzleDir, vconf.eclipseMavenGroup, mavenDeployer).allDownloadedPackagesAreInstalled(vconf.sources)
}

private static void setupConfigChain(Project project) {
private void setupConfigChain(Project project) {
if(project.unpuzzle.parentConfig == null) {
Project p = project.parent
while(p != null && !p.extensions.findByName('unpuzzle'))
p = p.parent
if(p == null) {
log.debug '{}.unpuzzle.parentConfig <- defaultConfig', project.name
project.unpuzzle.parentConfig = new ConfigReader().readFromResource('defaultConfig.groovy')
if(loadDefaultConfig) {
log.debug '{}.unpuzzle.parentConfig <- defaultConfig', project.name
project.unpuzzle.parentConfig = new ConfigReader().readFromResource('defaultConfig.groovy')
} else
project.unpuzzle.parentConfig = new Config()
}
else {
log.debug '{}.unpuzzle.parentConfig <- {}.unpuzzle', project.name, p.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ unpuzzle {

selectedEclipseVersion = '4.3.2'

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

eclipseVersion('4.3.2') {

eclipseMavenGroup = 'eclipse-kepler-sr2'
Expand All @@ -16,10 +20,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseMirror/eclipse//technology/epp/downloads/release/kepler/SR2/eclipse-jee-kepler-SR2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.3.2-201402211700/eclipse-SDK-4.3.2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.3.2-201402211700/eclipse-4.3.2-delta-pack.zip"
Expand All @@ -38,10 +38,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseMirror/eclipse//technology/epp/downloads/release/kepler/SR1/eclipse-jee-kepler-SR1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.3.1-201309111000/eclipse-SDK-4.3.1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.3.1-201309111000/eclipse-4.3.1-delta-pack.zip"
Expand All @@ -60,10 +56,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseMirror/eclipse//technology/epp/downloads/release/juno/SR2/eclipse-jee-juno-SR2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.2.2-201302041200/eclipse-SDK-4.2.2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseMirror/eclipse//eclipse/downloads/drops4/R-4.2.2-201302041200/eclipse-4.2.2-delta-pack.zip"
Expand All @@ -83,10 +75,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseArchiveMirror/technology/epp/downloads/release/juno/SR1/eclipse-jee-juno-SR1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseArchiveMirror/eclipse/downloads/drops4/R-4.2.1-201209141800/eclipse-SDK-4.2.1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseArchiveMirror/eclipse/downloads/drops4/R-4.2.1-201209141800/eclipse-4.2.1-delta-pack.zip"
Expand All @@ -106,10 +94,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseMirror/eclipse//technology/epp/downloads/release/indigo/SR2/eclipse-jee-indigo-SR2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseArchiveMirror/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-SDK-3.7.2-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseArchiveMirror/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-3.7.2-delta-pack.zip"
Expand All @@ -129,10 +113,6 @@ unpuzzle {

sources {

def suffix_os = [ 'linux': 'linux-gtk', 'windows': 'win32' ]
def suffix_arch = [ 'x86_32': '', 'x86_64': '-x86_64' ]
def fileExt_os = [ 'linux': 'tar.gz', 'windows': 'zip' ]

source "$eclipseArchiveMirror/technology/epp/downloads/release/indigo/SR1/eclipse-jee-indigo-SR1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}"
source "$eclipseArchiveMirror/eclipse/downloads/drops/R-3.7.1-201109091335/eclipse-SDK-3.7.1-${suffix_os[current_os]}${suffix_arch[current_arch]}.${fileExt_os[current_os]}", sourcesOnly: true
source "$eclipseArchiveMirror/eclipse/downloads/drops/R-3.7.1-201109091335/eclipse-3.7.1-delta-pack.zip"
Expand Down
19 changes: 19 additions & 0 deletions pluginScripts/unpuzzle-0.0.9.plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}

dependencies {
classpath 'org.akhikhl.unpuzzle:unpuzzle-plugin:0.0.9'
}
}

// apply plugin: 'unpuzzle-plugin'

import org.akhikhl.unpuzzle.UnpuzzlePlugin

if (!project.plugins.findPlugin(UnpuzzlePlugin))
project.apply(plugin: UnpuzzlePlugin)

0 comments on commit a58ec74

Please sign in to comment.