org.eclipse.jgit.storage.file;version="0.12.1",
org.eclipse.jgit.transport;version="0.12.1",
org.eclipse.jgit.util;version="0.12.1",
- org.eclipse.ptp.rdt.core.serviceproviders,
- org.eclipse.ptp.rdt.core.services,
org.eclipse.ptp.remote.core,
org.eclipse.ptp.remote.core.exception,
org.eclipse.ptp.remote.remotetools.core,
- org.eclipse.ptp.remote.rse.core,
org.eclipse.ptp.remotetools.core,
- org.eclipse.ptp.remotetools.environment.launcher.core,
org.eclipse.ptp.remotetools.exception,
- org.eclipse.ptp.services.core,
- org.eclipse.ptp.utils.file.core,
- org.eclipse.rse.core.model,
- org.eclipse.rse.core.subsystems,
- org.eclipse.rse.services.clientserver.messages,
- org.eclipse.rse.services.files,
- org.eclipse.rse.services.shells,
- org.eclipse.rse.shells.ui,
- org.eclipse.rse.subsystems.files.core.model,
- org.eclipse.rse.subsystems.files.core.servicesubsystem,
- org.eclipse.rse.subsystems.files.core.subsystems,
- org.eclipse.rse.subsystems.shells.core.subsystems,
- org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem,
org.eclipse.ui,
org.eclipse.ui.dialogs,
org.eclipse.ui.wizards.datatransfer,
Rootstrap.export=Export
Rootstrap.remove=Remove
Rootstrap.manage.pkgs=Manage Packages
+Rootstrap.sync.include=Sync Includes
## Context menu
Buildpackage.label=Build Package
<extension
point="org.eclipse.ui.contexts">
<context
- id="org.tizen.common.rootstrap.setdefault.context"
+ id="org.tizen.nativeplatform.rootstrap.setdefault.context"
name="%Rootstrap.select"
parentId="org.eclipse.ui.contexts.window">
</context>
<context
- id="org.tizen.common.rootstrap.change.conffile.context"
+ id="org.tizen.nativeplatform.rootstrap.change.conffile.context"
name="%Rootstrap.change.conffile"
parentId="org.eclipse.ui.contexts.window">
</context>
<context
- id="org.tizen.common.rootstrap.lauchpkgmgr.context"
+ id="org.tizen.nativeplatform.rootstrap.lauchpkgmgr.context"
name="%Rootstrap.manage.pkgs"
parentId="org.eclipse.ui.contexts.window">
</context>
<context
- id="org.tizen.common.rootstrap.remove.context"
+ id="org.tizen.nativeplatform.rootstrap.remove.context"
name="%Rootstrap.remove"
parentId="org.eclipse.ui.contexts.window">
</context>
<context
- id="org.tizen.common.rootstrap.export.context"
+ id="org.tizen.nativeplatform.rootstrap.export.context"
name="%Rootstrap.export"
parentId="org.eclipse.ui.contexts.window">
</context>
+ <context
+ id="org.tizen.nativeplatform.rootstrap.sync.includes"
+ name="%Rootstrap.sync.include"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
</extension>
<extension
*/
public void setProject(IProject project);
-/**
- * This roles same as {@link IXMLStore#setProject(IProject),
- * except that this is for CLI because CLI cannot use IProject.
- *
- * @param projectPath path of project in which xml will be stored
- */
- public void setProject(String projectPath);
-
/**
* Parses xml files and loads.
*/
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativeplatform.Activator;
import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
-import org.tizen.nativeplatform.remote.connection.SourceUploader;
+import org.tizen.nativeplatform.remote.connection.WorkspaceDeltaManager;
+import org.tizen.nativeplatform.remote.connection.WorkspaceResourceDelta;
+import org.tizen.nativeplatform.remote.connection.WorkspaceSyncronizer;
import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.RootstrapUtil;
public class PlatformBuildCommandLauncher extends CommandLauncher {
+ String commandLine = "";
+
@Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory,
IProgressMonitor monitor) throws CoreException {
}
String command = builder.getBuildCommand(config);
String[] arguments = builder.getBuildArguments(config);
+ fCommandArgs = new String[arguments.length + 1];
+ fCommandArgs[0] = command;
+ int i = 1;
for (String a : arguments) {
command += " " + a;
+ fCommandArgs[i++] = a;
}
String remoteCmd = command.trim();
- SourceUploader uploader = new SourceUploader(proj);
- String targetpath = uploader.upload();
- if (targetpath == null) {
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
- "Failed to upload source", null);
- throw new CoreException(status);
- }
+ String targetPath = RootstrapUtil.getUserSyncWorkspacePath(proj.getName());
try {
IRemoteExecutionTools exectool = RemoteConnectionManager.getRemoteTools().getExecTool();
IRemoteScript script = exectool.createScript();
- String commands[] = { "cd " + targetpath, remoteCmd };
+ String commands[] = { "cd " + targetPath, remoteCmd };
script.setScript(commands);
script.setFetchProcessErrorStream(true);
script.setFetchProcessInputStream(true);
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
+import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.build.SmartBuildInterface;
@SuppressWarnings("restriction")
if (variableName.equals("SBI_SYSROOT")) {
// set "SBI_SYSROOT" variable
String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
- String sysrootPath = sbi.getPlatformRootstrapPath(
- basePath);
+ String sysrootPath = "";
+ if (OSChecker.isWindows()) {
+ sysrootPath = basePath;
+ } else {
+ sysrootPath = sbi.getPlatformRootstrapPath(basePath);
+ }
if (sysrootPath == null) {
sysrootPath = "";
}
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.build.CommonConfigurationManager;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.RootstrapUtil;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
@SuppressWarnings("restriction")
public class PlatformConfigurationManager extends CommonConfigurationManager {
}
public static String getRootstrapPath(IConfiguration config) {
-
try {
String targetID = getBuildTargetName(config);
if (targetID == null) {
targetID = getDefaultBuildTargetName(config);
}
SmartBuildInterface sbi = SmartBuildInterface.getInstance();
- String path = sbi.getRootstrapPath(targetID);
- if (path == null) {
- return "";
+ if (OSChecker.isWindows()) {
+ String rootstrapId = sbi.getRootstrapIDFromTargetID(targetID);
+ PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootstrapId);
+ if (rootstrap == null) {
+ return "";
+ }
+ String path = RootstrapUtil.getUserSyncRootstrapPath(rootstrap.getId());
+ return path;
} else {
- return sbi.getRootstrapPath(targetID);
+
+ String path = sbi.getRootstrapPath(targetID);
+ if (path == null) {
+ return "";
+ } else {
+ return sbi.getRootstrapPath(targetID);
+ }
}
} catch (SBIException e) {
e.printStackTrace();
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.swt.widgets.Display;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.common.util.log.UserLogger;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.Activator;
import org.tizen.nativeplatform.build.IBuildCommandProvider.BUILDTOOL;
+import org.tizen.nativeplatform.remote.connection.RootstrapSyncronizer;
+import org.tizen.nativeplatform.remote.connection.WorkspaceDeltaManager;
+import org.tizen.nativeplatform.remote.connection.WorkspaceResourceDelta;
+import org.tizen.nativeplatform.remote.connection.WorkspaceSyncronizer;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
import org.tizen.nativeplatform.util.PackageUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
public class PlatformExternalBuildRunner extends ExternalBuildRunner {
final IConfiguration configuration, IBuilder builder, IConsole console,
IMarkerGenerator markerGenerator, IncrementalProjectBuilder projectBuilder,
IProgressMonitor monitor) throws CoreException {
+ String[] buildArgs = getTargets(kind, builder);
+ String targetId = PlatformConfigurationManager.getBuildTargetName(configuration);
+ String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+ final PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
+ boolean isCleanOption = buildArgs[0].equals("clean");
+ if (!isCleanOption) {
+ syncWorkspace(project, configuration, monitor);
+ readySyncRootstrap(rootstrap);
+ }
+
UserLogger.start(UserInteraction.CATE_PLATFORM_BUILD);
boolean isClean = invokeExternalBuild(kind, project, configuration, builder, console,
markerGenerator, projectBuilder, monitor);
pkgUtil.cachePkgChecksum(project, configuration);
}
});
+
+ if (!isCleanOption) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ syncRootstrap(rootstrap);
+ }
+ });
+ }
CCorePlugin.getIndexManager().reindex(CoreModel.getDefault().create(project));
return isClean;
}
+
+ private void readySyncRootstrap(PlatformRootstrap rootstrap) {
+ RootstrapSyncronizer.cacheModificationTime(rootstrap);
+ }
+
+ private void syncRootstrap(PlatformRootstrap rootstrap) {
+ RootstrapSyncronizer.syncronizeIfChanges(rootstrap, new NullProgressMonitor());
+ }
+
+ private void syncWorkspace(IProject project, IConfiguration config, IProgressMonitor monitor)
+ throws CoreException {
+ WorkspaceResourceDelta resourceDelta = WorkspaceDeltaManager.getDelta(project);
+ if (resourceDelta == null) {
+ resourceDelta = new WorkspaceResourceDelta(project);
+ WorkspaceDeltaManager.putDelta(project, resourceDelta);
+ }
+ IResourceDelta delta = resourceDelta.computeDelta();
+ boolean needSync = false;
+ if (delta == null) {
+ needSync = true;
+ } else {
+ IResourceDelta[] deltas = delta.getAffectedChildren();
+ IPath configPath = project.getFile(config.getName()).getFullPath();
+ for (IResourceDelta d : deltas) {
+ if (!d.getFullPath().equals(configPath)) {
+ needSync = true;
+ break;
+ }
+ }
+ }
+ if (needSync) {
+ if(!WorkspaceSyncronizer.syncronize(project, new SubProgressMonitor(monitor, 1))) {
+ Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
+ "Failed to syncronized workspace", null);
+ throw new CoreException(status);
+ }
+ }
+ }
protected boolean invokeExternalBuild(int kind, IProject project, IConfiguration configuration,
IBuilder builder, IConsole console, IMarkerGenerator markerGenerator,
package org.tizen.nativeplatform.build;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;
+import org.eclipse.ptp.remotetools.core.IRemoteItem;
+import org.eclipse.ptp.remotetools.exception.CancelException;
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
+import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.build.exception.SBIException;
import org.tizen.nativeplatform.build.IBuildCommandProvider.BUILDTOOL;
+import org.tizen.nativeplatform.command.launcher.CommandUtil;
+import org.tizen.nativeplatform.command.launcher.HostCommandLauncher;
import org.tizen.nativeplatform.password.SudoPasswdManager;
import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
+import org.tizen.nativeplatform.util.RootstrapUtil;
public class PlatformProjectDependentBuilder extends CommonProjectDependentBuilder {
// In case of platform project, execute gdb command through sbi action.
@Override
public Process debug(String[] arrOption) throws IOException {
- String targetID = getTargetID();
- String workingDir = getWorkingDir();
- String options = getDebugOption(arrOption);
- return getSbi().actionNB("debug", options, targetID, workingDir);
+ if (OSChecker.isWindows()) {
+ if (!RemoteConnectionManager.connected()) {
+ return null;
+ }
+ try {
+ String targetId = getTargetID();
+ String gdb = "/usr/bin/gdb";
+ String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+ String rootPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootId);
+ //String password = RemoteConnectionManager.getRemoteTools().getPass();
+ String passwd = SudoPasswdManager.getSudoPassword();
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
+ String workingDir = CommandUtil.getWorkingDir();
+ String sudoAskFile = new Path(workingDir).append("DEBUG_SH.sh").toString();
+ boolean exists = filetool.hasFile(sudoAskFile, new NullProgressMonitor());
+ if (!exists) {
+ filetool.createFile(sudoAskFile, new NullProgressMonitor());
+ OutputStream out = filetool.getOutputStream(sudoAskFile, IRemoteFileTools.NONE, new NullProgressMonitor());
+ String script = String.format("#!/bin/bash\necho \"%s\"\nEOF", passwd);
+ byte[] arr = script.getBytes();
+ out.write(arr);
+ out.close();
+ IRemoteItem item = filetool.getFile(sudoAskFile, new NullProgressMonitor());
+ item.setExecutable(true);
+ item.commitAttributes(new NullProgressMonitor());
+ }
+ //String options = getDebugOption(arrOption);
+ String options = getWindowDebugOption(arrOption);
+ String command = String.format("SUDO_ASKPASS=\"%s\" sudo -A -k chroot %s sh -c \"%s %s\"", sudoAskFile, rootPath, gdb, options);
+ Process process = HostCommandLauncher.execute(command, ".", null);
+ return process;
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ } catch (CancelException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ } else {
+ String targetID = getTargetID();
+ String workingDir = getWorkingDir();
+ String options = getDebugOption(arrOption);
+ return getSbi().actionNB("debug", options, targetID, workingDir);
+ }
+ return null;
+ }
+
+ private String getWindowDebugOption(String[] arrOption) {
+ String options = "";
+ for (int i = 0; i < arrOption.length - 1; i++) {
+ if (arrOption[i] == null) {
+ break;
+ } else if (arrOption[i].startsWith("--cd")) {
+ continue;
+ } else {
+ options = options.concat(arrOption[i] + " ");
+ }
+ }
+ String exePath = arrOption[arrOption.length-1];
+ exePath = SmartBuildInterface.getInstance().getMinGWPathFromWindowsPath(exePath, true);
+ options += exePath;
+ return options;
}
@Override
import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
import org.tizen.common.util.FileUtil;
import org.tizen.common.util.OSChecker;
+import org.tizen.common.util.log.UserInteraction;
+import org.tizen.common.util.log.UserLogger;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativeplatform.build.IBuildResultProcessor;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.filefilter.RpmFileFilter;
import org.tizen.nativeplatform.filefilter.XmlFileFilter;
import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
+import org.tizen.nativeplatform.remote.connection.RootstrapSyncronizer;
import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.PlatformUserInteraction;
import org.tizen.nativeplatform.util.RootstrapUtil;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
@Override
public boolean process(String[] buildArguments) {
+ boolean result = false;
+ UserLogger.start(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_OUTPUT);
if (OSChecker.isWindows()) {
- return remoteProcess(buildArguments);
+ result = remoteProcess(buildArguments);
} else {
- return localProcess(buildArguments);
+ result = localProcess(buildArguments);
}
+ UserLogger.end(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_OUTPUT);
+ return result;
}
private boolean localProcess(String[] buildArguments) {
rpmfiles.clear();
xmlfiles.clear();
IProject project = (IProject) config.getOwner();
- IPath projectPath = project.getLocation();
IPath configPath = project.getLocation().append(config.getName());
for (String rpm : rpms) {
try {
for (String xml : xmls) {
try {
String fileName = FileUtil.getFileNameFromPath(xml);
- String targetPath = projectPath.append(fileName).toOSString();
+ String targetPath = configPath.append(fileName).toOSString();
FileUtil.copyTo(xml, targetPath);
xmlfiles.add(targetPath);
} catch (IOException e) {
rpmfiles.clear();
xmlfiles.clear();
IProject project = (IProject) config.getOwner();
- IPath projectPath = project.getLocation();
IPath configPath = project.getLocation().append(config.getName());
IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
for (String rpm : rpms) {
e.printStackTrace();
}
}
- System.out.print(true);
List<String> xmls = getRemoteXmlFiles(rootstrap);
for (String xml : xmls) {
try {
String fileName = FileUtil.getFileNameFromPath(xml);
- String targetPath = projectPath.append(fileName).toOSString();
+ String targetPath = configPath.append(fileName).toOSString();
copytool.downloadFileToFile(xml, targetPath);
xmlfiles.add(targetPath);
} catch (RemoteConnectionException e) {
public static boolean execute(String command) throws InterruptedException {
return execute(command, null, null, null);
}
+
+ public static boolean asyncExecute(Process proc) throws InterruptedException {
+ // wait for process finish
+ proc.waitFor();
+ // abnormal termination
+ if (proc.exitValue() != 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
public static boolean execute(String command, String workingDir, String consoleViewName,
IProgressMonitor monitor) throws InterruptedException {
return execute(command, workingDir, null, consoleViewName, monitor);
}
+
+ public static synchronized boolean execute(Process proc, String consoleViewName, IProgressMonitor monitor)
+ throws InterruptedException {
+ // handle console
+ if (consoleViewName != null) {
+ ConsoleManager cm = new ConsoleManager(consoleViewName, true);
+ cm.clear();
+ BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ try {
+ while ((line = input.readLine()) != null) {
+ cm.println(line);
+ if (monitor != null && monitor.isCanceled()) {
+ cm.println("Canceled command");
+ throw new InterruptedException("Command execution is canceled!");
+ }
+ }
+ } catch (IOException e) {
+ cm.println(e.getMessage());
+ e.printStackTrace();
+ } finally {
+ if (input != null) {
+ tryClose(input);
+ }
+ }
+ }
+
+ // wait for process finish
+ proc.waitFor();
+
+ // wait for monitor thread finish
+ if (monitor != null) {
+ if (monitor.isCanceled()) {
+ throw new InterruptedException("Command execution is canceled!");
+ }
+ }
+
+ // abnormal termination
+ if (proc.exitValue() != 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public static Process execute(String command, String workingDir, Map<String, String> newEnv)
+ throws InterruptedException {
+ // start process
+ Process proc = CommandUtil.createProcess(command, workingDir, newEnv, false);
+ return proc;
+ }
public static synchronized boolean execute(String command, String workingDir,
Map<String, String> newEnv, String consoleViewName, IProgressMonitor monitor)
uri = new URIish(sshConn + GITPATH_DELIMITER2 + gitPath);
}
File workdir = new File(projectPath.toOSString());
- int timeout = 20;
+ int timeout = 1000;
boolean allSelected = true;
final CloneOperation op = new CloneOperation(uri, allSelected, null, workdir, null,
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.ptp.remotetools.core.IRemoteCopyTools;
+import org.eclipse.ptp.remotetools.core.IRemoteExecutionTools;
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;
+import org.eclipse.ptp.remotetools.exception.CancelException;
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;
+import org.eclipse.ptp.remotetools.exception.RemoteExecutionException;
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PartInitException;
import org.tizen.common.sdb.command.SdbCommand;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.LocalPortChecker;
+import org.tizen.common.util.OSChecker;
import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.StringUtil;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.nativeplatform.pkg.commander.factory.PkgFilterFactory;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
import org.tizen.nativeplatform.rootstrap.RootstrapManager;
import org.tizen.nativeplatform.types.CmdTargetTypes;
import org.tizen.nativeplatform.util.PackageUtil;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.util.RootstrapUtil;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.sdblib.Arch;
import org.tizen.sdblib.IDevice;
String appPath = config
.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
IPath hostPath = getHostPath(appPath, config);
+ boolean exists = false;
if (hostPath != null) {
- if (hostPath.toFile().exists()) {
- return;
+ if (OSChecker.isWindows()) {
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
+ try {
+ exists = filetool.hasFile(hostPath.toString(), new NullProgressMonitor());
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ } catch (CancelException e) {
+ e.printStackTrace();
+ }
} else {
- newCoreException(PlatformLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP,
- null);
+ exists = hostPath.toFile().exists();
}
- } else {
+ }
+ if (!exists) {
newCoreException(PlatformLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP,
null);
}
protected ICDISession getDebugSession(ILaunch launch, ILaunchConfiguration config,
IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException {
- TizenPlatformDebugger debugger = new TizenPlatformDebugger();
- return ((ICDIDebugger2) debugger).createSession(launch, getGDBClientArgument(exeFile),
- new SubProgressMonitor(monitor, 1));
+ TizenPlatformDebugger debugger = new TizenPlatformDebugger();
+ if (OSChecker.isWindows()) {
+ String appPath = config
+ .getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
+ String rootstrapId = target.getRootstrap().getId();
+ String rootstrapPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootstrapId);
+ //File exec = new Path(rootstrapPath).append(appPath).toFile();
+ File exec = new Path(appPath).toFile();
+ return ((ICDIDebugger2) debugger).createSession(launch, exec, new SubProgressMonitor(monitor, 1));
+ } else {
+ return ((ICDIDebugger2) debugger).createSession(launch, getGDBClientArgument(exeFile),
+ new SubProgressMonitor(monitor, 1));
+ }
+
}
+ /*
+ public static ILaunchConfiguration createForward(ILaunchConfiguration config, IDevice device) throws CoreException, NumberFormatException, TimeoutException, SdbCommandRejectedException, IOException {
+ int gdbPort = 0;
+ int gdbserverPort = 0;
+ ILaunchConfiguration newConfiguration = config;
+
+ gdbPort = Integer.parseInt(config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT));
+ if (!LocalPortChecker.isPortAvailable(gdbPort)) {
+ gdbPort = LaunchUtils.getDefaultDebugPort(device);
+ if (gdbPort < 0) {
+ LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_SET_DEBUG_LOCAL_PORT_TO_NEGATIVE, null);
+ }
+ String localPort = Integer.valueOf(gdbPort).toString();
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
+ newConfiguration = wc.doSave();
+ gdbPort = Integer.parseInt(localPort);
+ }
+
+ gdbserverPort = Integer.parseInt(config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT));
+ IRemoteExecutionTools exectool = RemoteConnectionManager.getRemoteTools().getExecTool();
+ try {
+
+ //exectool.executeBashCommand("/home/sdk/tizen-sdk/tools/sdb connect 172.21.111.40");
+ String cmd = String.format("/home/sdk/tizen-sdk/tools/sdb forward tcp:%d tcp:%d", gdbPort, gdbserverPort);
+ exectool.executeWithOutput("/home/sdk/tizen-sdk/tools/sdb connect 172.21.111.40");
+ String output = exectool.executeWithOutput(cmd);
+ System.out.print(output);
+ } catch (RemoteExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (RemoteConnectionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CancelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //device.createForward(gdbPort, gdbserverPort);
+
+ return newConfiguration;
+ }
+ */
protected void launchApplicationWithGDBClient(ILaunch launch, ILaunchConfiguration config,
IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException {
monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT);
LaunchUtils.createForward(config, currentDevice);
+ //createForward(config, currentDevice);
try {
debugSession = getDebugSession(launch, config, exeFile, monitor);
} catch (CoreException e) {
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
wc.doSave();
String appPath = config
.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
IPath hostPath = getHostPath(appPath, config);
+ if (OSChecker.isWindows()) {
+ IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
+ String rootstrapId = target.getRootstrap().getId();
+ String syncRootstrapPath = RootstrapUtil.getUserSyncRootstrapPath(rootstrapId);
+ File localBinaryPath = new Path(syncRootstrapPath).append(appPath).toFile();
+ try {
+ copytool.downloadFileToFile(hostPath.toString(), localBinaryPath);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (localBinaryPath.exists()) {
+ hostPath = new Path(localBinaryPath.getPath());
+ }
+ }
ICProject cproject = CDebugUtils.verifyCProject(config);
IBinaryObject binaryObject = verifyBinary(cproject, hostPath);
return binaryObject;
protected IPath getHostPath(String exePath, ILaunchConfiguration config) throws CoreException {
IPath path = target.getRootstrap().getPath();
+ String id = target.getRootstrap().getId();
if (target.getRootstrapCommander() == null) {
return new Path(exePath);
}
String canonicalPath = target.getRootstrapCommander().canonicalizePath(exePath);
- String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
- if (rootstrapPath != null && !rootstrapPath.isEmpty()) {
- if (canonicalPath != null && !canonicalPath.isEmpty()) {
- rootstrapPath = rootstrapPath.concat(canonicalPath);
- } else {
- rootstrapPath = rootstrapPath.concat(exePath);
+ String rootstrapPath = "";
+ if (OSChecker.isWindows()) {
+ rootstrapPath = RootstrapUtil.getRemoteRootstrapScratchPath(id);
+ if (rootstrapPath != null && !rootstrapPath.isEmpty()) {
+ if (canonicalPath != null && !canonicalPath.isEmpty()) {
+ rootstrapPath = rootstrapPath.concat(canonicalPath);
+ } else {
+ rootstrapPath = rootstrapPath.concat(exePath);
+ }
+ }
+ } else {
+ rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
+ if (rootstrapPath != null && !rootstrapPath.isEmpty()) {
+ if (canonicalPath != null && !canonicalPath.isEmpty()) {
+ rootstrapPath = rootstrapPath.concat(canonicalPath);
+ } else {
+ rootstrapPath = rootstrapPath.concat(exePath);
+ }
}
}
return new Path(rootstrapPath);
import org.eclipse.ui.IEditorPart;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.OSChecker;
import org.tizen.common.util.SWTUtil;
import org.tizen.nativecommon.build.CommonBuildMessages;
import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativeplatform.util.PackageUtil;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.util.RootstrapUtil;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.util.ArrayUtil;
ILaunchConfigurationWorkingCopy configuration) {
PlatformRootstrap rootstrap = target.getRootstrap();
String basePath = rootstrap.getPath().toOSString();
- String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
+ String rootstrapPath = "";
+ if (OSChecker.isWindows()) {
+ rootstrapPath = basePath;
+ } else {
+ rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
+ }
MappingSourceContainer prjMappingContainer = new MappingSourceContainer(
PROJECT_SOURCE_CONTAINER);
MapEntrySourceContainer entry = new MapEntrySourceContainer();
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.tizen.common.TizenProjectType;
import org.tizen.common.util.IOUtil;
import org.tizen.nativeplatform.IPlatformXMLStore;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.filefilter.XmlFileFilter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
.getLogger(PlatformManifestXMLStore.class);
@Override
- public void setProject(IProject project) {
- setProject(project.getLocation().toFile().getAbsolutePath());
- }
-
- @Override
public boolean loadXml() {
if (!new File(projectPath).exists()) {
}
@Override
- public void setProject(String projectPath) {
- this.projectPath = projectPath;
- File dir = new File(projectPath);
-
+ public void setProject(IProject project) {
+ this.projectPath = project.getLocation().toString();
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ File dir = project.getFile(defaultConfig.getName()).getLocation().toFile();
// get ".xml" file list
String[] files = dir.list(new XmlFileFilter());
// return false if ".xml" file does not exist
if (files.length != 0) {
for (String file : files) {
- IPath filePath = new Path(projectPath).append(file);
+ IPath filePath = project.getLocation().append(defaultConfig.getName()).append(file);
+ //IPath filePath = new Path(projectPath).append(file);
manifestFiles.add(filePath.toFile());
}
}
package org.tizen.nativeplatform.remote.connection;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.ptp.remote.core.IRemoteConnection;
import org.eclipse.ptp.remote.core.IRemoteConnectionManager;
import org.eclipse.ptp.remote.remotetools.core.RemoteToolsConnection;
import org.eclipse.ptp.remote.remotetools.core.RemoteToolsServices;
import org.eclipse.ptp.remotetools.core.IRemoteExecutionManager;
+import org.tizen.common.util.FileUtil;
+import org.tizen.nativeplatform.util.RootstrapUtil;
@SuppressWarnings("restriction")
public class RemoteConnectionManager {
public static String DEFAULT_CONNECTION_NAME = "remote_connection";
private static Map<String, RemoteTools> connectionMap = new HashMap<String, RemoteTools>();
- public static boolean createConnection(String host, String user, String pass,
- IProgressMonitor monitor) {
- return createConnection(host, user, pass, DEFAULT_CONNECTION_NAME, monitor);
+ public static boolean createConnection(String host, String user, String pass, String publicKey,
+ String privateKey, IProgressMonitor monitor) {
+ return createConnection(host, user, pass, publicKey, privateKey, DEFAULT_CONNECTION_NAME, monitor);
}
- public static boolean createConnection(String host, String user, String pass,
- String connectionName, IProgressMonitor monitor) {
+ public static boolean createConnection(String host, String user, String pass, String publicKey,
+ String privateKey, String connectionName, IProgressMonitor monitor) {
try {
IRemoteConnection conn = getConnection(connectionName);
if (conn == null) {
String userhome = conn.getWorkingDirectory();
RemoteToolsConnection toolsConn = (RemoteToolsConnection) conn;
IRemoteExecutionManager execMgr = toolsConn.createExecutionManager();
- RemoteTools remoteTools = new RemoteTools(host, user, pass, userhome, execMgr);
+ RemoteTools remoteTools = new RemoteTools(host, user, pass, execMgr);
+ remoteTools.setUserhome(userhome);
+ remoteTools.setPrivateKey(privateKey);
+ remoteTools.setPublicKey(publicKey);
monitor.worked(1);
connectionMap.put(connectionName, remoteTools);
} else {
String userhome = conn.getWorkingDirectory();
RemoteToolsConnection toolsConn = (RemoteToolsConnection) conn;
IRemoteExecutionManager execMgr = toolsConn.createExecutionManager();
- remoteTools = new RemoteTools(host, user, pass, userhome, execMgr);
+ remoteTools = new RemoteTools(host, user, pass, execMgr);
+ remoteTools.setUserhome(userhome);
+ remoteTools.setPrivateKey(privateKey);
+ remoteTools.setPublicKey(publicKey);
connectionMap.put(connectionName, remoteTools);
}
}
private String user = "";
private String pass = "";
private String userhome = "";
+ private String publicKey = "";
+ private String privateKey = "";
private IRemoteExecutionManager execMgr = null;
- public RemoteTools(String host, String user, String pass, String userhome, IRemoteExecutionManager execMgr) {
+ public RemoteTools(String host, String user, String pass, IRemoteExecutionManager execMgr) {
this.host = host;
this.user = user;
this.pass = pass;
- this.userhome = userhome;
this.execMgr = execMgr;
}
return pass;
}
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ public void setPublicKey(String publicKey) {
+ this.publicKey = publicKey;
+ }
+
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ public void setPrivateKey(String privateKey) {
+ this.privateKey = privateKey;
+ }
+
public void setPass(String pass) {
this.pass = pass;
}
--- /dev/null
+package org.tizen.nativeplatform.remote.connection;\r
+\r
+import java.io.File;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.NullProgressMonitor;\r
+import org.eclipse.core.runtime.Path;\r
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;\r
+import org.eclipse.ptp.remotetools.core.IRemoteItem;\r
+import org.eclipse.ptp.remotetools.exception.CancelException;\r
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;\r
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;\r
+import org.tizen.common.util.FileUtil;\r
+import org.tizen.common.util.log.UserLogger;\r
+import org.tizen.nativeplatform.util.PlatformUserInteraction;\r
+import org.tizen.nativeplatform.util.RootstrapUtil;\r
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;\r
+\r
+public class RootstrapSyncronizer {\r
+ \r
+ private static long includeDirModificationTime = 0;\r
+ private static long debugsrcDirModificationTime = 0;\r
+ \r
+ public static void cacheModificationTime(PlatformRootstrap rootstrap) {\r
+ String remoteIncludePath = getRemoteIncludePath(rootstrap);\r
+ String remoteDebugsrcPath = getRemoteDebugsrcPath(rootstrap);\r
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();\r
+ try {\r
+ boolean exists = filetool.hasDirectory(remoteIncludePath, new NullProgressMonitor());\r
+ if (exists) {\r
+ IRemoteItem item = filetool.getDirectory(remoteIncludePath, new NullProgressMonitor());\r
+ includeDirModificationTime = item.getModificationTime();\r
+ }\r
+ exists = filetool.hasDirectory(remoteDebugsrcPath, new NullProgressMonitor());\r
+ if (exists) {\r
+ IRemoteItem item = filetool.getDirectory(remoteDebugsrcPath, new NullProgressMonitor());\r
+ debugsrcDirModificationTime = item.getModificationTime();\r
+ }\r
+ } catch (RemoteOperationException e) {\r
+ e.printStackTrace();\r
+ } catch (RemoteConnectionException e) {\r
+ e.printStackTrace();\r
+ } catch (CancelException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ \r
+ public static void syncronizeIfChanges(PlatformRootstrap rootstrap, IProgressMonitor monitor) {\r
+ String remoteIncludePath = getRemoteIncludePath(rootstrap);\r
+ String remoteDebugsrcPath = getRemoteDebugsrcPath(rootstrap);\r
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();\r
+ boolean syncInclude = false;\r
+ boolean syncDebugsrc = false;\r
+ try {\r
+ boolean exists = filetool.hasDirectory(remoteIncludePath, new NullProgressMonitor());\r
+ if (exists) {\r
+ IRemoteItem item = filetool.getDirectory(remoteIncludePath, new NullProgressMonitor());\r
+ long currentModificationTime = item.getModificationTime();\r
+ if (includeDirModificationTime != currentModificationTime) {\r
+ syncInclude = true;\r
+ }\r
+ }\r
+ exists = filetool.hasDirectory(remoteDebugsrcPath, new NullProgressMonitor());\r
+ if (exists) {\r
+ IRemoteItem item = filetool.getDirectory(remoteDebugsrcPath, new NullProgressMonitor());\r
+ long currentModificationTime = item.getModificationTime();\r
+ if (debugsrcDirModificationTime != currentModificationTime) {\r
+ syncDebugsrc = true;\r
+ }\r
+ }\r
+ } catch (RemoteOperationException e) {\r
+ e.printStackTrace();\r
+ } catch (RemoteConnectionException e) {\r
+ e.printStackTrace();\r
+ } catch (CancelException e) {\r
+ e.printStackTrace();\r
+ }\r
+ syncronize(rootstrap, syncInclude, syncDebugsrc, monitor);\r
+ }\r
+ \r
+ public static void syncronize(PlatformRootstrap rootstrap, \r
+ boolean syncIncludes, boolean syncDebugsrc, IProgressMonitor monitor) {\r
+ List<PlatformRootstrap> list = new ArrayList<PlatformRootstrap>();\r
+ list.add(rootstrap);\r
+ syncronized(list, syncIncludes, syncDebugsrc, monitor);\r
+ }\r
+ \r
+ public static void syncronize(PlatformRootstrap rootstrap, IProgressMonitor monitor) {\r
+ List<PlatformRootstrap> list = new ArrayList<PlatformRootstrap>();\r
+ list.add(rootstrap);\r
+ syncronized(list, true, true, monitor);\r
+ }\r
+\r
+ public static void syncronize(List<PlatformRootstrap> list, IProgressMonitor monitor) {\r
+ syncronized(list, true, true, monitor);\r
+ }\r
+ \r
+ private static void syncronized(List<PlatformRootstrap> list, \r
+ boolean syncIncludes, boolean syncDebugsrc, IProgressMonitor monitor) {\r
+ if (!(syncIncludes || syncDebugsrc)) {\r
+ monitor.done();\r
+ return;\r
+ }\r
+ final String host = RemoteConnectionManager.getRemoteTools().getHost();\r
+ final String user = RemoteConnectionManager.getRemoteTools().getUser();\r
+ final String sshKeyPath = RemoteConnectionManager.getRemoteTools().getPrivateKey();\r
+ monitor.beginTask("Syncronize includes...", list.size() * 2);\r
+ for (PlatformRootstrap rootstrap : list) {\r
+ final String remoteIncludePath = getRemoteIncludePath(rootstrap);\r
+ final String remoteDebugsrcPath = getRemoteDebugsrcPath(rootstrap); \r
+ String localRootstrapPath = RootstrapUtil.getUserSyncRootstrapPath(rootstrap.getId());\r
+ final File file = new Path(localRootstrapPath).append("usr").toFile();\r
+ if (!file.exists()) {\r
+ FileUtil.createDirectory(file);\r
+ }\r
+ RsyncProcessor processor = new RsyncProcessor(host, user, sshKeyPath);\r
+ try {\r
+ UserLogger.start(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_INCLUDES);\r
+ if (syncIncludes) {\r
+ monitor.subTask(String.format("Syncronize includes... [%s]", rootstrap.getId()));\r
+ processor.downloadSync(remoteIncludePath, file.toString(), monitor);\r
+ }\r
+ monitor.worked(1);\r
+ if (syncDebugsrc) {\r
+ monitor.subTask(String.format("Syncronize debug source... [%s]", rootstrap.getId()));\r
+ processor.downloadSync(remoteDebugsrcPath, file.toString(), monitor);\r
+ }\r
+ monitor.worked(1);\r
+ UserLogger.end(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_INCLUDES);\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ } finally {\r
+ monitor.done();\r
+ }\r
+ }\r
+ }\r
+\r
+ private static String getRemoteIncludePath(PlatformRootstrap rootstrap) {\r
+ String scratchPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootstrap.getId());\r
+ String remotePath = new Path(scratchPath).append("usr").append("include").toString();\r
+ return remotePath;\r
+ }\r
+ \r
+ private static String getRemoteDebugsrcPath(PlatformRootstrap rootstrap) {\r
+ String scratchPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootstrap.getId());\r
+ String remotePath = new Path(scratchPath).append("usr").append("src").append("debug").toString();\r
+ return remotePath;\r
+ } \r
+}\r
--- /dev/null
+package org.tizen.nativeplatform.remote.connection;\r
+\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.Path;\r
+import org.tizen.nativecommon.build.SmartBuildInterface;\r
+import org.tizen.nativecommon.build.exception.SBIException;\r
+import org.tizen.nativeplatform.command.launcher.HostCommandLauncher;\r
+import org.tizen.nativeplatform.command.launcher.LocalCommandUtil;\r
+\r
+public class RsyncProcessor {\r
+ String host = "";\r
+ String user = "";\r
+ String sshKeyPath = "";\r
+\r
+ public RsyncProcessor(String host, String user, String sshKeyPath) {\r
+ this.host = host;\r
+ this.user = user;\r
+ this.sshKeyPath = sshKeyPath;\r
+ }\r
+ \r
+ public boolean downloadSync(String remotePath, String localPath, IProgressMonitor monitor) throws InterruptedException {\r
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();\r
+ String[] envs = sbi.getEnvironmentVariables();\r
+ Map<String, String> envMap = new HashMap<String, String>();\r
+ for(String env : envs) {\r
+ int index = env.indexOf("=");\r
+ if (index > 0) {\r
+ String key = env.substring(0, index);\r
+ String value = env.substring(index+1);\r
+ envMap.put(key, value);\r
+ }\r
+ }\r
+ String msysBinPath = sbi.getMsysBinPath();\r
+ StringBuffer cmd = new StringBuffer();\r
+ cmd.append(new Path(msysBinPath).append("sh.exe").toOSString());\r
+ cmd.append(" -c \"");\r
+ cmd.append("rsync -avz --delete -e");\r
+ cmd.append("'ssh -i ");\r
+ cmd.append(sshKeyPath);\r
+ cmd.append(" -o StrictHostKeyChecking=no");\r
+ cmd.append("' ");\r
+ cmd.append(user);\r
+ cmd.append("@");\r
+ cmd.append(host);\r
+ cmd.append(":");\r
+ cmd.append(remotePath);\r
+ cmd.append(" .\"");\r
+ Process proc = LocalCommandUtil.createProcess(cmd.toString(), localPath, envMap, true);\r
+ boolean result = HostCommandLauncher.execute(proc, "rsync internal", monitor);\r
+ return result;\r
+ }\r
+ \r
+ public boolean uploadSync(String localPath, String remotePath, String[] excludes, IProgressMonitor monitor) \r
+ throws InterruptedException {\r
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();\r
+ String[] envs = sbi.getEnvironmentVariables();\r
+ Map<String, String> envMap = new HashMap<String, String>();\r
+ for(String env : envs) {\r
+ int index = env.indexOf("=");\r
+ if (index > 0) {\r
+ String key = env.substring(0, index);\r
+ String value = env.substring(index+1);\r
+ envMap.put(key, value);\r
+ }\r
+ }\r
+ String excludeCmd = "";\r
+ for (String exclude : excludes) {\r
+ excludeCmd += String.format("--exclude=%s ", exclude);\r
+ }\r
+ \r
+ String msysBinPath = sbi.getMsysBinPath();\r
+ String sourceMingwPath = sbi.getMinGWPathFromWindowsPath(localPath, false);\r
+ StringBuffer cmd = new StringBuffer();\r
+ cmd.append(new Path(msysBinPath).append("sh.exe").toOSString());\r
+ cmd.append(" -c \"");\r
+ cmd.append("rsync -avz --delete -e ");\r
+ cmd.append("'ssh -i ");\r
+ cmd.append(sshKeyPath);\r
+ cmd.append(" -o StrictHostKeyChecking=no");\r
+ cmd.append("' ");\r
+ if (!excludeCmd.isEmpty()) {\r
+ cmd.append(excludeCmd);\r
+ }\r
+ cmd.append(sourceMingwPath);\r
+ cmd.append(" ");\r
+ cmd.append(user);\r
+ cmd.append("@");\r
+ cmd.append(host);\r
+ cmd.append(":");\r
+ cmd.append(remotePath);\r
+ cmd.append("\"");\r
+ Process proc = LocalCommandUtil.createProcess(cmd.toString(), localPath, envMap, true);\r
+ return HostCommandLauncher.execute(proc, "rsync internal", monitor);\r
+ }\r
+\r
+}\r
+
\ No newline at end of file
+++ /dev/null
-package org.tizen.nativeplatform.remote.connection;\r
-\r
-import java.io.File;\r
-\r
-import org.eclipse.core.filesystem.EFS;\r
-import org.eclipse.core.filesystem.IFileInfo;\r
-import org.eclipse.core.filesystem.IFileStore;\r
-import org.eclipse.core.filesystem.IFileSystem;\r
-import org.eclipse.core.resources.IProject;\r
-import org.eclipse.core.runtime.Assert;\r
-import org.eclipse.core.runtime.CoreException;\r
-import org.eclipse.core.runtime.IPath;\r
-import org.eclipse.core.runtime.Path;\r
-import org.eclipse.ptp.remotetools.core.IRemoteCopyTools;\r
-import org.eclipse.ptp.remotetools.core.IRemoteFileTools;\r
-import org.eclipse.ptp.remotetools.core.IRemoteItem;\r
-import org.eclipse.ptp.remotetools.environment.launcher.core.LinuxPath;\r
-import org.eclipse.ptp.remotetools.exception.CancelException;\r
-import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;\r
-import org.eclipse.ptp.remotetools.exception.RemoteOperationException;\r
-import org.eclipse.ptp.utils.file.core.FileRecursiveEnumeration;\r
-import org.tizen.nativeplatform.util.RootstrapUtil;\r
-\r
-public class SourceUploader {\r
- \r
- private IProject project;\r
- \r
- private static final String UPLOAD_TARGET_PATH = RootstrapUtil.getRemoteSourcePath();\r
- \r
- public SourceUploader(IProject project) {\r
- this.project = project;\r
- }\r
- \r
- public String upload() {\r
- File sourcepath = project.getLocation().toFile();\r
- IPath targetpath = new Path(UPLOAD_TARGET_PATH).append(project.getName());\r
- try {\r
- uploadDirectory(sourcepath, targetpath);\r
- } catch (Exception e) {\r
- return null;\r
- }\r
- return targetpath.toString(); \r
- }\r
-\r
- private void doFileUpload(File localFile, IPath remotePath) throws CoreException, CancelException, RemoteConnectionException { \r
- if (! localFile.exists()) { \r
- return;\r
- }\r
-\r
- Assert.isTrue(localFile.isAbsolute(), "localFile.isAbsolute()"); //$NON-NLS-1$\r
- Assert.isTrue(localFile.isFile(), "localFile.isFile()"); //$NON-NLS-1$\r
- Assert.isTrue(remotePath.isAbsolute(), "remotePath.isAbsolute()"); //$NON-NLS-1$\r
- \r
- String remotePathAsString = LinuxPath.toString(remotePath);\r
-\r
- IRemoteCopyTools copyTools = RemoteConnectionManager.getRemoteTools().getCopyTool();\r
- IRemoteFileTools fileTools = RemoteConnectionManager.getRemoteTools().getFileTool();\r
-\r
- /*\r
- if (rule.getOverwritePolicy() == OverwritePolicies.SKIP) {\r
- if (remoteFile.exists()) {\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_10, remotePath));\r
- return;\r
- }\r
- } else if (rule.getOverwritePolicy() == OverwritePolicies.NEWER) {\r
- long difference = localFile.lastModified() - remoteFile.getModificationTime();\r
- if (difference < 1000) {\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_11, remotePath));\r
- return; \r
- }\r
- }\r
- */\r
- \r
- /*\r
- * Upload the file.\r
- */\r
- try {\r
- copyTools.uploadFileToFile(localFile, remotePathAsString);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_12, e.getMessage()));\r
- return;\r
- }\r
- \r
- /*\r
- * Add file to list of files to download back, if this feature was enabled.\r
- */\r
- /*\r
- if (rule.isDownloadBack()) {\r
- if (downloadBackRule == null) {\r
- downloadBackRule = new DownloadBackRule();\r
- }\r
- downloadBackRule.add(localFile, remotePath);\r
- }\r
- */\r
-\r
- /*\r
- * Fetch properties of file that was just uploaded.\r
- */\r
- IRemoteItem remoteFile = null;\r
- try {\r
- remoteFile = fileTools.getFile(remotePathAsString, null);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_13, e.getMessage()));\r
- return;\r
- }\r
- \r
- /*\r
- * Set file permissions. We need help of EFS, since the File class from\r
- * Java does not providel all information.\r
- */\r
- IFileSystem localFileSystem = EFS.getLocalFileSystem();\r
- IFileStore fileStore = localFileSystem.getStore(new Path(localFile.getPath()));\r
- IFileInfo fileInfo = fileStore.fetchInfo();\r
-\r
- boolean read = localFile.canRead();\r
- boolean write = localFile.canWrite();\r
- boolean execute = fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE);\r
- \r
- /*\r
- if (rule.isAsReadOnly()) {\r
- write = false;\r
- }\r
- if (rule.isAsExecutable()) {\r
- execute = true;\r
- }\r
- */\r
- \r
- remoteFile.setExecutable(execute);\r
- remoteFile.setWriteable(write);\r
- remoteFile.setReadable(read);\r
- \r
- /*\r
- * Set date/time, if required\r
- */ \r
- //if (rule.isPreserveTimeStamp()) {\r
- long timestamp = localFile.lastModified();\r
- remoteFile.setModificationTime(timestamp);\r
- //}\r
- \r
-\r
- /*\r
- * Commit changes\r
- */\r
- try {\r
- remoteFile.commitAttributes(null);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_14, e.getMessage()));\r
- return;\r
- }\r
- }\r
- \r
- private void doDirectoryUpload(File localDir, IPath remotePath) throws RemoteConnectionException, CancelException {\r
- if (! localDir.exists()) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_15, localDir.toString()));\r
- return;\r
- }\r
-\r
- Assert.isTrue(localDir.isDirectory(), "localFile.isDirectory()"); //$NON-NLS-1$\r
- Assert.isTrue(localDir.isAbsolute(), "localFile.isAbsolute()"); //$NON-NLS-1$\r
- Assert.isTrue(remotePath.isAbsolute(), "remotePath.isAbsolute()"); //$NON-NLS-1$\r
-\r
- IRemoteFileTools fileTools = RemoteConnectionManager.getRemoteTools().getFileTool();\r
- \r
- /*\r
- * Create remote directory if not already exists.\r
- */\r
- try {\r
- fileTools.assureDirectory(LinuxPath.toString(remotePath), null);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_16, e.getMessage()));\r
- return;\r
- }\r
- \r
- /*\r
- * Fetch properties of directory that was just uploaded.\r
- */\r
- IRemoteItem remoteDirectory = null;\r
- try {\r
- remoteDirectory = fileTools.getDirectory(LinuxPath.toString(remotePath), null);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_17, e.getMessage()));\r
- return;\r
- }\r
- \r
- /*\r
- * Set file permissions.\r
- */\r
- boolean read = localDir.canRead();\r
- boolean write = localDir.canWrite();\r
- boolean execute = true;\r
- \r
- /*\r
- if (rule.isAsReadOnly()) {\r
- write = false;\r
- }\r
- */\r
- \r
- remoteDirectory.setExecutable(execute);\r
- remoteDirectory.setWriteable(write);\r
- remoteDirectory.setReadable(read);\r
- \r
- /*\r
- * Set date/time, if required\r
- */\r
- //if (rule.isPreserveTimeStamp()) {\r
- long timestamp = localDir.lastModified();\r
- remoteDirectory.setModificationTime(timestamp);\r
- //}\r
-\r
- /*\r
- * Commit changes\r
- */\r
- try {\r
- remoteDirectory.commitAttributes(null);\r
- } catch (RemoteOperationException e) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_18, e.getMessage()));\r
- return;\r
- } \r
- }\r
-\r
- public void uploadDirectory(File localDir, IPath remotePath) throws CoreException, CancelException, RemoteConnectionException {\r
- Assert.isTrue(localDir.isAbsolute(), "localDir.isAbsolute()"); //$NON-NLS-1$\r
- Assert.isTrue(remotePath.isAbsolute(), "remotePath.isAbsolute()"); //$NON-NLS-1$\r
-\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_19, localDir.toString()));\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_20, LinuxPath.toString(remotePath)));\r
-\r
- FileRecursiveEnumeration enumeration = null;\r
- enumeration = new FileRecursiveEnumeration(localDir);\r
- \r
- IPath rootPath = new Path(localDir.getAbsolutePath());\r
- int rootPathLength = rootPath.segmentCount();\r
- while (enumeration.hasMoreElements()) {\r
- while (enumeration.hasMoreExceptions()) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_21, enumeration.nextException())); \r
- }\r
- File file = (File) enumeration.nextElement();\r
- IPath filePath = new Path(file.getAbsolutePath());\r
- IPath relativePath = filePath.removeFirstSegments(rootPathLength);\r
- IPath remoteFilePath = remotePath.append(relativePath);\r
- if (file.isDirectory()) {\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_22, LinuxPath.toString(remoteFilePath)));\r
- doDirectoryUpload(file, remoteFilePath);\r
- } else {\r
- //outputWriter.println(NLS.bind(Messages.UploadRuleAction_23, LinuxPath.toString(relativePath)));\r
- doFileUpload(file, remoteFilePath);\r
- }\r
- }\r
- while (enumeration.hasMoreExceptions()) {\r
- //errorWriter.println(NLS.bind(Messages.UploadRuleAction_24, enumeration.nextException())); \r
- }\r
- }\r
-}\r
--- /dev/null
+package org.tizen.nativeplatform.remote.connection;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.eclipse.core.resources.IProject;\r
+\r
+public class WorkspaceDeltaManager {\r
+ private static Map<IProject, WorkspaceResourceDelta> deltaMap = new HashMap<IProject, WorkspaceResourceDelta>();\r
+ \r
+ public static void putDelta(IProject project, WorkspaceResourceDelta delta) {\r
+ deltaMap.put(project, delta);\r
+ }\r
+ \r
+ public static WorkspaceResourceDelta getDelta(IProject project) {\r
+ return deltaMap.get(project);\r
+ }\r
+}\r
--- /dev/null
+package org.tizen.nativeplatform.remote.connection;\r
+\r
+import org.eclipse.core.internal.events.ResourceDeltaFactory;\r
+import org.eclipse.core.internal.resources.Workspace;\r
+import org.eclipse.core.internal.watson.ElementTree;\r
+import org.eclipse.core.resources.IProject;\r
+import org.eclipse.core.resources.IResourceDelta;\r
+import org.eclipse.core.runtime.IPath;\r
+\r
+@SuppressWarnings("restriction")\r
+public class WorkspaceResourceDelta {\r
+ private ElementTree oldTree = null;\r
+ private ElementTree newTree = null;\r
+ private IProject project;\r
+\r
+ public WorkspaceResourceDelta(IProject project) {\r
+ this.project = project;\r
+ }\r
+\r
+ public IResourceDelta computeDelta() {\r
+ IPath subTreePath = project.getFullPath();\r
+ newTree = ((Workspace) project.getWorkspace()).getElementTree().getSubtree(subTreePath);\r
+ if (oldTree == null) {\r
+ oldTree = newTree;\r
+ } else {\r
+ IResourceDelta result = ResourceDeltaFactory\r
+ .computeDelta((Workspace) project.getWorkspace(), oldTree, newTree,\r
+ project.getFullPath(), -1);\r
+ oldTree = newTree;\r
+ return result;\r
+ }\r
+ return null;\r
+ }\r
+}\r
--- /dev/null
+package org.tizen.nativeplatform.remote.connection;\r
+\r
+import org.eclipse.core.resources.IProject;\r
+import org.eclipse.core.runtime.IPath;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.NullProgressMonitor;\r
+import org.eclipse.core.runtime.Path;\r
+import org.eclipse.ptp.remotetools.core.IRemoteExecutionTools;\r
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;\r
+import org.eclipse.ptp.remotetools.core.IRemoteItem;\r
+import org.eclipse.ptp.remotetools.core.IRemoteScript;\r
+import org.eclipse.ptp.remotetools.exception.CancelException;\r
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;\r
+import org.eclipse.ptp.remotetools.exception.RemoteExecutionException;\r
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;\r
+import org.tizen.common.util.log.UserLogger;\r
+import org.tizen.nativeplatform.util.PlatformUserInteraction;\r
+import org.tizen.nativeplatform.util.RootstrapUtil;\r
+\r
+public class WorkspaceSyncronizer {\r
+ \r
+ public static String[] EXCLUDES = {".git/", "Debug/", "Release/", ".cproject", ".project", ".tproject"};\r
+ \r
+ public static boolean syncronize(IProject project, IProgressMonitor monitor) {\r
+ final String host = RemoteConnectionManager.getRemoteTools().getHost();\r
+ final String user = RemoteConnectionManager.getRemoteTools().getUser();\r
+ final String sshKeyPath = RemoteConnectionManager.getRemoteTools().getPrivateKey();\r
+ String sourcePath = project.getLocation().toOSString();\r
+ String targetPath = RootstrapUtil.getUserSyncWorkspacePath(project.getName());\r
+ String workspacePath = new Path(targetPath).removeLastSegments(1).toString();\r
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();\r
+ \r
+ try {\r
+ filetool.assureDirectory(workspacePath, new NullProgressMonitor());\r
+ UserLogger.start(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_WORKSPACE);\r
+ RsyncProcessor processor = new RsyncProcessor(host, user, sshKeyPath);\r
+ UserLogger.end(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_WORKSPACE);\r
+ boolean result = processor.uploadSync(sourcePath, workspacePath, EXCLUDES, monitor);\r
+ if (result) {\r
+ gitInit(workspacePath, project);\r
+ }\r
+ return result;\r
+ } catch (RemoteOperationException e) {\r
+ e.printStackTrace();\r
+ } catch (RemoteConnectionException e) {\r
+ e.printStackTrace();\r
+ } catch (CancelException e) {\r
+ e.printStackTrace();\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ }\r
+ return false;\r
+ }\r
+ \r
+ private static void gitInit(String workspacePath, IProject project) { \r
+ IPath projectPath = new Path(workspacePath).append(project.getName());\r
+ String gitPath = projectPath.append(".git").toString();\r
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();\r
+ try {\r
+ boolean exists = filetool.hasDirectory(gitPath, new NullProgressMonitor());\r
+ if (!exists) {\r
+ IRemoteExecutionTools execTool = RemoteConnectionManager.getRemoteTools().getExecTool();\r
+ String cmds[] = {"cd " + projectPath, "git init"};\r
+ IRemoteScript script = execTool.createScript();\r
+ script.setScript(cmds);\r
+ execTool.executeScript(script);\r
+ }\r
+ } catch (RemoteExecutionException e) {\r
+ e.printStackTrace();\r
+ } catch (RemoteOperationException e) {\r
+ e.printStackTrace();\r
+ } catch (RemoteConnectionException e) {\r
+ e.printStackTrace();\r
+ } catch (CancelException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+}\r
package org.tizen.nativeplatform.rootstrap;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
e.printStackTrace();
return false;
}
+ String path = RootstrapUtil.getUserSyncRootstrapPath(id);
+ File syncDir = new File(path);
+ FileUtil.recursiveDelete(syncDir);
rootstraps.remove(rootstrap);
if (userRootstraps.contains(rootstrap)) {
userRootstraps.remove(rootstrap);
package org.tizen.nativeplatform.rootstrap;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.tizen.common.util.OSChecker;
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativecommon.build.model.Rootstrap;
-import org.tizen.nativecommon.build.model.SBIModel;
-import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.command.launcher.CommandUtil;
-import org.tizen.nativeplatform.command.launcher.HostCommandLauncher;
-import org.tizen.nativeplatform.repo.commander.RepoManager;
+import org.tizen.common.util.log.UserInteraction;
+import org.tizen.common.util.log.UserLogger;
import org.tizen.nativeplatform.repo.model.Repository;
-import org.tizen.nativeplatform.util.RootstrapUtil;
+import org.tizen.nativeplatform.util.PlatformUserInteraction;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
public class RootstrapManager {
public static PlatformRootstrap generate(String name, String arch, String version,
List<Repository> reposURLs, boolean immediateGen, IPath confFile,
IProgressMonitor monitor) throws InterruptedException {
+ PlatformRootstrap rootstrap = null;
+ UserLogger.start(PlatformUserInteraction.GEN_ROOTSTRAP);
if (OSChecker.isWindows()) {
- return RemoteRootstrapManager.generate(name, arch, version, reposURLs, immediateGen,
+ rootstrap = RemoteRootstrapManager.generate(name, arch, version, reposURLs, immediateGen,
confFile, monitor);
} else {
- return LocalRootstrapManager.generate(name, arch, version, reposURLs, immediateGen,
+ rootstrap = LocalRootstrapManager.generate(name, arch, version, reposURLs, immediateGen,
confFile, monitor);
}
+ UserLogger.end(PlatformUserInteraction.GEN_ROOTSTRAP);
+ return rootstrap;
}
}
}
private static void remoteRemove(String id) {
- remove(id);
+ localRemove(id);
String path = RootstrapUtil.getRemotePluginXML(id);
try {
IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.ptp.remotetools.core.IRemoteCopyTools;
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;
+import org.eclipse.ptp.remotetools.exception.CancelException;
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.tizen.common.connection.ui.TizenRemoteFileDialog;
import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.FileUtil;
+import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.TizenNativeException;
import org.tizen.nativecommon.launch.LaunchUtils;
import org.tizen.nativecommon.launch.TizenLaunchCommand;
import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
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.types.CmdTargetTypes;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.exception.SdbCommandRejectedException;
import org.tizen.sdblib.exception.TimeoutException;
public static void readyGdbServer(PkgCommandTarget cmdTarget, IDevice device,
TizenLaunchCommand command, IPath srcPath) throws CoreException, TimeoutException,
SdbCommandRejectedException, IOException, Exception {
- File gdbserver = new File(srcPath.toOSString());
-
- if (!gdbserver.exists()) {
- IPkgCommander commander = cmdTarget.getCommander(CmdTargetTypes.ROOTSTRAP);
- commander.installRemotePkg("gdb-server", null);
- }
+ String gdbserverPath = srcPath.toString();
+ File gdbserver = new File(gdbserverPath);
+ if (OSChecker.isWindows()) {
+
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
+ boolean exists = filetool.hasFile(gdbserverPath, new NullProgressMonitor());
+ if (!exists) {
+ IPkgCommander commander = cmdTarget.getCommander(CmdTargetTypes.ROOTSTRAP);
+ commander.installRemotePkg("gdb-server", null);
+ }
+ exists = filetool.hasFile(gdbserverPath, new NullProgressMonitor());
+ if (!exists) {
+ LaunchUtils.newCoreException(
+ NLS.bind(TizenLaunchMessages.GDBSERVER_NOT_INSTALLED, device.getDeviceName()),
+ null);
+ }
+ } else {
+ if (!gdbserver.exists()) {
+ IPkgCommander commander = cmdTarget.getCommander(CmdTargetTypes.ROOTSTRAP);
+ commander.installRemotePkg("gdb-server", null);
+ }
- if (!gdbserver.exists()) {
- LaunchUtils.newCoreException(
- NLS.bind(TizenLaunchMessages.GDBSERVER_NOT_INSTALLED, device.getDeviceName()),
- null);
+ if (!gdbserver.exists()) {
+ LaunchUtils.newCoreException(
+ NLS.bind(TizenLaunchMessages.GDBSERVER_NOT_INSTALLED, device.getDeviceName()),
+ null);
+ }
}
if (!checkGdbServerInDevice(device, command)) {
- copyFileToDevice(device, srcPath.toOSString(),
+ copyFileToDevice(cmdTarget.getRootstrap(), device, gdbserverPath,
TizenPlatformConstants.GDBSERVER_PLATFORM_CMD);
device.executeShellCommand(String.format("chmod +x %s",
TizenPlatformConstants.GDBSERVER_PLATFORM_CMD));
}
}
- public static void copyFileToDevice(IDevice device, String srcPath, String descPath)
+ public static void copyFileToDevice(PlatformRootstrap rootstrap, IDevice device, String srcPath, String descPath)
throws CoreException, TimeoutException, SdbCommandRejectedException, IOException {
- String path = new Path(descPath).removeLastSegments(1).toOSString();
+ if (OSChecker.isWindows()) {
+ //IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
+ IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
+ String syncRootstrapPath = RootstrapUtil.getUserSyncRootstrapPath(rootstrap.getId());
+ IPath localGdbPath = new Path(syncRootstrapPath).append(TizenPlatformConstants.GDBSERVER_PLATFORM_CMD);
+ IPath localGdbDir = localGdbPath.removeLastSegments(1);
+ if (!localGdbPath.toFile().exists()) {
+ try {
+ FileUtil.createDirectory(localGdbDir.toFile());
+ copytool.downloadFileToFile(srcPath, localGdbPath.toFile());
+ } catch (Exception e) {
+ e.printStackTrace();
+ LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
+ }
+ } else {
+ srcPath = localGdbPath.toString();
+ }
+ }
+ String path = new Path(descPath).removeLastSegments(1).toString();
SyncResult syncResult = device.getSyncService().push(srcPath, device.getFileEntry(path));
if (!syncResult.isOk()) {
LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
--- /dev/null
+package org.tizen.nativeplatform.util;\r
+\r
+public class PlatformUserInteraction {\r
+ \r
+ public static final String CATE_SYNCRONIZE = "syncronize";\r
+ public static final String GEN_ROOTSTRAP = "gen.rootstrap";\r
+ public static final String SYNC_INCLUDES = "sync.includes";\r
+ public static final String SYNC_WORKSPACE = "sync.workspace";\r
+ public static final String SYNC_OUTPUT = "sync.output";\r
+}\r
package org.tizen.nativeplatform.util;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
private static final String USER_ROOSTRAP_BASE_DIR_NAME = "user-rootstraps";
private static final String REMOTE_TIZEN_SDK_DIR_NAME = "tizen-sdk-remote-data";
+ private static final String REMOTE_CONNECTION_DIR = "connection";
+ private static final String REMOTE_CONNECTION_FILE = "info";
private static final String REMOTE_SOURCE_DIR_NAME = "source";
+ private static final String REMOTE_WORKSPACE_DIR = "workspace";
private static final String REMOTE_ROOSTRAP_PLUGINS_DIR_NAME = "user-rootstrap-plugins";
public static String getBaseArchitecture(String arch) {
return "i386";
}
}
+
+ public static String getSshConnectionInfoPath(String device) {
+ return new Path(device).append(REMOTE_TIZEN_SDK_DIR_NAME).append(REMOTE_CONNECTION_DIR).append(REMOTE_CONNECTION_FILE).toOSString();
+ }
public static String getRemoteRootstrapBasePath() {
String userhome = RemoteConnectionManager.getRemoteTools().getUserhome();
return new Path(userhome).append(REMOTE_TIZEN_SDK_DIR_NAME).toString();
}
-
+ /*
public static String getRemoteSourcePath() {
return new Path(getRemoteRootstrapBasePath()).append(REMOTE_SOURCE_DIR_NAME).toString();
}
-
+ */
public static String getRemoteRootstrapPluginPath() {
return new Path(getRemoteRootstrapBasePath()).append(REMOTE_ROOSTRAP_PLUGINS_DIR_NAME)
.toString();
}
+
+ public static String getUserSyncWorkspacePath(String project) {
+ InetAddress ia = null;
+ try {
+ ia = InetAddress.getLocalHost();
+ } catch (UnknownHostException ee) {}
+ String ip = ia.getHostAddress();
+ String user = System.getProperty("user.name");
+ String workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+ String linuxWorkspace = sbi.getMinGWPathFromWindowsPath(workspace, false);
+ String dir = ip + "_" + user;
+ return new Path(getRemoteRootstrapBasePath()).append(REMOTE_WORKSPACE_DIR).append(dir).append(linuxWorkspace).append(project).toString();
+ }
+
+ public static String getUserSyncRootstrapPath(String id) {
+ if (!RemoteConnectionManager.connected()) {
+ return "";
+ }
+ final String host = RemoteConnectionManager.getRemoteTools().getHost();
+ final String user = RemoteConnectionManager.getRemoteTools().getUser();
+ String dir = host + "_" + user;
+ return new Path(getBaseUserRootstrapPath()).append(dir).append(id).toOSString();
+ }
public static String getUserRootstrapPath(String id) {
return new Path(getBaseUserRootstrapPath()).append(id).toOSString();
package org.tizen.nativeplatform.views.ui;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ResourceBundle;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ptp.remotetools.core.IRemoteExecutionTools;
+import org.eclipse.ptp.remotetools.core.IRemoteFileTools;
+import org.eclipse.ptp.remotetools.exception.CancelException;
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;
+import org.eclipse.ptp.remotetools.exception.RemoteExecutionException;
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
private Text hostText;
private Text userText;
private Text passText;
- private Text sudoText;
+ private Text sudoText;
+ private Text sshPrivateText;
+ private Text sshPublicText;
private int x = 0;
private int y = 0;
- private int width = 300;
+ private int width = 400;
private int height = 250;
private final String BUNDLE_NAME = RemoteConnectionDialog.class.getPackage().getName()
composite.setLayout(new GridLayout(1, false));
createConnectionComposite(composite);
+ createSshComposite(composite);
return null;
}
+ private void createSshComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gridData);
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.minimumHeight = 0;
+
+ Label sshPrivate = new Label(composite, SWT.NONE);
+ sshPrivate.setText("SSH Private key:");
+ sshPrivateText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ sshPrivateText.setLayoutData(gridData);
+ sshPrivateText.setText(getDefaultSshPrivateKey());
+
+ Button sshPrivateButton = new Button(composite, SWT.NONE);
+ sshPrivateButton.setText("Browse");
+ sshPrivateButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.SINGLE);
+ fd.setText("Select SSH private key");
+ fd.setFilterPath(System.getProperty("user.home"));
+ String file = fd.open();
+ if (file != null) {
+ sshPrivateText.setText(file);
+ }
+ }
+ });
+ Label sshPublic = new Label(composite, SWT.NONE);
+ sshPublic.setText("SSH public key:");
+ sshPublicText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ sshPublicText.setLayoutData(gridData);
+ sshPublicText.setText(getDefaultSshPublicKey());
+
+ Button sshPublicButton = new Button(composite, SWT.NONE);
+ sshPublicButton.setText("Browse");
+ sshPublicButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.SINGLE);
+ fd.setText("Select SSH public key");
+ fd.setFilterPath(System.getProperty("user.home"));
+ String file = fd.open();
+ if (file != null) {
+ sshPublicText.setText(file);
+ }
+ }
+ });
+ }
+
+ private String getDefaultSshPrivateKey() {
+ String home = System.getProperty("user.home");
+ IPath path = new Path(home).append(".ssh").append("id_rsa");
+ if (path.toFile().exists()) {
+ return path.toOSString();
+ } else {
+ return "";
+ }
+ }
+
+
+ private String getDefaultSshPublicKey() {
+ String home = System.getProperty("user.home");
+ IPath path = new Path(home).append(".ssh").append("id_rsa.pub");
+ if (path.toFile().exists()) {
+ return path.toOSString();
+ } else {
+ return "";
+ }
+ }
private void createConnectionComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
userText.setLayoutData(gridData);
Label passwordLabel = new Label(composite, SWT.NONE);
passwordLabel.setText("Password:");
- passText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ passText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
passText.setLayoutData(gridData);
- Label sudoLabel = new Label(composite, SWT.NONE);
- sudoLabel.setText("Sudo password:");
- sudoText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- sudoText.setLayoutData(gridData);
}
@Override
final String host = hostText.getText();
final String user = userText.getText();
final String pass = passText.getText();
+ final String privateKey = sshPrivateText.getText();
+ final String publicKey = sshPublicText.getText();
+
+ boolean isNotOk = host.isEmpty() || user.isEmpty() || pass.isEmpty()
+ || privateKey.isEmpty() || publicKey.isEmpty();
+
+ if (isNotOk) {
+ DialogUtil.openErrorDialog("Please input all connection information.");
+ return;
+ }
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
InterruptedException {
monitor.beginTask(resources.getString("RemoteConnDlg.Progress.Creating"), 1);
try {
- if (!RemoteConnectionManager.createConnection(host, user, pass, new SubProgressMonitor(monitor, 1))) {
+ if (!RemoteConnectionManager.createConnection(host, user, pass, publicKey, privateKey,
+ new SubProgressMonitor(monitor, 1))) {
DialogUtil.openMessageDialog(getShell(), "Failed to connect");
+ } else {
+ try {
+ FileReader fileReader = new FileReader(publicKey);
+ BufferedReader reader = new BufferedReader(fileReader);
+ String pubkey = reader.readLine();
+ IRemoteExecutionTools exectool = RemoteConnectionManager.getRemoteTools().getExecTool();
+ IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool();
+ String userhome = RemoteConnectionManager.getRemoteTools().getUserhome();
+ String remoteAuthfile = new Path(userhome).append(".ssh").append("authorized_keys").toString();
+ boolean needSet = true;
+ if (filetool.hasFile(remoteAuthfile, new NullProgressMonitor())) {
+ String cmd = String.format("grep -rn \"%s\" %s", pubkey, remoteAuthfile);
+ String output = exectool.executeWithOutput(cmd);
+ if (!output.isEmpty()) {
+ needSet = false;
+ }
+ }
+ if (needSet) {
+ String cmd = String.format("echo \"%s\" >> %s", pubkey, remoteAuthfile);
+ exectool.executeBashCommand(cmd);
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (RemoteExecutionException e) {
+ e.printStackTrace();
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ } catch (CancelException e) {
+ e.printStackTrace();
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ }
+
}
} finally {
monitor.done();
View.Contextmenu.Manage = Manage Packages
View.Contextmenu.Remove = Remove
View.Contextmenu.Export = Export
+View.Contextmenu.Sync = Sync Includes
View.Desc.Arch = * Architecture: %s(%s)
View.Desc.Status = * Status : %s
package org.tizen.nativeplatform.views.ui;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.tizen.common.TizenHelpContextIds;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.FileUtil;
import org.tizen.common.util.ImageUtil;
import org.tizen.common.util.OSChecker;
import org.tizen.common.util.SWTUtil;
import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
+import org.tizen.nativeplatform.remote.connection.RootstrapSyncronizer;
+import org.tizen.nativeplatform.remote.connection.RsyncProcessor;
import org.tizen.nativeplatform.repo.commander.LocalRepoMounter;
import org.tizen.nativeplatform.repo.commander.RepoManager;
import org.tizen.nativeplatform.repo.model.Repository;
import org.tizen.nativeplatform.types.PkgTypes;
import org.tizen.nativeplatform.util.GBSArchitectureChecker;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.util.RootstrapUtil;
import org.tizen.nativeplatform.views.model.PlatformRootstrap;
import org.tizen.sdblib.IDevice;
private Action actionPkgMgr;
private Action actionRemove;
private Action actionExport;
+ private Action actionSync;
private MenuManager menuMgr;
private PlatformRootstrap generatedRootstrap;
}
private void createRootstrapTableComposite(Composite parent) {
-
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(1, false);
String archLine = String.format(resources.getString("View.Desc.Arch"),
getArchitectureCategory(rootstrap.getArch()), rootstrap.getArch());
String statusLine = String.format(resources.getString("View.Desc.Status"),
- rootstrap.isInitialized() ? "OK" : "Not Intialized");
+ rootstrap.checkInitialized() ? "OK" : "Not Intialized");
IPath confFile = rootstrap.getConfFile();
String confFileLine = "";
if (confFile != null) {
manager.add(new Separator());
manager.add(actionSetDefault);
manager.add(new Separator());
- manager.add(actionExport);
+ if (!OSChecker.isWindows()) {
+ manager.add(actionExport);
+ }
manager.add(actionRemove);
manager.add(new Separator());
manager.add(actionChangeConfFile);
manager.add(new Separator());
manager.add(actionPkgMgr);
+ if (OSChecker.isWindows()) {
+ manager.add(new Separator());
+ manager.add(actionSync);
+ }
}
private void activateContext() {
contextService.activateContext("org.tizen.common.rootstrap.setdefault.context");
contextService.activateContext("org.tizen.common.rootstrap.lauchpkgmgr.context");
contextService.activateContext("org.tizen.common.rootstrap.remove.context");
- contextService.activateContext("org.tizen.common.rootstrap.export.context");
+ if (!OSChecker.isWindows()) {
+ contextService.activateContext("org.tizen.common.rootstrap.export.context");
+ }
contextService.activateContext("org.tizen.common.rootstrap.change.conffile.context");
+ if (OSChecker.isWindows()) {
+ contextService.activateContext("org.tizen.nativeplatform.rootstrap.sync.includes");
+ }
}
private void makeActions() {
}
};
actionRemove.setText(resources.getString("View.Contextmenu.Remove"));
-
- actionExport = new Action() {
- @Override
- public void run() {
- exportRootstrap();
- }
- };
- actionExport.setText(resources.getString("View.Contextmenu.Export"));
+ if (!OSChecker.isWindows()) {
+ actionExport = new Action() {
+ @Override
+ public void run() {
+ exportRootstrap();
+ }
+ };
+ actionExport.setText(resources.getString("View.Contextmenu.Export"));
+ }
+ if (OSChecker.isWindows()) {
+ actionSync = new Action() {
+ @Override
+ public void run() {
+ syncIncludes();
+ }
+ };
+ actionSync.setText(resources.getString("View.Contextmenu.Sync"));
+ }
}
private void updateToolbarEnable() {
}
private void showConnectDialog() {
-
RemoteConnectionDialog dlg = new RemoteConnectionDialog(shell);
if (dlg.open() == Dialog.OK) {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- monitor.beginTask("Synchronizing...", 2);
+ monitor.beginTask("Synchronizing...", 3);
try {
monitor.subTask("Synchronizing rootstraps...");
RootstrapManager.reinitialize(new SubProgressMonitor(monitor, 1));
return;
}
}
+ //RootstrapSyncronizer.Syncronize(RootstrapManager.getRootstraps());
}
+
+ private void syncIncludes() {
+ doActionForEntry(new IActionForEntry() {
+ @Override
+ public void doAction() {
+ Table table = tableViewer.getTable();
+ TableItem[] item = table.getSelection();
+ final PlatformRootstrap selected = (PlatformRootstrap) item[0].getData();
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Syncronize includes...", -1);
+ try {
+ RootstrapSyncronizer.syncronize(selected, monitor);
+ } finally {
+ monitor.done();
+ }
+ }
+ });
+ } catch (Exception e) {
+ logger.error("Failed to syncronize includes", e);
+ DialogUtil.openErrorDialog(String.format("%s\n * %s",
+ "Failed to syncronize includes",
+ e.toString()));
+ return;
+ }
+ }
+ @Override
+ public boolean doCheckEnable() {
+ return true;
+ }
+ });
+ }
+
private void disconnectRemotehost() {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
if (generatedRootstrap == null) {
throw new InterruptedException();
}
+ if (OSChecker.isWindows()) {
+ RootstrapSyncronizer.syncronize(generatedRootstrap, monitor);
+ }
}
});
} catch (Exception e) {
} finally {
RootstrapManager.removeLatestTempDirForRootstrap();
}
-
RootstrapManager.addRootstrap(generatedRootstrap);
}
.getString("Action.Msg.Question.NotInit"));
if (ret != SWT.YES) {
return;
- }
-
+ }
// generate base file system here if "YES"
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
}
selected.setInitialized(true);
}
-
+ RootstrapSyncronizer.cacheModificationTime(selected);
// launch package manager
IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
final PkgCommandTarget cmdTarget = new PkgCommandTarget(
InterruptedException {
monitor.beginTask(
- resources.getString("Action.Msg.Progress.Finalizing.PkgMgr"), 2);
- monitor.subTask(resources
- .getString("Action.Msg.Progress.Umount.rootstrap"));
- LocalRepoMounter.clearMounted(monitor);
- // TODO: error handling for umountLocalRepository
- monitor.worked(1);
- monitor.subTask(resources
- .getString("Action.Msg.Progress.Refresh.rootstrap"));
- RootstrapManager.updateRootstrap(selected);
- monitor.worked(2);
- monitor.done();
+ resources.getString("Action.Msg.Progress.Finalizing.PkgMgr"), 3);
+ try {
+ monitor.subTask(resources
+ .getString("Action.Msg.Progress.Umount.rootstrap"));
+ LocalRepoMounter.clearMounted(monitor);
+ // TODO: error handling for umountLocalRepository
+ monitor.worked(1);
+ monitor.subTask(resources
+ .getString("Action.Msg.Progress.Refresh.rootstrap"));
+ RootstrapManager.updateRootstrap(selected);
+ monitor.worked(2);
+ RootstrapSyncronizer.syncronizeIfChanges(selected, new SubProgressMonitor(monitor, 1));
+ } finally {
+ monitor.done();
+ }
}
});
} catch (InvocationTargetException e) {
return "x86";
}
}
+
+ private class ProcessOutputThread extends Thread {
+ private InputStream is;
+ private StringBuffer msg;
+ public ProcessOutputThread(InputStream is, StringBuffer msg) {
+ this.is = is;
+ this.msg = msg;
+ }
+
+ public void run() {
+ try {
+ msg.append(getStreamString(is));
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) { //
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private String getStreamString(InputStream is) {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ StringBuffer out = new StringBuffer();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line);
+ out.append(line);
+ }
+ return out.toString().trim();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ return "";
+ }
+ }
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.log.UserInteraction;
+import org.tizen.common.util.log.UserLogger;
import org.tizen.nativeappcommon.wizards.Messages;
import org.tizen.nativeappcommon.wizards.TizenProjectWizard;
import org.tizen.nativecommon.templateengine.build.AbstractProjectGenerator;
@Override
public boolean performFinish() {
-
+ long start = 0;
+ long end = 0;
+ start = System.currentTimeMillis();
boolean result = false;
IPath projectPath = ResourcesPlugin.getWorkspace().getRoot().getLocation()
}
commander.ApplySharedProject(newProject, getContainer());
}
-
+ end = System.currentTimeMillis();
+ System.out.print("time :" + (end-start)/1000.0);
return result;
}
build_script_path=${ROOTDIR}/pde-build
ide_path=${ROOTDIR}/ide
dropin_path=${ide_path}/dropins
+ plugin_path=${ide_path}/plugins
+ feature_path=${ide_path}/features
cp -r ${SRCDIR}/package/add-ons/dropins/PTP ${dropin_path}/
+ cp -r ${SRCDIR}/package/add-ons/dropins/PTP/plugins/* ${plugin_path}/
+ cp -r ${SRCDIR}/package/add-ons/dropins/PTP/features/* ${feature_path}/
cp -r ${SRCDIR}/package/add-ons/dropins/RSE ${dropin_path}/
+ cp -r ${SRCDIR}/package/add-ons/dropins/RSE/plugins/* ${plugin_path}/
+ cp -r ${SRCDIR}/package/add-ons/dropins/RSE/features/* ${feature_path}/
echo ${dropin_path}
}
OS:ubuntu-64
Build-host-os:ubuntu-64
Build-dependency:base-ide-product [ubuntu-64], base-ide-product-add-ons [ubuntu-64], pde-build [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-64]
-Install-dependency:base-ide-product [ubuntu-64], base-ide-product-add-ons [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-32]
+Install-dependency:base-ide-product [ubuntu-64], base-ide-product-add-ons [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-64]
Description:Nativeplatform plugin
Package:nativeplatform-eplugin
OS:windows-32
-Build-host-os:windows-32
+Build-host-os:ubuntu-32
Build-dependency:base-ide-product [windows-32], base-ide-product-add-ons [windows-32], pde-build [windows-32], common-eplugin [windows-32], nativecommon-eplugin [windows-32], nativeappcommon-eplugin [windows-32]
Install-dependency:base-ide-product [windows-32], base-ide-product-add-ons [windows-32], common-eplugin [windows-32], nativecommon-eplugin [windows-32], nativeappcommon-eplugin [windows-32]
Description:Nativeplatform plugin
OS:windows-64
Build-host-os:ubuntu-64
Build-dependency:base-ide-product [windows-64], base-ide-product-add-ons [windows-64], pde-build [windows-64], common-eplugin [windows-64], nativecommon-eplugin [windows-64], nativeappcommon-eplugin [windows-64]
-Install-dependency:base-ide-product [windows-64], base-ide-product-add-ons [windows-64], common-eplugin [windows-64], nativecommon-eplugin [windows-64], nativeappcommon-eplugin [windows-32]
+Install-dependency:base-ide-product [windows-64], base-ide-product-add-ons [windows-64], common-eplugin [windows-64], nativecommon-eplugin [windows-64], nativeappcommon-eplugin [windows-64]
Description:Nativeplatform plugin
Package:nativeplatform-eplugin-test
Install-dependency:nativeplatform-eplugin [ubuntu-64]
Description:Platform IDE test package
+Package:nativeplatform-eplugin-test
+OS:windows-32
+Build-host-os:ubuntu-32
+Install-dependency:nativeplatform-eplugin [windows-32]
+Description:Platform IDE test package
+
+Package:nativeplatform-eplugin-test
+OS:windows-64
+Build-host-os:ubuntu-64
+Install-dependency:nativeplatform-eplugin [windows-64]
+Description:Platform IDE test package
+
Package:meta-nativeplatform-eplugin-test
Label:Platform IDE Test Tools
Attribute:test
Build-host-os:ubuntu-64
Install-dependency:nativeplatform-eplugin-test
Description:Platform IDE test meta package
+
+Package:meta-nativeplatform-eplugin-test
+Label:Platform IDE Test Tools
+Attribute:test
+OS:windows-32
+Build-host-os:ubuntu-32
+Install-dependency:nativeplatform-eplugin-test
+Description:Platform IDE test meta package
+
+Package:meta-nativeplatform-eplugin-test
+Label:Platform IDE Test Tools
+Attribute:test
+OS:windows-64
+Build-host-os:ubuntu-64
+Install-dependency:nativeplatform-eplugin-test
+Description:Platform IDE test meta package