Commits

Meikel Brandmeyer committed 6f5e144

Make easy clojars deployment for clojuresque itself

Comments (0)

Files changed (1)

 group = 'clojuresque'
 version = '1.2.0-SNAPSHOT'
 
+configurations {
+    clojarsDeployerJars {
+        visible = false
+        description = 'Private configuration to hold ssh wagon dependencies'
+    }
+}
+
 repositories {
     flatDir name: 'gradle', dirs: new File(System.getenv('GRADLE_HOME') + '/lib')
     mavenCentral()
     groovy name: 'antlr', version:'2.7.7'
     groovy name: 'ant', version:'1.7.0'
     groovy name: 'ivy', version:'2.1.0-rc2'
+
+    clojarsDeployerJars 'org.apache.ant:ant-jsch:1.7.0'
 }
 
-// Dummy to make gradle generate a POM.
+ant.taskdef name: 'clojarsScpDeploy', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', classpath: configurations.clojarsDeployerJars.asPath
+
+File dummyRepo = new File(project.buildDir, 'deploy')
+
 uploadArchives {
     repositories.mavenDeployer {
-        repository(url: String.format("file://%s/dummy-repo", project.buildDir.path))
+        name = 'dummyClojarsLocalDeployer'
+        description  = 'Dummy deployer to trick gradle into pom generation'
+        repository(url: 'file://' + dummyRepo.path)
     }
 }
 
-task deployClojars(dependsOn: uploadArchives) << {
-    ant.exec(executable: '/usr/bin/scp') {
-        arg(value: String.format("%s/poms/pom-default.xml",
-            project.buildDir.path))
-        arg(value: String.format("%s/libs/%s-%s.jar",
-            project.buildDir.path,
-            project.name, project.version))
-        arg(value: "clojars@clojars.org:")
+uploadArchives.doLast {
+    ant.clojarsScpDeploy(todir: 'clojars@clojars.org:', keyfile: new File(project.clojarsKeyfile).absolutePath, passphrase: project.clojarsPassphrase) {
+        fileset(dir: dummyRepo, excludes: '**/maven-metadata.xml*')
     }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.