Permalink
Browse files

Cleaned up the deployment plugin's code.

  • Loading branch information...
1 parent 8a5d916 commit 285dd0626323d7d28e1fad5a829a322eb3683436 @anagrius anagrius committed Feb 27, 2011
Showing with 17 additions and 27 deletions.
  1. +17 −27 src/main/groovy/com/trifork/gradle/DeploymentPlugin.groovy
@@ -8,19 +8,17 @@ class DeploymentPlugin implements Plugin<Project> {
def void apply(Project p) {
- def convention = new DeploymentPluginConvention()
- p.convention.plugins.deployment = convention
+ // Apply the Maven plugin to the project.
- if (!p.plugins.hasPlugin('maven')) {
- p.apply plugin: 'maven'
- }
+ p.getPlugins().apply(MavenPlugin.class);
+
+ // Add the deployment tasks.
p.task([dependsOn: 'uploadArchives'], 'deploySnapshot')
p.task([dependsOn: 'uploadArchives'], 'deployRelease')
- // In order to deploy the artifacts we need some dependencies.
- // The actually jars needed depend on how we are going to deploy.
- // By default we just use HTTP to deploy.
+ // In order to deploy, we need deployer dependency.
+ // Currently we just use HTTP to deploy.
p.configurations {
deployerJars
@@ -43,28 +41,20 @@ class DeploymentPlugin implements Plugin<Project> {
p.uploadArchives.dependsOn p.tasks.sourcesJar
- p.gradle.taskGraph.whenReady { graph ->
-
- // Determine if this is a release or a snapshot
+ // Determine if this is a release or a snapshot.
+ p.gradle.taskGraph.whenReady { graph ->
if (!graph.hasTask(p.tasks.deployRelease)) p.version += '-SNAPSHOT'
-
- p.uploadArchives {
- repositories.mavenDeployer {
- configuration = p.configurations.deployerJars
- repository(id: 'trifork-releases', url: 'http://nexus.ci81.trifork.com/content/repositories/releases/')
- snapshotRepository(id: 'trifork-snapshots', url: 'http://nexus.ci81.trifork.com/content/repositories/snapshots/')
- }
+ }
+
+ // Configure the deployment destinations.
+
+ p.uploadArchives {
+ repositories.mavenDeployer {
+ configuration = p.configurations.deployerJars
+ repository(id: 'trifork-releases', url: 'http://nexus.ci81.trifork.com/content/repositories/releases/')
+ snapshotRepository(id: 'trifork-snapshots', url: 'http://nexus.ci81.trifork.com/content/repositories/snapshots/')
}
}
}
}
-
-class DeploymentPluginConvention {
- String nextReleaseVersion
-
- def deployment(Closure closure) {
- closure.delegate = this
- closure()
- }
-}

0 comments on commit 285dd06

Please sign in to comment.