maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r810636 - in /maven/plugins/trunk/maven-gpg-plugin: ./ src/main/java/org/apache/maven/plugin/gpg/
Date Wed, 02 Sep 2009 18:06:39 GMT
Author: bentmann
Date: Wed Sep  2 18:06:38 2009
New Revision: 810636

URL: http://svn.apache.org/viewvc?rev=810636&view=rev
Log:
[MGPG-16] Allow to configure homedir for gpg invocation

Modified:
    maven/plugins/trunk/maven-gpg-plugin/pom.xml
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java

Modified: maven/plugins/trunk/maven-gpg-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/pom.xml?rev=810636&r1=810635&r2=810636&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-gpg-plugin/pom.xml Wed Sep  2 18:06:38 2009
@@ -29,7 +29,7 @@
   </parent>
 
   <artifactId>maven-gpg-plugin</artifactId>
-  <version>1.0-alpha-5-SNAPSHOT</version>
+  <version>1.0-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Maven GPG Plugin</name>

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java?rev=810636&r1=810635&r2=810636&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
(original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
Wed Sep  2 18:06:38 2009
@@ -55,6 +55,15 @@
     private static final String DEFAULT_EXCLUDES[] = new String[] { "**/*.md5", "**/*.sha1",
"**/*.asc" };
 
     /**
+     * The directory from which gpg will load keyrings. If not specified, gpg will use the
value configured for its
+     * installation, e.g. <code>~/.gnupg</code> or <code>%APPDATA%/gnupg</code>.
+     * 
+     * @parameter expression="${gpg.homedir}"
+     * @since 1.0
+     */
+    private File homedir;
+
+    /**
      * The passphrase to use when signing.
      * 
      * @parameter expression="${gpg.passphrase}"
@@ -192,6 +201,7 @@
         signer.setOutputDirectory( outputDirectory );
         signer.setBuildDirectory( new File( project.getBuild().getDirectory() ) );
         signer.setBaseDirectory( project.getBasedir() );
+        signer.setHomeDirectory( homedir );
 
         List signingBundles = new ArrayList();
 

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java?rev=810636&r1=810635&r2=810636&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
(original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
Wed Sep  2 18:06:38 2009
@@ -51,6 +51,8 @@
 
     private File baseDir;
 
+    private File homeDir;
+
     public GpgSigner()
     {
     }
@@ -85,6 +87,11 @@
         baseDir = out;
     }
 
+    public void setHomeDirectory( File homeDirectory )
+    {
+        homeDir = homeDirectory;
+    }
+
     public File generateSignatureForArtifact( File file, String pass )
         throws MojoExecutionException
     {
@@ -132,6 +139,12 @@
 
         cmd.setExecutable( "gpg" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" ) );
 
+        if ( homeDir != null )
+        {
+            cmd.createArg().setValue( "--homedir" );
+            cmd.createArg().setFile( homeDir );
+        }
+
         if ( useAgent )
         {
             cmd.createArg().setValue( "--use-agent" );

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java?rev=810636&r1=810635&r2=810636&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
(original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
Wed Sep  2 18:06:38 2009
@@ -52,6 +52,15 @@
 {
 
     /**
+     * The directory from which gpg will load keyrings. If not specified, gpg will use the
value configured for its
+     * installation, e.g. <code>~/.gnupg</code> or <code>%APPDATA%/gnupg</code>.
+     * 
+     * @parameter expression="${gpg.homedir}"
+     * @since 1.0
+     */
+    private File homedir;
+
+    /**
      * The passphrase to use when signing.
      * 
      * @parameter expression="${gpg.passphrase}"
@@ -247,6 +256,7 @@
         signer.setUseAgent( useAgent );
         signer.setOutputDirectory( ascDirectory );
         signer.setBaseDirectory( new File( "foo" ).getAbsoluteFile().getParentFile().getAbsoluteFile()
);
+        signer.setHomeDirectory( homedir );
 
         setDeployer( new SignedArtifactDeployer( deployer, passphrase ) );
         super.execute();



Mime
View raw message