import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
import org.tizen.nativeplatform.rootstrap.RootstrapManager;
import org.tizen.nativeplatform.util.RootstrapUtil;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.nativeplatform.command.launcher.RemoteCommandUtil;
public class PlatformBuildCommandLauncher extends CommandLauncher {
IProject proj = getProject();
String targetId = PlatformConfigurationManager.getBuildTargetName(config);
String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
- if (RootstrapManager.getRootstrap(rootId).isDefault()) {
+
+ PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
+
+ if (rootstrap != null && rootstrap.isDefault()) {
Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, "Select user rootstrap",
null);
throw new CoreException(status);
if (needRemoteSync) {
checkRemoteConnection();
syncWorkspace(project, configuration, monitor);
- readySyncRootstrap(rootstrap);
+ if (rootstrap != null) {
+ readySyncRootstrap(rootstrap);
+ }
}
UserLogger.start(UserInteraction.CATE_PLATFORM_BUILD);
if (exitValue == 0) {
IBuildResultProcessor processor = PlatformBuildResultProcessorFactory
.getProcessor(BUILDTOOL.GBS, configuration);
- if (processor.process(buildArguments)) {
- String[] rpmFiles = processor.getRpmFiles();
- String[] xmlFiles = processor.getXmlFiles();
- if (rpmFiles.length > 0) {
- buf = new StringBuffer(NEWLINE);
- buf.append("**** RPM files ****").append(NEWLINE);
- for (String file : rpmFiles) {
- buf.append(" - ").append(file).append(NEWLINE);
- }
- }
+ if (processor != null && processor.process(buildArguments)) {
+ String[] rpmFiles = processor.getRpmFiles();
+ String[] xmlFiles = processor.getXmlFiles();
+ if (rpmFiles.length > 0) {
+ buf = new StringBuffer(NEWLINE);
+ buf.append("**** RPM files ****").append(NEWLINE);
+ for (String file : rpmFiles) {
+ buf.append(" - ").append(file).append(NEWLINE);
+ }
+ }
if (xmlFiles.length > 0) {
- buf.append(NEWLINE);
- buf.append("**** XML files ****").append(NEWLINE);
- for (String file : xmlFiles) {
- buf.append(" - ").append(file).append(NEWLINE);
- }
+ buf.append(NEWLINE);
+ buf.append("**** XML files ****").append(NEWLINE);
+ for (String file : xmlFiles) {
+ buf.append(" - ").append(file).append(NEWLINE);
+ }
}
- consoleOut.write(buf.toString().getBytes());
+ consoleOut.write(buf.toString().getBytes());
} else {
buf = new StringBuffer(NEWLINE);
buf.append("**** Failed to synchronize output files ****").append(
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.OSChecker;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
import org.tizen.sdblib.util.DeviceUtil;
public class DeviceChangeListener implements IDeviceChangeListener {
-
+
protected final Logger logger = LoggerFactory.getLogger(DeviceChangeListener.class);
@Override
e.printStackTrace();
logger.error("Faile to root on device", e);
}
-
- target.getDeviceCommander().actionBeforeUsingZypper();
+ IPkgCommander pkgCommander = target.getDeviceCommander();
+ if (pkgCommander != null) {
+ pkgCommander.actionBeforeUsingZypper();
+ }
if (OSChecker.isWindows() && RemoteConnectionManager.connected()) {
SSHUtil.transferSshKey(target);
}
killIfRunningApplication(appId);
}
boolean result = installPackages(configurationIsSet, monitor);
- UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH);
+ UserLogger
+ .end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH);
return result;
} else {
monitor.beginTask("", 2);
try {
- String descMsg = "";
+ String descMsg = "";
if (!installPackages(configurationIsSet, new SubProgressMonitor(monitor, 1))) {
descMsg = "Installation seems to be failed. Check package installation log.";
}
- UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH);
+ UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH,
+ PlatformUserInteraction.PRE_LAUNCH);
if (!setLaunchConfiguration(new SubProgressMonitor(monitor, 1), descMsg, isEflApp)) {
return false;
}
}
return true;
}
-
+
private boolean _installPackages(List<IPackage> devicePkgs, List<IPackage> rootstrapPkgs,
boolean reinstallOp, IProgressMonitor monitor) throws CoreException {
int totalWorks = 2;
return true;
}
-
+
private void setSmackRule() {
String[] programPaths = PlatformLaunchUtil.getProgramPath(project);
if (programPaths == null || programPaths.length <= 0) {
return;
}
IPkgCommander commander = target.getDeviceCommander();
+ if (commander == null) {
+ return;
+ }
StringBuffer pathlist = new StringBuffer();
for (String path : programPaths) {
pathlist.append(path);
if (a_label != null && !a_label.isEmpty()) {
commander.executeBinary(getSmackRuleCommand(a_label));
}
- commander.setSmackExecute(filepath, "\"\"");
+ //if (commander != null) {
+ commander.setSmackExecute(filepath, "\"\"");
+ //}
}
}
devicePackages.addAll(maker.makeModels(devicePkgStr));
rootstrapPackages.addAll(maker.makeModels(rootstrapPkgStr));
} else {
- List<IPackage> packages = null;
- packages = pkgUtil.getPackages(project, buildConfig);
+ List<IPackage> packages = null;
+ packages = pkgUtil.getPackages(project, buildConfig);
if (packages != null && !packages.isEmpty()) {
devicePackages.addAll(pkgFilter.filter(CmdTargetTypes.DEVICE, packages));
rootstrapPackages.addAll(pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages));
private boolean setLaunchConfiguration(IProgressMonitor monitor, final String descMsg,
final boolean isEflApp) throws CoreException {
-
+
monitor.beginTask("", 1);
final ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
try {
boolean loadSharedLib = dlg.loadSharedLibAutomatically();
applicationId = dlg.getSelectedApp();
Map<String, String> environments = dlg.getEnvironments();
- setOptionAttributes(wc, programPath, arguments, applicationId, environments, loadSharedLib);
+ setOptionAttributes(wc, programPath, arguments, applicationId,
+ environments, loadSharedLib);
}
}
});
} finally {
monitor.done();
}
-
+
if (isSetProgramPath(launchConfig)) {
if (applicationId != null && !applicationId.isEmpty()) {
killIfRunningApplication(applicationId);
return false;
}
}
+
/*
- protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath,
- String arguments, String applicationId, List<IPackage> devicePackages,
- List<IPackage> rootstrapPackages, boolean reinstallOp, boolean selectPkgOp,
- Map<String, String> environments) {
- setOptionAttributes(wc, programPath, arguments, applicationId, environments);
- setOptionAttributes(wc, devicePackages, rootstrapPackages, reinstallOp);
- }
- */
+ * protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc,
+ * String programPath, String arguments, String applicationId,
+ * List<IPackage> devicePackages, List<IPackage> rootstrapPackages, boolean
+ * reinstallOp, boolean selectPkgOp, Map<String, String> environments) {
+ * setOptionAttributes(wc, programPath, arguments, applicationId,
+ * environments); setOptionAttributes(wc, devicePackages, rootstrapPackages,
+ * reinstallOp); }
+ */
protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath,
- String arguments, String applicationId, Map<String, String> environments, boolean loadSharedLib) {
+ String arguments, String applicationId, Map<String, String> environments,
+ boolean loadSharedLib) {
if (programPath != null) {
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
}
protected IConfiguration getBuildConfiguration() {
return PlatformConfigurationManager.getDefaultConfiguration(project);
}
-
- protected boolean questionIfNoPackagesToInstall(List<IPackage> devicePackages, List<IPackage> rootstrapPackages) {
+
+ protected boolean questionIfNoPackagesToInstall(List<IPackage> devicePackages,
+ List<IPackage> rootstrapPackages) {
final StringBuffer msg = new StringBuffer();
if (devicePackages.isEmpty()) {
msg.append("There is no package to install to device.");
msg.append("\n");
- }
+ }
if (mode.equals(ILaunchManager.DEBUG_MODE) && rootstrapPackages.isEmpty()) {
msg.append("There is no package to install to rootstrap.");
msg.append("\n");
try {
PushbackInputStream pb = new PushbackInputStream(pgdb.getInputStream());
gdbInputStream = pb;
- /*
- * gdb process is terminated after execution pb.read() and pb.unread() (on windows)
- * It is not entirely clear whether to need push back process.
+ /*
+ * gdb process is terminated after execution pb.read() and
+ * pb.unread() (on windows) It is not entirely clear whether
+ * to need push back process.
*/
// pb.unread(pb.read());
} catch (Exception e) {
e.printStackTrace();
}
if (monitor.isCanceled()) {
- gdbProcess.destroy();
+ if (gdbProcess != null) {
+ gdbProcess.destroy();
+ }
throw new OperationCanceledException();
} else if (timepass >= launchTimeout) {
- gdbProcess.destroy();
+ if (gdbProcess != null) {
+ gdbProcess.destroy();
+ }
String message = MIPlugin.getResourceString("src.GDBDebugger.Error_launch_timeout"); //$NON-NLS-1$
throw new IOException(message);
}
protected String rootPath = "";
protected Shell shell;
protected IPackageUtil pkgUtil = PkgUtilFactory.getPkgUtil(PlatformProjectUtil.getPkgType());
- protected IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil
- .getPkgType());
+ protected IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
protected PlatformLaunchCommonPage(String pageName) {
super(pageName);
platformPackages = getPackages(platformProject, config);
// Do not try packaging because it is already tried previous step.
// (PlatformProjectLaunchShortcut)
- if (!platformPackages.isEmpty()) {
+ if (platformPackages != null && !platformPackages.isEmpty()) {
packages.addAll(platformPackages);
devicePackages.addAll(pkgFilter.filter(CmdTargetTypes.DEVICE, packages));
rootstrapPackages.addAll(pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages));
public List<IPackage> getPackages() {
return packages;
}
-
+
public List<IPackage> getDevicePackages() {
return devicePackages;
}
-
+
public List<IPackage> getRootstrapPackages() {
return rootstrapPackages;
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.FilenameUtil;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
public RemoteRpmModelMaker() {
target = new PkgCommandTarget(PkgTypes.REMOTERPM);
}
-
+
private IPackage _makeModel(String filePath) {
RemoteRpmPackage pkg = new RemoteRpmPackage();
- String[] info = target.getCommander(CmdTargetTypes.HOST, false).getInfoFromFile(filePath);
- if (info == null) {
- logger.error(String.format("Failed to get rpm information: %s", filePath));
- return null;
+ IPkgCommander pkgCommander = target.getCommander(CmdTargetTypes.HOST, false);
+ if (pkgCommander != null) {
+ String[] info = pkgCommander.getInfoFromFile(filePath);
+ if (info == null) {
+ logger.error(String.format("Failed to get rpm information: %s", filePath));
+ return null;
+ }
+ pkg.setPath(filePath);
+ pkg.setName(info[0]);
+ pkg.setArch(info[1]);
+ pkg.setVer(info[2]);
}
- pkg.setPath(filePath);
- pkg.setName(info[0]);
- pkg.setArch(info[1]);
- pkg.setVer(info[2]);
return pkg;
}
pkg.setNeedsFilter(needsFilter);
return pkg;
}
-
+
public List<IPackage> makeModels(List<String> filePaths) {
List<IPackage> pkgs = new ArrayList<IPackage>();
for (String path : filePaths) {
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
private IPackage _makeModel(String filePath) {
RpmPackage pkg = new RpmPackage();
- String[] info = target.getCommander(CmdTargetTypes.HOST, false).getInfoFromFile(filePath);
- if (info == null) {
- logger.error(String.format("Failed to get rpm information: %s", filePath));
- return null;
+ IPkgCommander pkgCommander = target.getCommander(CmdTargetTypes.HOST, false);
+ if (pkgCommander != null) {
+ String[] info = pkgCommander.getInfoFromFile(filePath);
+ if (info == null) {
+ logger.error(String.format("Failed to get rpm information: %s", filePath));
+ return null;
+ }
+ pkg.setPath(filePath);
+ pkg.setName(info[0]);
+ pkg.setArch(info[1]);
+ pkg.setVer(info[2]);
}
- pkg.setPath(filePath);
- pkg.setName(info[0]);
- pkg.setArch(info[1]);
- pkg.setVer(info[2]);
return pkg;
}
composite.setLayoutData(gridData);
composite.setLayout(new FillLayout());
- repoViewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ repoViewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.FULL_SELECTION);
createColumnsForRepoTable(composite);
Table reposTable = repoViewer.getTable();
reposTable.setHeaderVisible(true);
if (categoryCombo.getText().equals("Upgradable")) {
IPkgVersionComparer comp = PkgVersionComparerFactory
.getComparer(PlatformProjectUtil.getPkgType());
+ if (comp == null) {
+ return false;
+ }
if (pkg.getInstalledVer().isEmpty() || pkg.getNewVer().isEmpty()
|| comp.compare(pkg.getInstalledVer(), pkg.getNewVer()) >= 0) {
return false;
}
}
- protected void handleRemovePackageButton() {
+ protected void handleRemovePackageButton() {
final List<PkgStatus> selectedList = getSelectedPkgList(true);
if (selectedList.isEmpty()) {
DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package")
public class RemoteConnectionManager {
public static String DEFAULT_CONNECTION_NAME = "remote_connection";
private static Map<String, RemoteTools> connectionMap = new HashMap<String, RemoteTools>();
-
+
public static final Logger logger = LoggerFactory.getLogger(RemoteConnectionManager.class);
public static boolean createConnection(String host, String user, String pass, String publicKey,
if (conn == null) {
monitor.beginTask("Creating connection...", 2);
IRemoteConnectionManager manager = getConnectionManager();
- conn = manager.newConnection(connectionName);
+ if (manager != null) {
+ conn = manager.newConnection(connectionName);
+ }
conn.setAddress(host);
conn.setUsername(user);
conn.setPassword(pass);
}
IRemoteConnectionManager manager = getConnectionManager();
try {
- manager.removeConnection(conn);
+ if (manager != null) {
+ manager.removeConnection(conn);
+ }
} catch (RemoteConnectionException e) {
e.printStackTrace();
}
throws CoreException {
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
List<IPackage> pkgs = getPackages(project, config);
- if (pkgs.isEmpty()) {
+ if (pkgs != null && pkgs.isEmpty()) {
return false;
}
return true;
public void cachePkgChecksum(IProject project, IConfiguration config) {
try {
- if (!CachePackageChecksum.cachePkgChecksum(project, getPackages(project, config))) {
- logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM);
+ List<IPackage> newPkgs = getPackages(project, config);
+ if (newPkgs != null) {
+ if (!CachePackageChecksum.cachePkgChecksum(project, newPkgs)) {
+ logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM);
+ }
}
+
} catch (InterruptedException e) {
logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM);
e.printStackTrace();
}
public List<IPackage> getPackages(IProject project, IConfiguration config) {
-
+
List<IPackage> cached = PackageStoreManager.get(project, config);
if (cached != null) {
return cached;
}
-
+
List<String> pkgs = new ArrayList<String>();
IFolder folder = project.getFolder(config.getName());
File dir = new File(folder.getLocation().toOSString());
if (dir.exists()) {
String[] files = dir.list(new RpmFileFilter());
for (String file : files) {
- IPath pkgPath = new Path(dir.getPath()).append(file);
- pkgs.add(pkgPath.toOSString());
+ IPath pkgPath = new Path(dir.getPath()).append(file);
+ pkgs.add(pkgPath.toOSString());
}
}
- List<IPackage> newPkgs = getPackages(pkgs);
- PackageStoreManager.put(project, config, newPkgs);
- return newPkgs;
+ List<IPackage> newPkgs = getPackages(pkgs);
+ PackageStoreManager.put(project, config, newPkgs);
+ return newPkgs;
}
-
-public List<IPackage> getPackages(IProject project, IConfiguration config, String selectedRootstrapArch) {
-
- //TODO: commit jaemin return null if curentArchType(i586 or armv7l) does not exist.
-
+
+ public List<IPackage> getPackages(IProject project, IConfiguration config,
+ String selectedRootstrapArch) {
+
+ // TODO: commit jaemin return null if curentArchType(i586 or armv7l)
+ // does not exist.
+
List<IPackage> cached = PackageStoreManager.get(project, config);
-
+
if (cached != null) {
- if(cached.get(0).getArch().equals(selectedRootstrapArch)){
- return cached;
- }else{
- return null;
- }
+ if (cached.get(0).getArch().equals(selectedRootstrapArch)) {
+ return cached;
+ } else {
+ return null;
+ }
}
-
+
List<String> pkgs = new ArrayList<String>();
IFolder folder = project.getFolder(config.getName());
File dir = new File(folder.getLocation().toOSString());
if (dir.exists()) {
String[] files = dir.list(new RpmFileFilter());
for (String file : files) {
- if(file.contains(selectedRootstrapArch)){
- IPath pkgPath = new Path(dir.getPath()).append(file);
- pkgs.add(pkgPath.toOSString());
- }
+ if (file.contains(selectedRootstrapArch)) {
+ IPath pkgPath = new Path(dir.getPath()).append(file);
+ pkgs.add(pkgPath.toOSString());
+ }
}
}
- if(!pkgs.isEmpty()){
- List<IPackage> newPkgs = getPackages(pkgs);
- PackageStoreManager.put(project, config, newPkgs);
- return newPkgs;
+ if (!pkgs.isEmpty()) {
+ List<IPackage> newPkgs = getPackages(pkgs);
+ PackageStoreManager.put(project, config, newPkgs);
+ return newPkgs;
}
return null;
}
List<IPackage> pkgmodel = modelMaker.makeModels(pkgPath);
return pkgmodel;
}
-
+
public static List<String> getRemoteRpmFiles(PlatformRootstrap rootstrap) {
List<String> rpms = new ArrayList<String>();
String rootstrapPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootstrap.getId());