<builder
autoBuildTarget="all"
cleanBuildTarget="clean"
- command="sbi-make"
+ command="/usr/bin/gbs"
commandLauncher="org.tizen.nativeplatform.build.PlatformBuildCommandLauncher"
buildfileGenerator="org.tizen.nativeplatform.build.PlatformMakeGenerator"
buildRunner="org.tizen.nativeplatform.build.PlatformExternalBuildRunner"
</actionSet>
</extension>
--->
+-->
+
+<!--
<extension
point="org.eclipse.ui.popupMenus">
</enablement>
</objectContribution>
</extension>
+-->
<extension
point="org.eclipse.cdt.core.templateProcessTypes">
<processType
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.build;
+
+public interface IBuildCommandProvider {
+ enum BUILDTOOL {
+ GBS
+ }
+
+ String getBuildCommand();
+ String[] getBuildArguments();
+ String getCleanCommand();
+ String[] getCleanArguments();
+}
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.build;
+
+public interface IBuildResultProcessor {
+ boolean process(String[] buildArguments);
+ String[] getOutputFiles();
+}
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-
import org.tizen.common.util.ProcessMonitorThread;
import org.tizen.nativecommon.ProjectUtil;
import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativeplatform.Activator;
public class PlatformBuildCommandLauncher extends CommandLauncher {
Process proc = null;
- if (commandPath.toString().contains("sbi-make")) {
+ if (commandPath.toString().contains("/usr/bin/gbs")) {
IProject proj = getProject();
- PlatformProjectDependentPackager packager = (PlatformProjectDependentPackager) ProjectTypeManager
- .getProjectPackagerInstance(proj);
- SmartBuildInterface sbi = SmartBuildInterface.getInstance(proj);
+ PlatformProjectDependentBuilder builder = (PlatformProjectDependentBuilder) ProjectTypeManager
+ .getProjectBuilderInstance(proj);
IConfiguration config = ManagedBuildManager.getBuildInfo(proj)
.getDefaultConfiguration();
IPath workingPath = new Path(proj.getLocation().toOSString());
- String[] new_envs = packager.getEnvironment(config);
- String cmd = "";
+ String[] new_envs = builder.getEnvironment(config);
+
+ String command = "";
+ String[] arguments = null;
if ("clean".equals(args[0])) {
- cmd = packager.getCleanCmd(config);
+ command = builder.getCleanCommand(config);
+ arguments = builder.getCleanArguments(config);
} else {
- cmd = packager.getBuildPackageCmd(config);
+ command = builder.getBuildCommand(config);
+ arguments = builder.getBuildArguments(config);
}
- if (cmd == null || cmd.isEmpty()) {
+
+ if (command == null || command.isEmpty()) {
Status status = new Status(Status.ERROR, Activator.PLUGIN_ID,
"Failed to build the project", null);
throw new CoreException(status);
}
-
- String[] cmds = sbi.parseCommandString(cmd);
- String[] argus = new String[cmds.length - 1];
- for (int i = 0; i < cmds.length - 1; i++) {
- argus[i] = cmds[i + 1];
- }
-
- proc = super.execute(new Path(cmds[0]), argus, new_envs, workingPath,
+ proc = super.execute(new Path(command), arguments, new_envs, workingPath,
new NullProgressMonitor());
-
if ("clean".equals(args[0])) {
proj.touch(monitor);
ProjectUtil.refreshResources(proj);
*
*/
-package org.tizen.nativeplatform.pkg.commander.factory;
+package org.tizen.nativeplatform.build;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.tizen.nativeplatform.pkg.commander.IPackager;
-import org.tizen.nativeplatform.pkg.commander.rpm.RpmPackager;
-import org.tizen.nativeplatform.types.PkgTypes;
+import org.tizen.nativeplatform.build.IBuildCommandProvider.BUILDTOOL;
+import org.tizen.nativeplatform.build.gbs.GBSBuildCommandProvider;
-public class PackagerFactory {
-
- public static IPackager getPackager(PkgTypes type, IProject project,
- IConfiguration config) {
- if (type.equals(PkgTypes.RPM)) {
- return new RpmPackager(project, config);
+public class PlatformBuildCommandProviderFactory {
+ public static IBuildCommandProvider getProvider(BUILDTOOL tool, IConfiguration config) {
+ if (tool.equals(BUILDTOOL.GBS)) {
+ IBuildCommandProvider provider = new GBSBuildCommandProvider(config);
+ return provider;
} else {
return null;
}
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- packagingResult = pkgUtil.pakaging(project, config, monitor);
+ //packagingResult = pkgUtil.pakaging(project, config, monitor);
}
});
} catch (InvocationTargetException e1) {
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.build;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.tizen.nativeplatform.build.IBuildCommandProvider.BUILDTOOL;
+import org.tizen.nativeplatform.build.gbs.GBSBuildResultProcessor;
+
+public class PlatformBuildResultProcessorFactory {
+ public static IBuildResultProcessor getProcessor(BUILDTOOL tool, IConfiguration config) {
+ if (tool.equals(BUILDTOOL.GBS)) {
+ IBuildResultProcessor processor = new GBSBuildResultProcessor(config);
+ return processor;
+ } else {
+ return null;
+ }
+ }
+}
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
import org.eclipse.cdt.make.internal.core.StreamMonitor;
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
+import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
-import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.swt.widgets.Display;
-import org.tizen.common.util.OSChecker;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.common.util.log.UserLogger;
+import org.tizen.nativeplatform.build.IBuildCommandProvider.BUILDTOOL;
import org.tizen.nativeplatform.util.PackageUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
final IConfiguration configuration, IBuilder builder, IConsole console,
IMarkerGenerator markerGenerator, IncrementalProjectBuilder projectBuilder,
IProgressMonitor monitor) throws CoreException {
+ UserLogger.start(UserInteraction.CATE_PLATFORM_BUILD);
boolean isClean = invokeExternalBuild(kind, project, configuration, builder, console,
markerGenerator, projectBuilder, monitor);
+ UserLogger.end(UserInteraction.CATE_PLATFORM_BUILD);
final PackageUtil pkgUtil = new PackageUtil(PlatformProjectUtil.getPkgType());
Display.getDefault().asyncExec(new Runnable() {
public void run() {
monitor);
if (p != null) {
/*
- * try { // Close the input of the Process explicitly. // We will never write to
- * it. p.getOutputStream().close(); } catch (IOException e) { }
+ * try { // Close the input of the Process explicitly. // We
+ * will never write to it. p.getOutputStream().close(); }
+ * catch (IOException e) { }
*/
// Before launching give visual cues via the monitor
monitor.subTask(ManagedMakeMessages
.getResourceString("MakeBuilder.Updating_project")); //$NON-NLS-1$
try {
- // Do not allow the cancel of the refresh, since the builder is external
- // to Eclipse, files may have been created/modified and we will be
+ // Do not allow the cancel of the refresh, since the
+ // builder is external
+ // to Eclipse, files may have been created/modified and
+ // we will be
// out-of-sync.
- // The caveat is for huge projects, it may take sometimes at every build.
+ // The caveat is for huge projects, it may take
+ // sometimes at every build.
// TODO should only refresh output folders
// project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ // Synchronize build output files.
+ int exitValue = p.exitValue();
+ if (exitValue == 0) {
+ IBuildResultProcessor processor = PlatformBuildResultProcessorFactory
+ .getProcessor(BUILDTOOL.GBS, configuration);
+ if (processor.process(buildArguments)) {
+ String[] outputFiles = processor.getOutputFiles();
+ buf = new StringBuffer(NEWLINE);
+ buf.append("**** Synchronized output files ****").append(NEWLINE);
+ for (String file : outputFiles) {
+ buf.append(" - ").append(file).append(NEWLINE);
+ }
+ consoleOut.write(buf.toString().getBytes());
+ } else {
+ buf = new StringBuffer(NEWLINE);
+ buf.append("**** Failed to synchronize output files ****").append(
+ NEWLINE);
+ consoleOut.write(buf.toString().getBytes());
+ }
+ } else {
+ buf = new StringBuffer(NEWLINE);
+ buf.append("**** Failed to build ****").append(NEWLINE);
+ consoleOut.write(buf.toString().getBytes());
+ }
+
// use the refresh scope manager to refresh
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
package org.tizen.nativeplatform.build;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
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.Path;
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.password.SudoPasswdManager;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
public class PlatformProjectDependentBuilder extends CommonProjectDependentBuilder {
@Override
protected String getConfigureOption() {
-
String options = String.format(" ");
-
return options;
}
@Override
protected String getMakeOption() {
- // TODO Auto-generated method stub
return "";
}
@Override
protected String getCleanOption() {
- // TODO Auto-generated method stub
return "";
}
return options.concat(sysroot);
}
}
+
+ public String getBuildCommand(IConfiguration config) {
+ IBuildCommandProvider provider = PlatformBuildCommandProviderFactory.getProvider(BUILDTOOL.GBS, config);
+ if (provider != null) {
+ return provider.getBuildCommand();
+ } else {
+ return "";
+ }
+ }
+
+ public String[] getBuildArguments(IConfiguration config) {
+ IBuildCommandProvider provider = PlatformBuildCommandProviderFactory.getProvider(BUILDTOOL.GBS, config);
+ if (provider != null) {
+ return provider.getBuildArguments();
+ } else {
+ return new String[0];
+ }
+ }
+
+ public String getCleanCommand(IConfiguration config) {
+ IBuildCommandProvider provider = PlatformBuildCommandProviderFactory.getProvider(BUILDTOOL.GBS, config);
+ if (provider != null) {
+ return provider.getCleanCommand();
+ } else {
+ return "";
+ }
+ }
+
+ public String[] getCleanArguments(IConfiguration config) {
+ IBuildCommandProvider provider = PlatformBuildCommandProviderFactory.getProvider(BUILDTOOL.GBS, config);
+ if (provider != null) {
+ return provider.getCleanArguments();
+ } else {
+ return new String[0];
+ }
+ }
+
+ public String[] getEnvironment(IConfiguration config) {
+ List<String> newEnvArray = new ArrayList<String>();
+ ICConfigurationDescription cfgDes = ManagedBuildManager
+ .getDescriptionForConfiguration(config);
+ IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
+ IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true);
+ Map<String, String> envMap = new HashMap<String, String>();
+ for (IEnvironmentVariable var : vars) {
+ envMap.put(var.getName(), var.getValue());
+ }
+ // add proxySet variable to Map
+ if (PreferencesManager.isProxyUsed()) {
+ String[] proxyInfo = PreferencesManager.getProxyParsedURL();
+ if (proxyInfo != null) {
+ String protocol = proxyInfo[0];
+ String host = proxyInfo[1];
+ String port = proxyInfo[2];
+ String envKey = String.format("%s_proxy", protocol);
+ String envValue = String.format("%s://%s:%s", protocol, host, port);
+ envMap.put(envKey, envValue);
+ }
+ }
+ for (Entry<String, String> entry : envMap.entrySet()) {
+ newEnvArray.add(String.format("%s=%s", entry.getKey(), entry.getValue()));
+ }
+ return newEnvArray.toArray(new String[0]);
+ }
+
+ public String[] getEnvsWithProxy() {
+ String[] envs = SmartBuildInterface.getInstance().getEnvironmentVariables();
+ if (PreferencesManager.isProxyUsed()) {
+ String[] proxyInfo = PreferencesManager.getProxyParsedURL();
+ if (proxyInfo != null) {
+ String protocol = proxyInfo[0];
+ String host = proxyInfo[1];
+ String port = proxyInfo[2];
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+ String envKey = String.format("%s_proxy", protocol);
+ String envValue = String.format("%s://%s:%s", protocol, host, port);
+ envs = sbi.addEnvironmentVariableArray(envKey, envValue);
+ }
+ }
+ return envs;
+ }
@Override
public void setBuildTargetID(IConfiguration config, String targetId) {
package org.tizen.nativeplatform.build;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
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.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.tizen.nativecommon.build.CommonProjectDependentPackager;
-import org.tizen.nativecommon.build.SmartBuildInterface;
import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativeplatform.password.SudoPasswdManager;
-import org.tizen.nativeplatform.preferences.PreferencesManager;
-import org.tizen.nativeplatform.rootstrap.RootstrapManager;
-import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+//This class is not used in platform project
public class PlatformProjectDependentPackager extends CommonProjectDependentPackager {
- private static final String ACTION_BUILDPACKAGE = "buildpackage";
- private static final String CONSOLE_NAME = "Packaging";
private static PlatformProjectDependentPackager instance = new PlatformProjectDependentPackager();
public static final CommonProjectDependentPackager getInstance() {
@Override
public String getPackageOption(IConfiguration config, String pkgType) {
- String workingDir = getWorkingDir(config);
- String options = "";
- String passwd = SudoPasswdManager.getSudoPassword();
- if (passwd == null) {
- return null;
- }
-
- if (RPM.equals(pkgType)) {
- options = String.format("-PASSWD=%s " + "-WORKING_DIR=%s " + "-PKG_TYPE=%s", passwd,
- workingDir, pkgType);
- } else {
- options = String.format("-WORKING_DIR=%s " + "-PKG_TYPE=%s", workingDir, pkgType);
- }
-
- return options;
- }
-
- public String getPackageOption(IConfiguration config, PlatformRootstrap rootstrap) {
- String workingDir = getWorkingDir(config);
- String passwd = SudoPasswdManager.getSudoPassword();
- if (passwd == null) {
- return null;
- }
-
- StringBuffer sbSnapshots = new StringBuffer();
- for (String s : rootstrap.getJustRepoURLs()) {
- sbSnapshots.append(" " + s);
- }
-
- StringBuffer sbGbsOptions = new StringBuffer();
- for (String op : PlatformConfigurationManager.getGBSOptions(config)) {
- sbGbsOptions.append(" " + op);
- }
-
- // Add --dist option if the rootstrap is based on local repository.
- IPath confFile = rootstrap.getConfFile();
- if (confFile != null) {
- sbGbsOptions.append(" " + String.format("--dist %s", confFile.toOSString()));
- }
-
- String gbsOptions = sbGbsOptions.toString().trim();
- String options = String
- .format("-PASSWD=%s " + "-WORKING_DIR=%s " + "-SNAPSHOTS=\"%s\" "
- + "-OPTIONS=\"%s\" ", passwd, workingDir, sbSnapshots.toString().trim(),
- gbsOptions);
-
- return options;
- }
-
- public void buildPackage(String pkgType) throws SBIException {
- IConfiguration config = getCurrentConfiguration();
-
- buildPackage(config, pkgType);
- }
-
- public void buildPackage(String configName, String pkgType) throws SBIException {
- IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project)
- .getManagedProject().getConfigurations();
- IConfiguration config = null;
-
- for (IConfiguration c : configurations) {
- if (c.getName().equals(configName)) {
- config = c;
- break;
- }
- }
-
- buildPackage(config, pkgType);
- }
-
- // command "build package" from specified configuration and pkgType
- private void buildPackage(IConfiguration config, String pkgType) throws SBIException {
- String projectDir = getProjectPath();
- String[] new_envs = getEnvironment(config);
- String cmd = getBuildPackageCmd(config);
- if (cmd == null || cmd.isEmpty()) {
- throw new SBIException("Failed to build the project");
- }
- sbi.actionConsole(cmd, projectDir, new_envs, CONSOLE_NAME);
- }
-
- public String[] getEnvironment(IConfiguration config) {
- List<String> newEnvArray = new ArrayList<String>();
- ICConfigurationDescription cfgDes = ManagedBuildManager
- .getDescriptionForConfiguration(config);
- IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
- IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true);
- Map<String, String> envMap = new HashMap<String, String>();
- for (IEnvironmentVariable var : vars) {
- envMap.put(var.getName(), var.getValue());
- }
- // add proxySet variable to Map
- if (PreferencesManager.isProxyUsed()) {
- String[] proxyInfo = PreferencesManager.getProxyParsedURL();
- if (proxyInfo != null) {
- String protocol = proxyInfo[0];
- String host = proxyInfo[1];
- String port = proxyInfo[2];
- String envKey = String.format("%s_proxy", protocol);
- String envValue = String.format("%s://%s:%s", protocol, host, port);
- envMap.put(envKey, envValue);
- }
- }
- for (Entry<String, String> entry : envMap.entrySet()) {
- newEnvArray.add(String.format("%s=%s", entry.getKey(), entry.getValue()));
- }
- return newEnvArray.toArray(new String[0]);
- }
-
- public String getCleanCmd(IConfiguration config) {
- String targetId = getTargetID(config);
- IPath configPath = project.getLocation().append(config.getName());
-
- return String.format("%s action %s -- %s -CONFIG_DIR=\"%s\"", sbi.getSBICommandPath("sbi"),
- targetId, "clean", configPath.toOSString());
- }
-
- public String getBuildPackageCmd(IConfiguration config) {
- String targetId = getTargetID(config);
- String rootId = sbi.getRootstrapIDFromTargetID(targetId);
- PlatformRootstrap rt = RootstrapManager.getRootstrap(rootId);
- if (rt == null) {
- return "";
- }
- String options = getPackageOption(config, rt);
- if (options == null) {
- return "";
- }
- return String.format("%s action %s -- %s %s", sbi.getSBICommandPath("sbi"), targetId,
- ACTION_BUILDPACKAGE, options);
- }
-
- public String[] getEnvsWithProxy() {
- String[] envs = sbi.getEnvironmentVariables();
- if (PreferencesManager.isProxyUsed()) {
- String[] proxyInfo = PreferencesManager.getProxyParsedURL();
- if (proxyInfo != null) {
- String protocol = proxyInfo[0];
- String host = proxyInfo[1];
- String port = proxyInfo[2];
- SmartBuildInterface sbi = SmartBuildInterface.getInstance();
- String envKey = String.format("%s_proxy", protocol);
- String envValue = String.format("%s://%s:%s", protocol, host, port);
- envs = sbi.addEnvironmentVariableArray(envKey, envValue);
- }
- }
- return envs;
+ return "";
}
@Override
@Override
public void buildPackage(String configName, String pkgType, boolean signApp)
throws SBIException, CoreException {
- buildPackage(configName, pkgType);
}
@Override
public void buildPackage(String pkgType, boolean signApp, boolean isLaunchMode)
throws SBIException, CoreException {
- buildPackage(pkgType);
+ }
+
+ @Override
+ public void buildPackage(String pkgType) throws SBIException, CoreException {
+ }
+
+ @Override
+ public void buildPackage(String configName, String pkgType) throws SBIException, CoreException {
}
}
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.build.gbs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.build.IBuildCommandProvider;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+public class GBSBuildCommandProvider implements IBuildCommandProvider {
+
+ private IConfiguration config;
+
+ public static final String BUILD_COMMAND = "/usr/bin/gbs";
+ public static final String CLEAN_COMMAND = "/bin/rm";
+ public static final String BUILD_SUBCOMMAND = "build";
+ public static final String ARCH_OP = "--arch";
+ public static final String REPO_OP = "--repository";
+ public static final String DEFINE_OP = "--define";
+ public static final String BUILDROOT_OP = "--buildroot";
+ public static final String EXTRAPKG_OP = "--extra-packs";
+
+ public GBSBuildCommandProvider(IConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public String getBuildCommand() {
+ return BUILD_COMMAND;
+ }
+
+ @Override
+ public String[] getBuildArguments() {
+ String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+ String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+ PlatformRootstrap rt = RootstrapManager.getRootstrap(rootId);
+ List<String> args = new ArrayList<String>();
+ args.add(BUILD_SUBCOMMAND);
+ args.add(ARCH_OP);
+ args.add(rt.getArch());
+ for (String snapshot : rt.getJustRepoURLs()) {
+ args.add(REPO_OP);
+ args.add(snapshot);
+ }
+ args.add(String.format("%s=%s", BUILDROOT_OP, rt.getPath().toOSString()));
+ args.add(String.format("%s=zypper,gdb,gdb-server", EXTRAPKG_OP));
+ for (String op : PlatformConfigurationManager.getGBSOptions(config)) {
+ args.add(op);
+ }
+ args.add(DEFINE_OP);
+ args.add("BUILD_TYPE ${BUILD_TYPE}");
+ return args.toArray(new String[0]);
+ }
+
+ @Override
+ public String getCleanCommand() {
+ return CLEAN_COMMAND;
+ }
+
+ @Override
+ public String[] getCleanArguments() {
+ IProject project = (IProject) config.getOwner();
+ IPath configPath = project.getLocation().append(config.getName());
+ List<String> args = new ArrayList<String>();
+ args.add("-rf");
+ args.add(configPath.toOSString());
+ return args.toArray(new String[0]);
+ }
+
+}
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.build.gbs;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.tizen.common.util.FileUtil;
+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.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+public class GBSBuildResultProcessor implements IBuildResultProcessor {
+
+ private IConfiguration config;
+ private List<String> rpmfiles = new ArrayList<String>();
+ private List<String> xmlfiles = new ArrayList<String>();
+
+ public GBSBuildResultProcessor(IConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public boolean process(String[] buildArguments) {
+ if (buildArguments != null && buildArguments.length > 0) {
+ if (buildArguments[0].equals("clean")) {
+ return true;
+ }
+ }
+ String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+ String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+ PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
+ List<String> rpms = getRpmFiles(rootstrap);
+ if (rpms.isEmpty()) {
+ return false;
+ }
+ 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 {
+ String filename = FileUtil.getFileNameFromPath(rpm);
+ String targetPath = configPath.append(filename).toOSString();
+ FileUtil.copyTo(rpm, targetPath);
+ rpmfiles.add(targetPath);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ List<String> xmls = getXmlFiles(rootstrap);
+ for (String xml : xmls) {
+ try {
+ String fileName = FileUtil.getFileNameFromPath(xml);
+ String targetPath = projectPath.append(fileName).toOSString();
+ FileUtil.copyTo(xml, targetPath);
+ xmlfiles.add(targetPath);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return true;
+ }
+
+ private List<String> getRpmFiles(PlatformRootstrap rootstrap) {
+ List<String> rpms = new ArrayList<String>();
+ String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+ rootstrap.getPath());
+ String arch = rootstrap.getArch();
+ IPath rpmPath = new Path(rootstrapPath).append("home").append("abuild").append("rpmbuild")
+ .append("RPMS").append(arch);
+ File rpmDir = rpmPath.toFile();
+ if (rpmDir.exists()) {
+ String[] files = rpmDir.list(new RpmFileFilter());
+ for (String file : files) {
+ IPath pkgPath = new Path(rpmDir.getPath()).append(file);
+ rpms.add(pkgPath.toOSString());
+ }
+ }
+ return rpms;
+ }
+
+ private List<String> getXmlFiles(PlatformRootstrap rootstrap) {
+ List<String> xmls = new ArrayList<String>();
+ String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+ rootstrap.getPath());
+ IPath rpmPath = new Path(rootstrapPath).append("home").append("abuild").append("rpmbuild")
+ .append("BUILD");
+ File[] paths = rpmPath.toFile().listFiles();
+ for (File path : paths) {
+ if (path.exists() && path.isDirectory()) {
+ String[] files = path.list(new XmlFileFilter());
+ for (String file : files) {
+ IPath xmlPath = new Path(path.getPath()).append(file);
+ xmls.add(xmlPath.toOSString());
+ }
+ }
+ }
+ return xmls;
+ }
+
+ @Override
+ public String[] getOutputFiles() {
+ List<String> result = new ArrayList<String>();
+ result.addAll(rpmfiles);
+ result.addAll(xmlfiles);
+ return result.toArray(new String[0]);
+ }
+
+}
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.SWTUtil;
import org.tizen.nativeplatform.Activator;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
private IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
private String rootstrapInstallLog = "";
private String deviceInstallLog = "";
+ private boolean continueLaunch = true;
public LaunchConfigurationProcessor(Shell shell, ILaunchConfiguration launchConfig,
IProject project, String mode, PkgCommandTarget target, IProgressMonitor monitor) {
}
setOptionAttributes(wc, devicePackages, rootstrapPackages, reinstallOp);
}
- return _installPackages(devicePackages, rootstrapPackages, reinstallOp, monitor);
+ if (questionIfNoPackagesToInstall(devicePackages, rootstrapPackages)) {
+ return _installPackages(devicePackages, rootstrapPackages, reinstallOp, monitor);
+ } else {
+ return false;
+ }
}
private boolean setLaunchConfigurationForEFL(IProgressMonitor monitor, final String descMsg,
protected IConfiguration getBuildConfiguration() {
return PlatformConfigurationManager.getDefaultConfiguration(project);
}
+
+ protected boolean questionIfNoPackagesToInstall(List<IPackage> devicePackages, List<IPackage> rootstrapPackages) {
+ final StringBuffer msg = new StringBuffer();
+ if (devicePackages.isEmpty()) {
+ msg.append("There is no package to install to device.");
+ msg.append("\n");
+ }
+ if (mode.equals(ILaunchManager.DEBUG_MODE) && rootstrapPackages.isEmpty()) {
+ msg.append("There is no package to install to rootstrap.");
+ msg.append("\n");
+ }
+ if (msg.length() != 0) {
+ msg.append("\n");
+ msg.append("Do you want to continue?");
+ SWTUtil.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (DialogUtil.openQuestionDialog(msg.toString()) == SWT.YES) {
+ continueLaunch = true;
+ } else {
+ continueLaunch = false;
+ }
+ }
+ });
+ }
+ return continueLaunch;
+ }
}
}
}
- protected boolean packagingProject(final IProject targetProj, final IConfiguration config,
- IProgressMonitor monitor) {
- boolean packagingResult = pkgUtil.pakaging(targetProj, config, monitor);
- if (packagingResult) {
+ protected boolean buildProject(final IProject targetProj, final IConfiguration config,
+ IProgressMonitor monitor) throws CoreException {
+ boolean result = pkgUtil.build(targetProj, config, monitor);
+ if (result) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
pkgUtil.cachePkgChecksum(targetProj, config);
DialogUtil.openErrorDialog(shell, CommonBuildMessages.BUILD_RESULT,
CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
}
- return packagingResult;
+ return result;
}
protected void verifyPlatformProjectSettings(ILaunchConfiguration config) throws CoreException {
List<IPackage> pkgs = pkgUtil.getPackages(project, config);
if (pkgs.isEmpty()) {
if (PlatformLaunchUtil.questionPackaging(project)) {
- if (packagingProject(project, config, new SubProgressMonitor(monitor, 1))) {
+ if (buildProject(project, config, new SubProgressMonitor(monitor, 1))) {
pkgs = pkgUtil.getPackages(project, config);
} else {
if (!PlatformLaunchUtil.questionContinue()) {
devicePackages.clear();
deviceTableViewer.getTable().clearAll();
if (devicePkgs.isEmpty()) {
+ deviceTableViewer.setInput(devicePackages);
setErrorMessage("Failed to get packages. Build a project first");
} else {
IPkgModelMaker maker = PkgModelMakerFactory.getMaker(PlatformProjectUtil.getPkgType());
List<IPackage> pkgs = pkgUtil.getPackages(project, config);
if (pkgs.isEmpty()) {
if (PlatformLaunchUtil.questionPackaging(project)) {
- if (!packagingProject(project, config)) {
+ if (!buildProject(project, config)) {
DialogUtil.openErrorDialog(CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
if (PlatformLaunchUtil.questionContinue()) {
return true;
}
});
}
+ } else {
+ return false;
}
}
return true;
return false;
}
- protected boolean packagingProject(final IProject project, final IConfiguration config) {
+ protected boolean buildProject(final IProject project, final IConfiguration config) {
Shell shell = getAvaiableShell();
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- result = pkgUtil.pakaging(project, config, monitor);
+ try {
+ result = pkgUtil.build(project, config, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
}
});
} catch (InvocationTargetException e) {
List<IPackage> pkgs = new ArrayList<IPackage>();
for (String path : filePaths) {
IPackage pkg = makeModel(path);
- pkgs.add(pkg);
+ if (pkg != null) {
+ pkgs.add(pkg);
+ }
}
return pkgs;
}
+++ /dev/null
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.nativeplatform.pkg.commander.rpm;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.tizen.nativecommon.build.CommonProjectDependentPackager;
-import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativeplatform.build.PlatformCheckCancelJob;
-import org.tizen.nativeplatform.filefilter.RpmFileFilter;
-import org.tizen.nativeplatform.pkg.commander.IPackager;
-
-public class RpmPackager implements IPackager {
-
- private IProject project = null;
- private IConfiguration config = null;
-
- public RpmPackager(IProject proj, IConfiguration config) {
- this.project = proj;
- this.config = config;
- }
-
- @Override
- public boolean packaging(IProgressMonitor monitor) {
- String PKGTYPE = "RPM";
- boolean result = false;
-
- CommonProjectDependentPackager packager = ProjectTypeManager
- .getProjectPackagerInstance(project);
-
- monitor.beginTask("Packaging...", 2);
-
- PlatformCheckCancelJob cancelJob = new PlatformCheckCancelJob(monitor, project,
- packager.getSbi());
- Thread checkCancelThread = new Thread(cancelJob);
- checkCancelThread.start();
-
- try {
- monitor.subTask("Packaging " + project.getName());
- packager.buildPackage(PKGTYPE);
- } catch (SBIException e) {
- e.printStackTrace();
- cancelJob.setFinishFlag(true);
- monitor.done();
- return false;
- } catch (CoreException e) {
- cancelJob.setFinishFlag(true);
- monitor.done();
- return false;
- }
- monitor.worked(1);
- cancelJob.setFinishFlag(true);
- monitor.subTask("Refreshing project...");
- List<String> pkgfiles = getProjectPackages();
- try {
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- monitor.worked(1);
- result = !pkgfiles.isEmpty();
- monitor.done();
- return result;
- }
-
- public List<String> getProjectPackages() {
- List<String> pkgs = new ArrayList<String>();
- IFolder folder = project.getFolder(config.getName());
- File dir = new File(folder.getLocation().toOSString());
- if (dir.exists()) {
- String[] files = dir.list(new RpmFileFilter());
- for (String file : files) {
- IPath pkgPath = new Path(dir.getPath()).append(file);
- pkgs.add(pkgPath.toOSString());
- }
- }
- return pkgs;
- }
-}
public String getListCacheFile() {
return ResourcesPlugin.getWorkspace().getRoot().getLocation()
- .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toString();
+ .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toOSString();
}
public String getName() {
package org.tizen.nativeplatform.util;
+import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+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.ArrayUtil;
-import org.tizen.common.util.log.UserInteraction;
-import org.tizen.common.util.log.UserLogger;
+import org.tizen.nativeplatform.filefilter.RpmFileFilter;
import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
-import org.tizen.nativeplatform.pkg.commander.IPackager;
import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
-import org.tizen.nativeplatform.pkg.commander.factory.PackagerFactory;
import org.tizen.nativeplatform.pkg.commander.factory.PkgModelMakerFactory;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.rds.CachePackageChecksum;
return false;
}
}
-
- public boolean pakaging(IProject project, IConfiguration config, IProgressMonitor monitor) {
- IPackager packager = PackagerFactory.getPackager(type, project, config);
- UserLogger.start(UserInteraction.CATE_PLATFORM_BUILD, UserInteraction.BUILD_PACKAGING);
- if (packager == null) {
+
+ public boolean build(IProject project, IConfiguration config, IProgressMonitor monitor) throws CoreException {
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+ List<IPackage> pkgs = getPackages(project, config);
+ if (pkgs.isEmpty()) {
return false;
}
- boolean result = packager.packaging(monitor);
- UserLogger.end(UserInteraction.CATE_PLATFORM_BUILD, UserInteraction.BUILD_PACKAGING);
- return result;
-
+ return true;
}
-
+
public void cachePkgChecksum(IProject project, IConfiguration config) {
try {
if(!CachePackageChecksum.cachePkgChecksum(project, getPackages(project, config))) {
}
public List<IPackage> getPackages(IProject project, IConfiguration config) {
- IPackager packager = PackagerFactory.getPackager(type, project, config);
- if (packager == null) {
- return new ArrayList<IPackage>();
+ List<String> pkgs = new ArrayList<String>();
+ IFolder folder = project.getFolder(config.getName());
+ File dir = new File(folder.getLocation().toOSString());
+ if (dir.exists()) {
+ String[] files = dir.list(new RpmFileFilter());
+ for (String file : files) {
+ IPath pkgPath = new Path(dir.getPath()).append(file);
+ pkgs.add(pkgPath.toOSString());
+ }
}
- List<String> pkgPaths = packager.getProjectPackages();
- return modelMaker.makeModels(pkgPaths);
+ return modelMaker.makeModels(pkgs);
}
}