[Title] cli: support the automatically develop certificate injection to the profile...
authorJihoon Song <jihoon80.song@samsung.com>
Fri, 26 Apr 2013 06:39:08 +0000 (15:39 +0900)
committerJihoon Song <jihoon80.song@samsung.com>
Tue, 30 Apr 2013 01:05:28 +0000 (10:05 +0900)
[Desc.]
[Issue]

Change-Id: Ia360ee8cda444684863d509db1665a8d5cbaa99f

org.tizen.cli/src/org/tizen/cli/exec/LaunchOptionConstants.java
org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java

index 5e7a49b..dc0ea89 100755 (executable)
@@ -201,4 +201,18 @@ public class LaunchOptionConstants
      * </p>
      */
     public static final String DESC_OVERWRITE = "Overwrite output file if it exists";
+    
+    /**
+     *  <p>
+     *  Option for develop mode
+     *  </p>
+     */
+    public static final String OPT_DEVELOP = "develop";
+    
+    /**
+     * <p>
+     * Description for develop mode of profile
+     * </p> 
+     */
+    public static final String DESC_DEVELOP_PROFILE = "Add the profile information for development automatically";
 }
index 6d885c1..45d58a0 100755 (executable)
@@ -29,6 +29,7 @@ import static org.tizen.common.util.ObjectUtil.nvl;
 
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.cli.CommandLine;
@@ -42,6 +43,8 @@ import static org.tizen.cli.exec.LaunchOptionConstants.OPT_INCLUDE;
 import static org.tizen.cli.exec.LaunchOptionConstants.DESC_INCLUDE;
 import static org.tizen.cli.exec.LaunchOptionConstants.OPT_EXCLUDE;
 import static org.tizen.cli.exec.LaunchOptionConstants.DESC_EXCLUDE;
+import static org.tizen.cli.exec.LaunchOptionConstants.OPT_DEVELOP;
+import static org.tizen.cli.exec.LaunchOptionConstants.DESC_DEVELOP_PROFILE;
 
 import org.tizen.cli.exec.AbstractLauncher;
 import org.tizen.cli.exec.Help;
@@ -52,6 +55,8 @@ import org.tizen.common.file.FileHandler;
 import org.tizen.common.file.FileHandler.Attribute;
 import org.tizen.common.sign.command.ReadSigningProfileFileCommand;
 import org.tizen.common.sign.command.SignCommand;
+import org.tizen.common.sign.preferences.SigningProfileItem;
+import org.tizen.common.sign.util.SigningProfileUtil;
 import org.tizen.common.util.CollectionUtil;
 import org.tizen.common.util.FilenameUtil;
 
@@ -152,6 +157,7 @@ extends AbstractLauncher
                opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_EXCLUDE ).withDescription( DESC_EXCLUDE ).create( OPT_EXCLUDE.substring( 0, 1 ) ) );
                
                opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_PROFILE ).withDescription( DESC_PROFILE ).create( OPT_PROFILE.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.withLongOpt( OPT_DEVELOP ).withDescription( DESC_DEVELOP_PROFILE ).create( OPT_DEVELOP.substring( 0, 1 ) ) );
                
                return opts;
        }
@@ -243,6 +249,13 @@ extends AbstractLauncher
                    return ;
                }
                
+               List<SigningProfileItem> profileItems = new ArrayList<SigningProfileItem>();
+               
+               if ( cmdLine.hasOption( OPT_DEVELOP ) ) {
+               // Always add a developer certificate first because must be "signature1.xml"
+               profileItems.add( SigningProfileUtil.createDeveloperItem() );
+               }
+               
                final ReadSigningProfileFileCommand readProfile = new ReadSigningProfileFileCommand( profilesFilePath, profileName );
                getExecutor().execute( readProfile );
                logger.info( "Profiles file[{}] is read", profilesFilePath );
@@ -253,7 +266,9 @@ extends AbstractLauncher
                        return ;
                }
 
-               final SignCommand command = new SignCommand( baseDir, profileName, readProfile.getProfileItems() );
+               profileItems.addAll( readProfile.getProfileItems() );
+               
+               final SignCommand command = new SignCommand( baseDir, profileName, profileItems );
                command.setIncludes( includes );
                command.setExcludes( excludes );
                getExecutor().execute( command );