From b0bbf1729621a0b198500b4e13c707a5ca7708da Mon Sep 17 00:00:00 2001 From: Jihoon Song Date: Fri, 26 Apr 2013 15:39:08 +0900 Subject: [PATCH] [Title] cli: support the automatically develop certificate injection to the profile list [Desc.] [Issue] Change-Id: Ia360ee8cda444684863d509db1665a8d5cbaa99f --- .../src/org/tizen/cli/exec/LaunchOptionConstants.java | 14 ++++++++++++++ org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/org.tizen.cli/src/org/tizen/cli/exec/LaunchOptionConstants.java b/org.tizen.cli/src/org/tizen/cli/exec/LaunchOptionConstants.java index 5e7a49b..dc0ea89 100755 --- a/org.tizen.cli/src/org/tizen/cli/exec/LaunchOptionConstants.java +++ b/org.tizen.cli/src/org/tizen/cli/exec/LaunchOptionConstants.java @@ -201,4 +201,18 @@ public class LaunchOptionConstants *

*/ public static final String DESC_OVERWRITE = "Overwrite output file if it exists"; + + /** + *

+ * Option for develop mode + *

+ */ + public static final String OPT_DEVELOP = "develop"; + + /** + *

+ * Description for develop mode of profile + *

+ */ + public static final String DESC_DEVELOP_PROFILE = "Add the profile information for development automatically"; } diff --git a/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java index 6d885c1..45d58a0 100755 --- a/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java +++ b/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java @@ -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 profileItems = new ArrayList(); + + 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 ); -- 2.7.4