From 5ae93a1ba0f8cc44182633602d33067fc7d90999 Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Wed, 7 May 2014 09:57:20 +0200 Subject: [PATCH 1/5] introduced method Configurer.updateTasks --- .../org/akhikhl/unpuzzle/Configurer.groovy | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy index a28b4aa..516bd96 100644 --- a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy +++ b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy @@ -51,16 +51,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() } @@ -70,8 +66,6 @@ class Configurer { } project.task('uninstallEclipse') { - group = 'unpuzzle' - description = 'Uninstalls mavenized artifacts of the eclipse distribution from local maven repository' outputs.upToDateWhen { uninstallEclipseUpToDate() } @@ -81,17 +75,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() @@ -101,16 +91,33 @@ class Configurer { effectiveConfig.unpuzzleDir.deleteDir() } } + + updateTasks('unpuzzle') + project.ext._effectiveUnpuzzle = null } // project.afterEvaluate } + void updateTasks(String taskGroup) { + def mavenGroupPath = new File(effectiveConfig.localMavenRepositoryDir, effectiveConfig.selectedVersionConfig.eclipseMavenGroup).absolutePath + project.tasks.downloadEclipse.group = taskGroup + project.tasks.downloadEclipse.description = "Downloads eclipse version ${effectiveConfig.selectedEclipseVersion} into ${effectiveConfig.unpuzzleDir} directory" + project.tasks.installEclipse.group = taskGroup + project.tasks.installEclipse.description = "Mavenizes and installs bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} into ${mavenGroupPath}" + project.tasks.uninstallEclipse.group = taskGroup + project.tasks.uninstallEclipse.description = "Uninstalls mavenized bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} from ${mavenGroupPath}" + project.tasks.uploadEclipse.group = taskGroup + project.tasks.uploadEclipse.description = "Uploads mavenized bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} to remote maven repository" + project.tasks.cleanEclipse.group = taskGroup + project.tasks.cleanEclipse.description = "uninstalls all mavenized artifacts, cleans ${effectiveConfig.unpuzzleDir} directory" + } + void downloadEclipse() { def vconf = getSelectedVersionConfig() new EclipseDownloader().downloadAndUnpack(vconf.sources, effectiveConfig.unpuzzleDir) } final Config getEffectiveConfig() { - if(!project.ext.has('_effectiveUnpuzzle')) { + if(!project.ext.has('_effectiveUnpuzzle') || project._effectiveUnpuzzle == null) { Config econfig = new Config() Config.merge(econfig, project.unpuzzle) project.ext._effectiveUnpuzzle = econfig From 5b066fc53f9541eac89db467e31f76ce95d97891 Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Wed, 7 May 2014 11:21:42 +0200 Subject: [PATCH 2/5] fixed updateTasks --- .../org/akhikhl/unpuzzle/Configurer.groovy | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy index 516bd96..df3a9f8 100644 --- a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy +++ b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy @@ -92,23 +92,31 @@ class Configurer { } } - updateTasks('unpuzzle') - project.ext._effectiveUnpuzzle = null - } // project.afterEvaluate + if(!project.tasks.downloadEclipse.group) + updateTasks('unpuzzle') + } // project.afterEvaluate } void updateTasks(String taskGroup) { - def mavenGroupPath = new File(effectiveConfig.localMavenRepositoryDir, effectiveConfig.selectedVersionConfig.eclipseMavenGroup).absolutePath - project.tasks.downloadEclipse.group = taskGroup - project.tasks.downloadEclipse.description = "Downloads eclipse version ${effectiveConfig.selectedEclipseVersion} into ${effectiveConfig.unpuzzleDir} directory" - project.tasks.installEclipse.group = taskGroup - project.tasks.installEclipse.description = "Mavenizes and installs bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} into ${mavenGroupPath}" - project.tasks.uninstallEclipse.group = taskGroup - project.tasks.uninstallEclipse.description = "Uninstalls mavenized bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} from ${mavenGroupPath}" - project.tasks.uploadEclipse.group = taskGroup - project.tasks.uploadEclipse.description = "Uploads mavenized bundles of the eclipse version ${effectiveConfig.selectedEclipseVersion} to remote maven repository" - project.tasks.cleanEclipse.group = taskGroup - project.tasks.cleanEclipse.description = "uninstalls all mavenized artifacts, cleans ${effectiveConfig.unpuzzleDir} directory" + Config econfig = new Config() + Config.merge(econfig, project.unpuzzle) + if(econfig.selectedVersionConfig != 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() { @@ -117,7 +125,7 @@ class Configurer { } final Config getEffectiveConfig() { - if(!project.ext.has('_effectiveUnpuzzle') || project._effectiveUnpuzzle == null) { + if(!project.ext.has('_effectiveUnpuzzle')) { Config econfig = new Config() Config.merge(econfig, project.unpuzzle) project.ext._effectiveUnpuzzle = econfig From e3259ae612d6aab21034d318604065a46842fa5e Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Wed, 7 May 2014 11:44:24 +0200 Subject: [PATCH 3/5] introduced flag Configurer.loadDefaultConfig --- .../org/akhikhl/unpuzzle/Configurer.groovy | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy index df3a9f8..af57118 100644 --- a/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy +++ b/libs/unpuzzle-plugin/src/main/groovy/org/akhikhl/unpuzzle/Configurer.groovy @@ -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 @@ -100,7 +101,7 @@ class Configurer { void updateTasks(String taskGroup) { Config econfig = new Config() Config.merge(econfig, project.unpuzzle) - if(econfig.selectedVersionConfig != null) { + if(econfig.selectedVersionConfig != null && econfig.localMavenRepositoryDir != null) { def mavenGroupPath if(econfig.selectedVersionConfig.eclipseMavenGroup) mavenGroupPath = new File(econfig.localMavenRepositoryDir, econfig.selectedVersionConfig.eclipseMavenGroup).absolutePath @@ -134,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 } @@ -163,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 From 52dfd774f0da6ab49a43ac5c25f0ad3be8bd7e3a Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Wed, 7 May 2014 11:49:48 +0200 Subject: [PATCH 4/5] optimization in defaultConfig --- .../org/akhikhl/unpuzzle/defaultConfig.groovy | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/libs/unpuzzle-plugin/src/main/resources/org/akhikhl/unpuzzle/defaultConfig.groovy b/libs/unpuzzle-plugin/src/main/resources/org/akhikhl/unpuzzle/defaultConfig.groovy index faa8d23..db943dd 100644 --- a/libs/unpuzzle-plugin/src/main/resources/org/akhikhl/unpuzzle/defaultConfig.groovy +++ b/libs/unpuzzle-plugin/src/main/resources/org/akhikhl/unpuzzle/defaultConfig.groovy @@ -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' @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" From 5fec4dac15f5580577af6f7997b29ac3dcc9c8a5 Mon Sep 17 00:00:00 2001 From: Andrey Hihlovskiy Date: Wed, 7 May 2014 11:57:38 +0200 Subject: [PATCH 5/5] bumped version to 0.0.9 --- README.md | 8 ++++---- build.gradle | 2 +- examples/deployEclipseKepler/build.gradle | 2 +- pluginScripts/unpuzzle-0.0.9.plugin | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 pluginScripts/unpuzzle-0.0.9.plugin diff --git a/README.md b/README.md index 5eb6e40..eb0ce01 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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. [Unpuzzle configuration](#Unpuzzle-configuration) 5. [uploadEclipse configuration](#uploadeclipse-configuration) 6. [Configuration hierarchy](#configuration-hierarchy) @@ -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. ## Unpuzzle configuration diff --git a/build.gradle b/build.gradle index d30f674..3d4b4fc 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/examples/deployEclipseKepler/build.gradle b/examples/deployEclipseKepler/build.gradle index d971b1b..432365f 100644 --- a/examples/deployEclipseKepler/build.gradle +++ b/examples/deployEclipseKepler/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'org.akhikhl.unpuzzle:unpuzzle-eclipse2maven:0.0.8' + classpath 'org.akhikhl.unpuzzle:unpuzzle-eclipse2maven:0.0.9' } } diff --git a/pluginScripts/unpuzzle-0.0.9.plugin b/pluginScripts/unpuzzle-0.0.9.plugin new file mode 100644 index 0000000..62c3a48 --- /dev/null +++ b/pluginScripts/unpuzzle-0.0.9.plugin @@ -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) +