diff options
27 files changed, 2424 insertions, 0 deletions
@@ -0,0 +1 @@ +bin @@ -0,0 +1,9 @@ +JuYoung Kim j0.kim@samsung.com> +Jaewon Lim <jaewon81.lim@samsung.com> +Jooyoul Lee <jy.exe.lee@samsung.com> +YoungTaik Byeon <yeongtaik.byeon@samsung.com> +SangHyun Lee <sanghyunnim.lee@samsung.com> +WooJin Jung <woojin2.jung@samsung.com> +Hyun Jong Park <phjwithyou.park@samsung.com> +HyunGoo Kang <hyungoo1.kang@samsung.com> + @@ -0,0 +1,207 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + + + + @@ -0,0 +1 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/builder/build.properties.clean b/builder/build.properties.clean new file mode 100644 index 0000000..b83048e --- /dev/null +++ b/builder/build.properties.clean @@ -0,0 +1,259 @@ +############################################################################### +# Copyright (c) 2003, 2006 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType=feature +#The id of the top level element we are building +topLevelElementId=org.tizen.dynamicanalysis.ide.eplugin.feature + +############# PRODUCT/PACKAGING CONTROL ############# +#product=/com.samsung.tizen.nativeapp.platform/TizenSDK.product +#runPackager=true + +#p2.gathering=true + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix=IDE + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs=linux, gtk, x86 +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - <format>" entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles=true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +#outputUpdateJars = false + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase=<codebase url> +#jnlp.j2se=<j2se version> +#jnlp.locale=<a locale> +#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +#jarProcessor.unsign=true +#signJars=true +#sign.alias=<alias> +#sign.keystore=<keystore location> +#sign.storepass=<keystore password> +#sign.keypass=<key password> + +#Arguments to send to the zip executable +#zipargs= + +#Arguments to send to the tar executable +#tarargs= + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +buildDirectory="Please export NATIVE_IDE__BUILD_PATH(do not touch here)" + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=N + +# ID of the build. Used in naming the build output. +buildId=fresh_ide_build + +# Label for the build. Used in naming the build output +buildLabel=${buildType}.${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier=<the value for the qualifier> + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +base="Please export NATIVE_IDE__PARENT_PATH_OF_BASED_ECLIPSE(do not touch here)" +baseLocation="Please export NATIVE_IDE__BASED_ECLIPSE_PATH(do not touch here)" + + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +baseos=linux +basews=gtk +basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL=<url for eclipse download site> +eclipseBuildId=<Id of Eclipse build to get> +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=true + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=false + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + + diff --git a/org.tizen.dynamicanalysis.ide.eplugin.feature/.project b/org.tizen.dynamicanalysis.ide.eplugin.feature/.project new file mode 100644 index 0000000..b9a27e5 --- /dev/null +++ b/org.tizen.dynamicanalysis.ide.eplugin.feature/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.tizen.dynamicanalysis.ide.eplugin.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> diff --git a/org.tizen.dynamicanalysis.ide.eplugin.feature/build.properties b/org.tizen.dynamicanalysis.ide.eplugin.feature/build.properties new file mode 100644 index 0000000..64f93a9 --- /dev/null +++ b/org.tizen.dynamicanalysis.ide.eplugin.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/org.tizen.dynamicanalysis.ide.eplugin.feature/feature.xml b/org.tizen.dynamicanalysis.ide.eplugin.feature/feature.xml new file mode 100644 index 0000000..2a640e7 --- /dev/null +++ b/org.tizen.dynamicanalysis.ide.eplugin.feature/feature.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="org.tizen.dynamicanalysis.ide.eplugin.feature" + label="Dynamic Analysis IDE Eplugin Feature" + version="1.0.0.qualifier" + provider-name="TIZEN"> + + <description url="http://www.example.com/description"> + [Enter Feature Description here.] + </description> + + <copyright url="http://www.example.com/copyright"> + [Enter Copyright Description here.] + </copyright> + + <license url="http://www.example.com/license"> + [Enter License Description here.] + </license> + +</feature> diff --git a/org.tizen.dynamicanalyzer/.classpath b/org.tizen.dynamicanalyzer/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/org.tizen.dynamicanalyzer/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.tizen.dynamicanalyzer/.project b/org.tizen.dynamicanalyzer/.project new file mode 100644 index 0000000..f86ad36 --- /dev/null +++ b/org.tizen.dynamicanalyzer/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.tizen.dynamicanalysis.ide.eplugin</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.tizen.dynamicanalyzer/.settings/org.eclipse.jdt.core.prefs b/org.tizen.dynamicanalyzer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3218d70 --- /dev/null +++ b/org.tizen.dynamicanalyzer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jan 05 15:34:31 KST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF b/org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9468aa6 --- /dev/null +++ b/org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Dynamic Analysis IDE Eplugin +Bundle-SymbolicName: org.tizen.dynamicanalysis.ide.eplugin;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.tizen.dynamicanalysis.ide.eplugin.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui, + org.tizen.common, + org.eclipse.core.resources;bundle-version="3.7.100", + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.core.filesystem;bundle-version="1.3.100", + org.eclipse.cdt.core;bundle-version="5.3.1", + org.eclipse.debug.core;bundle-version="3.7.0", + org.eclipse.debug.ui;bundle-version="3.7.101", + org.tizen.nativecommon;bundle-version="1.0.0", + org.eclipse.cdt.managedbuilder.core;bundle-version="8.0.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.jface.text, + org.eclipse.ui.texteditor, + org.tizen.common.connection diff --git a/org.tizen.dynamicanalyzer/OSGI-INF/l10n/bundle.properties b/org.tizen.dynamicanalyzer/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..adb5f38 --- /dev/null +++ b/org.tizen.dynamicanalyzer/OSGI-INF/l10n/bundle.properties @@ -0,0 +1 @@ +Bundle-Vendor = Samsung Electronics diff --git a/org.tizen.dynamicanalyzer/build.properties b/org.tizen.dynamicanalyzer/build.properties new file mode 100644 index 0000000..affb0d2 --- /dev/null +++ b/org.tizen.dynamicanalyzer/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + OSGI-INF/,\ + icon/ diff --git a/org.tizen.dynamicanalyzer/icon/alt_window_16.png b/org.tizen.dynamicanalyzer/icon/alt_window_16.png Binary files differnew file mode 100755 index 0000000..99ce735 --- /dev/null +++ b/org.tizen.dynamicanalyzer/icon/alt_window_16.png diff --git a/org.tizen.dynamicanalyzer/plugin.xml b/org.tizen.dynamicanalyzer/plugin.xml new file mode 100755 index 0000000..76afb8e --- /dev/null +++ b/org.tizen.dynamicanalyzer/plugin.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.ui.startup"> + <startup + class="org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup"> + </startup> + </extension> + + <extension point="org.eclipse.cdt.managedbuilder.core.buildDefinitions"> + <toolChain + id="org.tizen.nativecpp.toolchain.sbi.gnu.da" + isAbstract="false" + superClass="org.tizen.nativecpp.toolchain.sbi.gnu"> + <tool + id="org.tizen.nativecpp.tool.sbi.gnu.cpp.compiler.da" + isAbstract="false" + superClass="org.tizen.nativecpp.tool.sbi.gnu.cpp.compiler"> + <option + category="gnu.cpp.compiler.category.other" + command="-g -p -pg -funwind-tables -finstrument-functions" + defaultValue="true" + id="sbi.gnu.cpp.compiler.option.misc.pic.da" + name="Dynamic Analyzer Option" + superClass="sbi.gnu.cpp.compiler.option.misc.pic.cpp" + valueType="boolean"> + </option> + </tool> + <tool + id="org.tizen.nativecpp.tool.sbi.gnu.cpp.linker.da" + isAbstract="false" + superClass="org.tizen.nativecpp.tool.sbi.gnu.cpp.linker"> + <option + category="gnu.cpp.link.category.options" + command="-p -pg" + defaultValue="true" + id="sbi.gnu.cpp.linker.option.da_flag.cpp" + name="Dynamic Analyzer Option" + superClass="gnu.cpp.link.option.shared" + valueHandler="org.tizen.dynamicanalyzer.launch.DynamicOptionValueHandler" + valueType="boolean"> + </option> + </tool> + </toolChain> + <projectType + buildArtefactType="org.tizen.nativecpp.buildArtefactType.app" + id="org.tizen.nativecpp.target.sbi.gcc45.app.da"> + <configuration + id="org.tizen.nativecpp.config.sbi.gcc45.app.debug.emulator.da" + name="DA-Tizen-Emulator" + parent="org.tizen.nativecpp.config.sbi.gcc45.app.debug.emulator"> + <toolChain + id="org.tizen.nativecpp.toolchain.sbi.gcc45.app.debug.emulator.da" + superClass="org.tizen.nativecpp.toolchain.sbi.gnu.da"> + </toolChain> + </configuration> + <configuration + id="org.tizen.nativecpp.config.sbi.gcc45.app.debug.device.da" + name="DA-Tizen-Device" + parent="org.tizen.nativecpp.config.sbi.gcc45.app.debug.device"> + <toolChain + id="org.tizen.nativecpp.toolchain.sbi.gcc45.app.debug.device.da" + superClass="org.tizen.nativecpp.toolchain.sbi.gnu.da"> + </toolChain> + </configuration> + </projectType> + </extension> + + <extension + point="org.eclipse.debug.ui.launchShortcuts"> + <shortcut + class="org.tizen.dynamicanalysis.ide.eplugin.launchshortcut.TizenCppApplicationProfileShortcut" + icon="icon/alt_window_16.png" + id="org.tizen.nativecpp.launch.ui.shortcut.TizenApplicationLaunchShortcut.da" + label="Profile With Dynamic Analyzer" + modes="profile"> + <contextualLaunch> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <or> + <instanceof value="org.eclipse.cdt.core.model.IBinary"/> + <instanceof value="org.eclipse.cdt.core.model.ICProject"/> + <test + forcePluginActivation="true" + property="org.eclipse.cdt.launch.isExecutable"/> + <test + forcePluginActivation="true" + property="org.eclipse.cdt.launch.isCProject"/> + <and> + <instanceof value="org.eclipse.ui.IFileEditorInput"/> + <adapt type="org.eclipse.core.resources.IResource"> + <adapt type="org.eclipse.cdt.core.model.ICElement"/> + </adapt> + </and> + </or> + <not> + <adapt type="org.eclipse.core.resources.IResource"> + <test + property="org.eclipse.core.resources.projectNature" + value="org.tizen.tizentest.nature"> + </test> + </adapt> + </not> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + <description + mode="profile" + description="Profile a Tizen Native application"/> + <configurationType + id="org.tizen.dynamicanalyzer.launchConfigurationType.da"> + </configurationType> + </shortcut> + </extension> + <extension + point="org.eclipse.debug.core.launchConfigurationTypes"> + <launchConfigurationType + delegate="org.tizen.dynamicanalysis.ide.eplugin.launch.TizenCppProfileDelegate" + id="org.tizen.dynamicanalyzer.launchConfigurationType.da" + name="Profile Tizen Native Application (config type)" + public="true"> + </launchConfigurationType> + </extension> + <extension + point="org.eclipse.debug.core.launchDelegates"> + <launchDelegate + delegate="org.tizen.dynamicanalysis.ide.eplugin.launch.TizenCppProfileDelegate" + id="org.tizen.dynamicanalyzer.launchDelegate.da" + modes="profile" + name="Profile Tizen Native Application (delegate)" + type="org.tizen.dynamicanalyzer.launchConfigurationType.da"> + </launchDelegate> + </extension> + <extension + point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + configTypeID="org.tizen.dynamicanalyzer.launchConfigurationType.da" + icon="icon/alt_window_16.png" + id="org.tizen.dynamicanalyzer.launchConfigurationTypeImage.da"> + </launchConfigurationTypeImage> + </extension> + +</plugin> diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java new file mode 100644 index 0000000..c5069bd --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java @@ -0,0 +1,59 @@ +/* +* Dynamic Analyzer +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* +* Jaweon Lim <jaewon81.lim@samsung.com> +* Juyoung Kim <j0.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.dynamicanalysis.ide.eplugin; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup; + +public class Activator implements BundleActivator { + public static final String PLUGIN_ID = "org.tizen.dynamicanalyzer"; + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + ServerStartup.stopServeThread(); + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/DALog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/DALog.java new file mode 100755 index 0000000..294fc3d --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/DALog.java @@ -0,0 +1,146 @@ +/* +* Dynamic Analyzer +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* +* Hyunjong Park <phjwithyou.park@samsung.com> +* Juyoung Kim <j0.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.dynamicanalysis.ide.eplugin; + +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.tizen.common.core.application.InstallPathConfig; + +public class DALog { + + private final static boolean LOG_TO_FILE = true; + + static File file = null; + static FileOutputStream fos = null; + static DataOutputStream dos = null; + static boolean setInit = false; + + + private static void init() { + try { + if (LOG_TO_FILE) { + StringBuffer logPath = new StringBuffer(); + logPath.append(InstallPathConfig.getUserDataPath()) + .append(File.separatorChar).append("dynamic-analyzer") + .append(File.separatorChar).append("logs"); + + File logs = new File(logPath.toString()); + if (!logs.exists()) { + logs.mkdir(); + } + + SimpleDateFormat format = new SimpleDateFormat( + "yyyy_MM_dd_HH-mm-ss", //$NON-NLS-1$ + Locale.KOREA); + Date date = new Date(); + String logFileName = "da_ide_log_" + format.format(date); + + logPath.append(File.separatorChar).append(logFileName); + + file = new File(logPath.toString()); + file.getParentFile().mkdirs(); + fos = new FileOutputStream(file); + dos = new DataOutputStream(fos); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void printLog( final String logMsg ) { + try { + if (LOG_TO_FILE) { + if (setInit == false) { + setInit = true; + init(); + } + dos.writeBytes( logMsg ); + dos.writeChars("\n"); + dos.flush(); + } else { + System.out.println(logMsg); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void printLog( Exception errMsg ) { + try { + if (LOG_TO_FILE) { + if (setInit == false) { + setInit = true; + init(); + } + dos.writeBytes( printStackTraceToString(errMsg) ); + dos.writeChars("\n"); + dos.flush(); + } else { + errMsg.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static String printStackTraceToString( Throwable e ) { + StringBuilder sb = new StringBuilder(); + try { + sb.append(e.toString()); + sb.append("\n"); + StackTraceElement element[] = e.getStackTrace(); + for (int idx = 0; idx < element.length; idx++) { + sb.append("\tat "); + sb.append(element[idx].toString()); + sb.append("\n"); + } + } catch (Exception ex) { + return e.toString(); + } + return sb.toString(); + } + + public static void dlgErrorMessage( final String title, final String message ) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + MessageDialog.openError(window.getShell(), title, message); + } + }); + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java new file mode 100644 index 0000000..00811f1 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java @@ -0,0 +1,377 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Jaewon Lim <jaewon81.lim@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.dynamicanalysis.ide.eplugin.communication; + +import java.io.BufferedWriter; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.RandomAccessFile; +import java.net.ServerSocket; +import java.net.Socket; +import java.nio.channels.FileChannel; + +import org.eclipse.ui.PlatformUI; +import org.tizen.common.core.application.InstallPathConfig; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; +import org.tizen.dynamicanalysis.ide.eplugin.launchshortcut.TizenCppApplicationProfileShortcut; + +public class DAServerManager extends Thread { + final int MAXBUFSIZE = 1024; + + private int port = 0; + private static DAServerManager _instance; + + private ServerSocket serverSocket = null; + private static Socket clientSocket = null; + private static BufferedWriter writer = null; + private static boolean reservedTraceApplication = false; + + private static String reservedDeviceName = ""; //$NON-NLS-1$ + private static String reservedApplicationName = ""; //$NON-NLS-1$ + + private final static String IDE_DA_COMMUNICATION_TYPE_1 = "STATUS"; //$NON-NLS-1$ + private final static String IDE_DA_COMMUNICATION_TYPE_2 = "RUN"; //$NON-NLS-1$ + private final static String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE"; //$NON-NLS-1$ + + private final static String IDE_DA_COMMUNICATION_SEPARATOR = "`,"; //$NON-NLS-1$ + private final static String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record"; + private final static String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop"; + + private final static String DANAIC_ANALYZER = "dynamic-analyzer"; //$NON-NLS-1$ + private final static String SAVE = "save"; //$NON-NLS-1$ + private final static String ACTIVE_DA_PLUGIN = "active_da_plugin"; //$NON-NLS-1$ + private final static String CURRENT_ACTIVE_IDE_PORT = "current_active_ide_port"; //$NON-NLS-1$ + + public static DAServerManager getInstance() { + if (_instance == null) { + _instance = new DAServerManager(); + } + return _instance; + } + + static public Socket getClientSocket() { + return clientSocket; + } + + public static void reserveTraceApplication(final String deviceName, + final String appName) { + reservedTraceApplication = true; + reservedDeviceName = deviceName; + reservedApplicationName = appName; + } + + // main + public void run() throws IndexOutOfBoundsException { + if (checkInstalledTizenSDK() != true) { + DALog.printLog("failed - Tizen SDK is not installed "); + } else { + while ( true ) { + try { + closeServerSokcet(); + // Server Bind + serverSocket = setServePort(); + if (serverSocket != null) { + + // Save Server port + if (savePortFile() != true) { + DALog.printLog("failed Save Server port"); + continue; + } + + // Set Active IDE to File + if (setActiveDAPlugin() != true) { + DALog.printLog("failed Set Active IDE to File "); + continue; + } + // Communication IDE - DA + while (true) { + closeClientSokcet(); + try { + DALog.printLog("Waiting DA"); + clientSocket = serverSocket.accept(); + DALog.printLog("Conneced DA"); + } catch (IOException e) { + e.printStackTrace(); + break; + } + + checkReservedTraceApplication(); + + // Waiting Receive Message + waitingDataReceive(); + DALog.printLog("Disconneced DA"); + } + + } else { + DALog.printLog("failed Server Bind "); + } + Thread.sleep(50); + } catch (InterruptedException e) { + DALog.printLog("InterruptedException"); + break; + } + } + } + } + + private boolean checkInstalledTizenSDK(){ + String installPath = InstallPathConfig.getUserDataPath(); + File logs = new File(installPath.toString()); + if (!logs.exists()) { + return false; + } + return true; + } + + private void checkReservedTraceApplication() { + if (reservedTraceApplication == true) { + reservedTraceApplication = false; + runTraceApplication(reservedDeviceName, reservedApplicationName); + } + } + + private void waitingDataReceive() { + + int dataSize = 0; + try { + InputStream in = clientSocket.getInputStream(); + while (true) { + byte arr[] = new byte[MAXBUFSIZE]; + + dataSize = in.read(arr); // Waiting Receive Message From DA + if (dataSize > 0) { + String msg = new String(arr); + commandReceiveMessage(msg); + arr = null; + } else { + break; + } + } + } catch (IOException e) { + DALog.printLog(e); + } + } + + // Find Available Port, Save Current Port, Set Active DA_Plugin + private ServerSocket setServePort() { + ServerSocket serverSocket = null; + serverSocket = getServerSocket(0); + if (serverSocket != null) { + port = serverSocket.getLocalPort(); + DALog.printLog("IDE port " + port); + + return serverSocket; + } + DALog.printLog("failed Set Serve Socket"); + return serverSocket; + } + + // Find Available Port + private ServerSocket getServerSocket(final int port) { + ServerSocket serverSocket = null; + try { + serverSocket = new ServerSocket(0); + } catch (IOException e) { + serverSocket = null; + } + return serverSocket; + } + + // Save Current Port + private boolean savePortFile() { + boolean bSuccess = true; + try { + StringBuffer savePath = new StringBuffer(); + savePath.append(InstallPathConfig.getUserDataPath()) + .append(File.separatorChar).append(DANAIC_ANALYZER) + .append(File.separatorChar).append(SAVE); + + File logs = new File(savePath.toString()); + if (!logs.exists()) { + logs.mkdir(); + } + + savePath.append(File.separatorChar).append(CURRENT_ACTIVE_IDE_PORT); + + File file = new File(savePath.toString()); + FileOutputStream fos = null; + + fos = new FileOutputStream(file); + + DataOutputStream dos = new DataOutputStream(fos); + dos.writeInt(port); + dos.flush(); + bSuccess = true; + + } catch (FileNotFoundException e) { + bSuccess = false; + DALog.printLog(e); + } catch (IOException e) { + bSuccess = false; + DALog.printLog(e); + } + return bSuccess; + } + + // Set Active DA_Plugin + private boolean setActiveDAPlugin() { + File file = null; + FileChannel fchannel = null; + try { + StringBuffer savePortPath = new StringBuffer(); + savePortPath.append(InstallPathConfig.getUserDataPath()) + .append(File.separatorChar).append(DANAIC_ANALYZER) + .append(File.separatorChar).append(SAVE) + .append(File.separatorChar).append(ACTIVE_DA_PLUGIN); + + file = new File(savePortPath.toString()); + fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$ + fchannel.tryLock(); + return true; + } catch (Exception e) { + return true; + } + } + + // Send Message DA Status + public static void sendDAStatusMessage() { + StringBuffer command = new StringBuffer(); + command.append(IDE_DA_COMMUNICATION_TYPE_1) + .append(IDE_DA_COMMUNICATION_SEPARATOR) + .append("").append(IDE_DA_COMMUNICATION_SEPARATOR)//$NON-NLS-1$ + .append("");//$NON-NLS-1$ + try { + sendData(command.toString()); + } catch (IOException e) { + DALog.printLog(e); + DALog.dlgErrorMessage("Error", "Fail to launch project");//$NON-NLS-1$ + } + } + + // Send Message Trace Application + public static void runTraceApplication(final String strDevice, + final String appName) { + StringBuffer command = new StringBuffer(); + command.append(IDE_DA_COMMUNICATION_TYPE_2) + .append(IDE_DA_COMMUNICATION_SEPARATOR).append(strDevice) + .append(IDE_DA_COMMUNICATION_SEPARATOR).append(appName); + try { + DAServerManager.sendData(command.toString()); + } catch (IOException e) { + DALog.printLog(e); + DALog.dlgErrorMessage("Error", "Fail to launch project");//$NON-NLS-1$ + } + } + + // Management Receive Message + public static void commandReceiveMessage(final String msg) { + DALog.printLog("commandReceiveMessage : " + msg); + String[] msgArray = msg.split(IDE_DA_COMMUNICATION_SEPARATOR); + int size = msgArray.length; + if (size == 3) { + if (msgArray[0].equals(IDE_DA_COMMUNICATION_TYPE_1)) { + setDAStatus(msgArray); + } else if (msgArray[0].equals(IDE_DA_COMMUNICATION_TYPE_3)) { + viewSouceLine(msgArray); + } else { + DALog.printLog("receive message is not valid type"); + } + } else { + DALog.printLog("receive message is not valid "); + } + } + + public static void setDAStatus(final String[] msgArray) { // DA Status + if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_RECORD)) { + TizenCppApplicationProfileShortcut.setStatusTraceDA(true); + } else if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_STOP)) { + TizenCppApplicationProfileShortcut.setStatusTraceDA(false); + } else { + DALog.printLog("receive message is not valid"); + } + } + + public static void viewSouceLine(final String[] msgArray) { + String srcpath = msgArray[1]; + String strSourceLine = msgArray[2].trim(); + int nline = Integer.parseInt(strSourceLine); + Thread thread = new Thread(new OpenEditManager(srcpath, nline)); + PlatformUI.getWorkbench().getDisplay().asyncExec(thread); + } + + public static boolean sendData(final String msg) throws IOException { + DALog.printLog("SendData " + msg); + boolean bSuccess = true; + try { + if (null != clientSocket) { + writer = new BufferedWriter(new OutputStreamWriter( + clientSocket.getOutputStream())); + writer.write(msg); + writer.flush(); + } + } catch (IOException e) { + bSuccess = false; + } finally { + bSuccess = false; + } + return bSuccess; + } + + private void closeServerSokcet() { + if (null != serverSocket) { + try { + serverSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } + serverSocket = null; + } + } + + private void closeClientSokcet() { + if (null != writer) { + try { + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + writer = null; + } + if (null != clientSocket) { + try { + clientSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } + clientSocket = null; + } + } + +}
\ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/FocusManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/FocusManager.java new file mode 100644 index 0000000..9dfeb56 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/FocusManager.java @@ -0,0 +1,118 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * + * Jaweon Lim <jaewon81.lim@samsung.com> + * Juyoung Kim <j0.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.dynamicanalysis.ide.eplugin.communication; + +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; + +import org.tizen.common.core.application.InstallPathConfig; +import org.tizen.common.util.OSChecker; +import org.tizen.common.util.log.Logger; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; + +public class FocusManager extends Thread { + private String[] cmds; + + private int selfPid; + + public FocusManager() { + selfPid = -1; + } + + public FocusManager(final int iPid) { + selfPid = iPid; + } + + public void run() { + String pid = "";//$NON-NLS-1$ + String Processid = "";//$NON-NLS-1$ + + if (selfPid > 0) { + pid = String.valueOf(selfPid); + } else { + // get IDE pid. + ManagementFactory.getRuntimeMXBean(); + RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean(); + Processid = rt.getName(); + pid = Processid.substring(0, Processid.indexOf("@")); //$NON-NLS-1$ + } + + if (OSChecker.isWindows()) { + cmds = new String[] { getDynAnalyzerPath(), pid }; + } else { + cmds = new String[] { getDynAnalyzerPath(), pid }; + } + executeCommand(cmds); + } + + private String getDynAnalyzerPath() { + String path =""; + if (OSChecker.isWindows()) { + path = InstallPathConfig.getSDKPath() + + "/tools/dynamic-analyzer/tool/windowactivator.bat";//$NON-NLS-1$ + } else if ( OSChecker.isMAC()){ + path = InstallPathConfig.getSDKPath() + + "/tools/dynamic-analyzer/tool/macoswindowactivator.sh";//$NON-NLS-1$ + }else{ + path = InstallPathConfig.getSDKPath() + + "/tools/dynamic-analyzer/tool/windowactivator.sh";//$NON-NLS-1$ + } + DALog.printLog("activator : " + path); + return path; + } + + private int executeCommand(final String[] cmds) { + + Runtime runtime = null; + Process process = null; + int retValue = 0; + + try { + if (cmds.length == 0) { + retValue = -1; + } else { + runtime = Runtime.getRuntime(); + process = runtime.exec(cmds); + + if (process != null) { + process.waitFor(); + retValue = process.exitValue(); + } + } + } catch (IOException e) { + Logger.error(e.getMessage(), e); + } catch (InterruptedException e) { + Logger.error(e.getMessage(), e); + } finally { + if (process != null) { + process.destroy(); + } + } + return retValue; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java new file mode 100644 index 0000000..687b8bc --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/OpenEditManager.java @@ -0,0 +1,152 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Jaewon Lim <jaewon81.lim@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.dynamicanalysis.ide.eplugin.communication; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.texteditor.IDocumentProvider; +import org.eclipse.ui.texteditor.ITextEditor; + +import org.tizen.dynamicanalysis.ide.eplugin.DALog; + +public class OpenEditManager implements Runnable +{ + private ITextEditor _editor; + private IDocument _document; + private String filepath; + private int fileline; + + public OpenEditManager(String path, int line) + { + this.filepath = path; + this.fileline = line; + } + + private void initEditor( final String path ) throws IOException + { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile ifile = root.getFile(new Path(path)); + IEditorPart part = null; + + if (!ifile.exists()) + { + File targetfile = new File(path); + if(targetfile.exists() && targetfile.isFile()) + { + IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI()); + part = openEditor(filestore); + } + else + { + throw new IOException("Source file (" + path + ") is not found."); + } + } + else + { + part = openEditor(ifile); + } + + if(part != null && (part instanceof ITextEditor)) + { + _editor = (ITextEditor)part; + IDocumentProvider provider = _editor.getDocumentProvider(); + _document = provider.getDocument(_editor.getEditorInput()); + + } + } + + private IEditorPart openEditor(final IFile ifile) + { + //editor open + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditor(page, ifile); + } catch ( Exception e ) { + DALog.printLog(e); + } + + return page.getActiveEditor(); + } + + private IEditorPart openEditor(final IFileStore ifilestr) + { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditorOnFileStore(page, ifilestr); + } catch ( Exception e ) { + DALog.printLog(e); + } + + return page.getActiveEditor(); + } + + private ITextEditor getEditor() + { + return _editor; + } + + public void run(){ + try + { + int offset; + initEditor(this.filepath); + if(this.fileline > 0) + { + offset = _document.getLineOffset(this.fileline - 1); + } + else + { + offset = 0; + } + getEditor().setHighlightRange(offset, 0, true); //move cursor + + FocusManager fm = new FocusManager(); + fm.start(); + } + catch (IOException e) + { + DALog.printLog(e); + } + catch (BadLocationException e) + { + DALog.printLog(e); + } + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/ServerStartup.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/ServerStartup.java new file mode 100644 index 0000000..48b60fe --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/communication/ServerStartup.java @@ -0,0 +1,51 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Jaewon Lim <jaewon81.lim@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.dynamicanalysis.ide.eplugin.communication; + + + +import org.eclipse.ui.IStartup; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; + +public class ServerStartup implements IStartup { + + private static DAServerManager server; + + @Override + public void earlyStartup() { + // TODO Auto-generated method stub + server = DAServerManager.getInstance(); + try{ + Thread thread = server; + thread.start(); + } catch(Exception e){ + DALog.printLog( e ); + } + } + + public static void stopServeThread() { + server.interrupt(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/DynamicOptionValueHandler.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/DynamicOptionValueHandler.java new file mode 100644 index 0000000..c7ec5b2 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/DynamicOptionValueHandler.java @@ -0,0 +1,92 @@ +/* +* NativeApp +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@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.dynamicanalysis.ide.eplugin.launch; + +import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; +import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler; +import org.eclipse.cdt.managedbuilder.core.IOption; +import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo; +import org.tizen.nativecommon.build.CommonConfigurationManager; + +public class DynamicOptionValueHandler implements IManagedOptionValueHandler { + + @Override + public boolean handleValue(IBuildObject configuration, + IHoldsOptions holder, IOption option, String extraArgument, + int event) { + + IConfiguration config = null; + + // handle just APPLY + if (event != IManagedOptionValueHandler.EVENT_OPEN && + event != IManagedOptionValueHandler.EVENT_APPLY) + return false; + + if (configuration instanceof FolderInfo) { + return false; + } else { + config = (IConfiguration) configuration; + } + String linklib = "daprobe";//$NON-NLS-1$ + String customchartSymbol = "_USE_DA_"; //$NON-NLS-1$ + String libPath = "\"${SDK_INSTALL_PATH}/library/da";//$NON-NLS-1$ + if (configuration.getName().contains("Device")) {//$NON-NLS-1$ + libPath = libPath + "/arm\"";//$NON-NLS-1$ + } else if (configuration.getName().contains("Emulator")) {//$NON-NLS-1$ + libPath = libPath + "/x86\"";//$NON-NLS-1$ + } + + String includePath = "\"${SDK_INSTALL_PATH}/library\"";//$NON-NLS-1$ + CommonConfigurationManager.appendIncludePathToCompiler(config, includePath); + CommonConfigurationManager.appendLibraryToLinker(config, linklib); + CommonConfigurationManager.appendLinkPathsToLinker(config, libPath); + CommonConfigurationManager.appendPreprocessorSymbolToCompiler(config, customchartSymbol); + + return false; + } + + @Override + public boolean isDefaultValue(IBuildObject configuration, + IHoldsOptions holder, IOption option, String extraArgument) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isEnumValueAppropriate(IBuildObject configuration, + IHoldsOptions holder, IOption option, String extraArgument, + String enumValue) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenCppProfileDelegate.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenCppProfileDelegate.java new file mode 100644 index 0000000..4e41773 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenCppProfileDelegate.java @@ -0,0 +1,18 @@ +package org.tizen.dynamicanalysis.ide.eplugin.launch; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; + +public class TizenCppProfileDelegate implements ILaunchConfigurationDelegate { + + public TizenCppProfileDelegate() { + } + + @Override + public void launch(ILaunchConfiguration configuration, String mode, + ILaunch launch, IProgressMonitor monitor) throws CoreException { + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launchshortcut/TizenCppApplicationProfileShortcut.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launchshortcut/TizenCppApplicationProfileShortcut.java new file mode 100755 index 0000000..b1f06ac --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalysis/ide/eplugin/launchshortcut/TizenCppApplicationProfileShortcut.java @@ -0,0 +1,547 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Sanghyun Lee <sanghyunnim.lee@samsung.com> + * Hyunjong Park <phjwithyou.park@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.dynamicanalysis.ide.eplugin.launchshortcut; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.lang.reflect.InvocationTargetException; +import java.nio.channels.FileChannel; + +import org.eclipse.cdt.core.model.ICModelMarker; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +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.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.ui.ILaunchShortcut; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.tizen.common.TizenPlatformConstants; +import org.tizen.common.connection.ConnectionPlugin; +import org.tizen.common.core.application.InstallPathConfig; +import org.tizen.common.util.HostUtil; +import org.tizen.common.util.OSChecker; +import org.tizen.dynamicanalysis.ide.eplugin.Activator; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; +import org.tizen.dynamicanalysis.ide.eplugin.communication.DAServerManager; +import org.tizen.common.IApplicationConfiguration; +import org.tizen.nativecommon.ProjectUtil; +import org.tizen.nativecommon.TizenNativeException; +import org.tizen.nativecommon.build.CheckCancelJob; +import org.tizen.nativecommon.build.CommonBuildMessages; +import org.tizen.nativecommon.build.CommonProjectDependentBuilder; +import org.tizen.nativecommon.build.CommonProjectDependentPackager; +import org.tizen.nativecommon.build.ProjectTypeManager; +import org.tizen.nativecommon.build.exception.SBIException; +import org.tizen.nativecommon.launch.IProjectLaunchCommand; +import org.tizen.nativecommon.launch.TizenLaunchCommand; +import org.tizen.nativecommon.launch.TizenLaunchMessages; +import org.tizen.nativecommon.ui.actions.ConfigurationActionManager; +import org.tizen.sdblib.IDevice; +import org.tizen.sdblib.SyncService; +import org.tizen.sdblib.SyncService.SyncResult; + +public class TizenCppApplicationProfileShortcut implements ILaunchShortcut { + private final String CONFIG_NAME_EMULATOR = "DA-Tizen-Emulator"; + private final String CONFIG_NAME_DEVICE = "DA-Tizen-Device"; + static boolean bDAPlay = false; + static int bWaitReceiveDataCount = 100; + + private IProject project = null; + private IDevice currentDevice = null; + private String prevBuildConfiguration = null; + + private StringBuffer strProjectDAProvePath = null; + private StringBuffer strSDKDAProbePath = null; + + private boolean bSuccessBuild = true; + + private class ExtFilter implements FilenameFilter { + protected String ext; + + public ExtFilter(String ext) { + this.ext = ext; + } + public boolean accept(File dir, String name) { + return name.endsWith(ext); + } + } + + @Override + public void launch(ISelection selection, String mode) { + IResource resource = (IResource) ((IStructuredSelection) selection).getFirstElement(); + project = resource.getProject(); + profileManager(); + } + + @Override + public void launch(IEditorPart editor, String mode) { + IFileEditorInput input = (IFileEditorInput) editor.getEditorInput(); + project = input.getFile().getProject(); + profileManager(); + } + + private boolean profileManager() { + currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); // Active Emulator + if (currentDevice == null) { + DALog.dlgErrorMessage("Error", + TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE); + } else { + bWaitReceiveDataCount = 200; + if (DAServerManager.getClientSocket() != null) { + DAServerManager.sendDAStatusMessage(); + + while (bWaitReceiveDataCount > 0) { // Waiting DA Status + // Message during 2sec + try { + Thread.sleep(10); + } catch (InterruptedException e) { + DALog.printLog(e); + } + bWaitReceiveDataCount--; + } + if (bDAPlay == false) { // DA Stop Status + profileWithDA(); + } + } else { // DA Disconnect Status + profileWithDA(); + } + } + return true; + } + + // Call From DataReceiver.java when get receive data + private void profileWithDA() { + boolean bSuccessCopyProbe = false; + bSuccessCopyProbe = copyDAProbeFile(); + if (bSuccessCopyProbe == false) { + DALog.dlgErrorMessage("Error", "Fail to copy daprobe");//$NON-NLS-1$ + } + + profileWithDABuild(); + + if (prevBuildConfiguration != null) { + ManagedBuildManager.getBuildInfo(project).setDefaultConfiguration( + prevBuildConfiguration); + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + ConfigurationActionManager + .notifyConfigurationSelectionChangedListener(prevBuildConfiguration); + } + }); + prevBuildConfiguration = null; + } + + if (bSuccessCopyProbe == true) { + if (deleteDAProbeFile() == false) { + DALog.dlgErrorMessage("Error", "Fail to delete daprobe");//$NON-NLS-1$ + } + } + if (bSuccessBuild == true ) { + if (profileWithDALaunch() == false) { + DALog.dlgErrorMessage("Error", "Fail to launch project");//$NON-NLS-1$ + } + } + + } + + private boolean copyDAProbeFile(){ + + CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project); + strProjectDAProvePath = new StringBuffer(); + strProjectDAProvePath.append( builder.getProjectPath()).append(File.separatorChar).append("lib").append(File.separatorChar).append("libdaprobe.so"); //$NON-NLS-1$ + + strSDKDAProbePath = new StringBuffer(); + strSDKDAProbePath.append( InstallPathConfig.getSDKPath()).append(File.separatorChar).append("library").append(File.separatorChar).append("da").append(File.separatorChar);//$NON-NLS-1$ + + + if (currentDevice.isEmulator()) { + strSDKDAProbePath.append("x86").append(File.separatorChar);//$NON-NLS-1$ + } else { + strSDKDAProbePath.append("arm").append(File.separatorChar);//$NON-NLS-1$ + } + strSDKDAProbePath.append("libdaprobe.so");//$NON-NLS-1$ + + try{ + File inFile = new File(strSDKDAProbePath.toString()); + FileInputStream inputStream = new FileInputStream( inFile ); + + File outFile = new File(strProjectDAProvePath.toString()); + FileOutputStream outputStream = new FileOutputStream( outFile ); + + FileChannel fcin = inputStream.getChannel(); + FileChannel fcout = outputStream.getChannel(); + + long size = fcin.size(); + fcin.transferTo(0, size, fcout ); + + fcout.close(); + fcin.close(); + + outputStream.close(); + inputStream.close(); + return true; + + }catch(Exception e){ + DALog.printLog(e); + return false; + } + } + private boolean deleteDAProbeFile() { + try { + File deleteFile = new File(strProjectDAProvePath.toString()); + deleteFile.delete(); + return true; + } catch (Exception e) { + DALog.printLog(e); + return false; + } + } + + private void profileWithDABuild(){ + + bSuccessBuild = true; + final String pkgType = CommonProjectDependentPackager.DEFAULT; + + final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @SuppressWarnings("deprecation") + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + try { + monitor.beginTask("Preparing profile...", 1);//$NON-NLS-1$ + if (verifyDeviceReachability(currentDevice, project)) { + monitor.done(); + DALog.dlgErrorMessage("Error", "Fail to build project");//$NON-NLS-1$ + bSuccessBuild = false; + return; + } + + IProjectLaunchCommand manifest = null; + + // + // package build + // + final String configName; + IStatus status = null; + if (currentDevice.isEmulator()) { + configName = CONFIG_NAME_EMULATOR; + } else { + configName = CONFIG_NAME_DEVICE; + } + prevBuildConfiguration = ManagedBuildManager.getBuildInfo(project).getConfigurationName(); + ManagedBuildManager.getBuildInfo(project).setDefaultConfiguration(configName); + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + ConfigurationActionManager.notifyConfigurationSelectionChangedListener(configName); + } + }); + + CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project); + CheckCancelJob cancelJob = new CheckCancelJob(monitor, project, packager.getSbi(), false); + + try { + project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor ); + monitor.beginTask("Preparing profile...", 3);//$NON-NLS-1$ + monitor.subTask("Building package...");//$NON-NLS-1$ + + IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); + for (int i = 0; i < markers.length; i++) { + IMarker marker = markers[i]; + int priority = marker.getAttribute(IMarker.SEVERITY, -1); + if (priority == IMarker.SEVERITY_ERROR) { + monitor.done(); + bSuccessBuild = false; + DALog.dlgErrorMessage("Error", "Fail to build project");//$NON-NLS-1$ + return; + } + } + manifest = ProjectUtil.getProjectManifest(project); + manifest.doMultiAppPreProcess(packager, monitor); + Thread checkCancelThread = new Thread(cancelJob); + checkCancelThread.start(); + + packager.buildPackage(pkgType); + + cancelJob.setFinishFlag(true); + } catch (SBIException e) { + DALog.printLog(e); + status = new Status(Status.ERROR, Activator.PLUGIN_ID, CommonBuildMessages.FAIL_TO_BUILD_PACKAGE); + cancelJob.setFinishFlag(true); + monitor.done(); + DALog.dlgErrorMessage("Error", "Fail to build project");//$NON-NLS-1$ + bSuccessBuild = false; + return; + } catch (CoreException e) { + DALog.printLog(e); + status = new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage()); + cancelJob.setFinishFlag(true); + monitor.done(); + DALog.dlgErrorMessage("Error", "Fail to build project");//$NON-NLS-1$ + bSuccessBuild = false; + return; + } + + + + if (packager.checkPackageFile(pkgType)) { + status = new Status(Status.OK, Activator.PLUGIN_ID, CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE); + } else { + monitor.done(); + status = new Status(Status.ERROR, Activator.PLUGIN_ID, CommonBuildMessages.FAIL_TO_BUILD_PACKAGE); + DALog.dlgErrorMessage(CommonBuildMessages.BUILD_RESULT, status.getMessage()); + bSuccessBuild = false; + return; + } + // + // app upload + // + File packageFile = null; + try { + monitor.worked(2); + monitor.subTask(TizenLaunchMessages.TRANSFER_PACKAGE); + + String packageDirectory = File.separatorChar + configName + File.separatorChar; + IPath packagePath = new Path(project.getLocation().toString() + packageDirectory); + packageFile = findPackageFile(packagePath.toFile(), "." + pkgType.toLowerCase(), project); + if (packageFile == null) { + newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null); + } + + String destDirectoryPath = TizenPlatformConstants.TEMPORARY_PKG_PATH; + + String srcFilePath = packageFile.getAbsoluteFile().getCanonicalPath(); + String destFilePath = destDirectoryPath + packageFile.getAbsoluteFile().getName(); + + SyncResult syncSuccess = currentDevice.getSyncService().pushFile(srcFilePath, destFilePath, + SyncService.getNullProgressMonitor()); + + if (syncSuccess.getCode() != SyncService.RESULT_OK) { + newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null); + } + } catch (CoreException e) { + monitor.done(); + // FIXME + DALog.dlgErrorMessage("Error", TizenLaunchMessages.CANNOT_TRANSFER_FILE);//$NON-NLS-1$ + bSuccessBuild = false; + return; + } catch (Exception e) { + monitor.done(); + // FIXME + DALog.dlgErrorMessage("Error", TizenLaunchMessages.CANNOT_TRANSFER_FILE);//$NON-NLS-1$ + bSuccessBuild = false; + return; + } + + // + // app install + // + try { + monitor.worked(1); + monitor.subTask(TizenLaunchMessages.INSTALL_PACKAGE); + + // check old application + String packageName = manifest.getPackageName(); + String listCmd = manifest.getListCommand(); + String listCmdRet = manifest.getListCommandResult(); + TizenLaunchCommand launcher = new TizenLaunchCommand(currentDevice); + launcher.run(listCmd); + + if (launcher.getEndLine().contains(listCmdRet)) { + // remove old application + String removeCmd = manifest.getRemoveCommand(packageName); + + try { + launcher.run(removeCmd); + // TODO: Uninstalling rpm is ad-hoc. It + // should + // be automatically done by pkgcmd -u. + } catch (TizenNativeException e) { + // FIXME & TODO : what if package is not + // removed? + DALog.dlgErrorMessage("Error", TizenLaunchMessages.CANNOT_INSTALL);//$NON-NLS-1$ + bSuccessBuild = false; + } + } + + String installCmd = manifest.getInstallCommand(packageFile, pkgType.toLowerCase()); + launcher.run(installCmd); + } catch (CoreException e) { + monitor.done(); + // FIXME + DALog.dlgErrorMessage("Error", TizenLaunchMessages.CANNOT_INSTALL);//$NON-NLS-1$ + bSuccessBuild = false; + return; + } catch (Exception e) { + monitor.done(); + // FIXME + DALog.dlgErrorMessage("Error", TizenLaunchMessages.CANNOT_INSTALL);//$NON-NLS-1$ + bSuccessBuild = false; + return; + } + + monitor.done(); + + } finally { + + } + } + }); + } catch (Exception e) { + DALog.printLog(e); + DALog.dlgErrorMessage("Error", "Fail to build project");//$NON-NLS-1$ + bSuccessBuild = false; + } + } + + private boolean profileWithDALaunch() { + + if (DAServerManager.getClientSocket() == null) { // Disconnect DA + runDynamicAlanyzer(); + DAServerManager.reserveTraceApplication(currentDevice.toString(),getDesktopName()); + } else { // Connected DA + DAServerManager.runTraceApplication(currentDevice.toString(),getDesktopName()); + } + return true; + } + + private boolean runDynamicAlanyzer(){ + StringBuffer command = new StringBuffer(); + command.append( InstallPathConfig.getSDKPath() + File.separatorChar + "tools" + File.separator + "dynamic-analyzer" +File.separatorChar + "dynamic-analyzer"); + if (OSChecker.isWindows()) { + command.append( ".exe" );//$NON-NLS-1$ + } + File file = new File( command.toString() ); // Exist DA file + if (file.isFile() == false) { + DALog.dlgErrorMessage("Error", "Dynamic Analyzer is not installed."); + } else { + if (OSChecker.isWindows()) { + if ( executeWindowsCommand(command.toString())== false ){ + return false; + } + } else { + command.append( " &");//$NON-NLS-1$ + HostUtil.execute(command.toString()); + } + } + return true; + } + + private File findPackageFile( final File searchPath, final String ext, IProject project) { + + File[] packageFiles = searchPath.listFiles( new ExtFilter(ext) ); + + if (packageFiles == null || packageFiles.length == 0) { + return null; + } + + IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project); + String packageName = manifest.getPackageName(); + if (packageName == null) { + return null; + } + + for (File file : packageFiles) { + String fileName = file.getName(); + if (fileName.contains(packageName)) { + return file; + } + } + + return null; + } + + private static void newCoreException( final String message, Throwable exception) throws CoreException { + Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception); + throw new CoreException(status); + } + + + private static boolean executeWindowsCommand( final String command ) { + if (command == null) { + return false; + } + Process proc = null; + Runtime runtime = Runtime.getRuntime(); + + String[] fullCommand = new String[] { "cmd", "/c", command };//$NON-NLS-1$ + + int i = 0; + try { + proc = runtime.exec(fullCommand); + Thread.sleep(1000); + } catch (Exception e) { + DALog.printLog(e); + return false; + } finally { + if (proc != null) + proc.destroy(); + } + + return i == 0; + } + + private String getDesktopName(){ + IApplicationConfiguration adapter = (IApplicationConfiguration)project.getAdapter(IApplicationConfiguration.class); + String appId = adapter.getAppId(); + String binaryName = adapter.getBinaryName().split(".exe")[0]; + + return appId + "#" + binaryName; + } + + private boolean verifyDeviceReachability(IDevice currentDevice, IProject project) { + if (currentDevice == null || currentDevice.isOffline()) { + return true; + } + return false; + } + + public static void setStatusTraceDA( final boolean bStatus ){ + bDAPlay = bStatus; + + } +}
\ No newline at end of file diff --git a/package/build.linux b/package/build.linux new file mode 100755 index 0000000..6b67ea5 --- /dev/null +++ b/package/build.linux @@ -0,0 +1,87 @@ +#!/bin/bash -xe + +__copy_necessary_binaries() +{ + echo "add necessary files." + ## ex) + ## ide_root_path_name=IDE + ## cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/ +} + +__set_parameter() +{ + case ${TARGET_OS} in + ubuntu-32|ubuntu-64) + pde_path=${ROOTDIR}/indigo-pde + ;; + windows-32|windows-64) + pde_path=${ROOTDIR}/indigo-winpde + ;; + macos-64) + pde_path=${ROOTDIR}/indigo-macpde + ;; + *) + echo "${TARGET_OS} is not support yet." + exit 1 + ;; + esac + + build_script_path=${pde_path}/pde_build +} + +# clean +clean() +{ + echo "=========================================CLEAN============================================" + __set_parameter + ${build_script_path}/clean.sh ${package_name} +} + +# build +build() +{ + echo "=========================================BUILD============================================" + pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'` + for pkgname_and_platform in ${pkgname_and_platform_list} + do + pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '` + package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"` + platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"` + + if [ "x${TARGET_OS}" = "x${platform}" ] + then + __set_parameter + ${build_script_path}/build.sh ${package_name} + else + echo "" + fi + done +} + +# install +install() +{ + pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'` + for pkgname_and_platform in ${pkgname_and_platform_list} + do + echo "=========================================INSTALL============================================" + pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '` + package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"` + platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"` + + if [ "x${TARGET_OS}" = "x${platform}" ] + then + __set_parameter + INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${TARGET_OS}/data + mkdir -p ${INSTALL_DIR} + __copy_necessary_binaries + ${build_script_path}/install.sh ${package_name} + else + echo "" + fi + done +} + +[ "$1" = "clean" ] && clean +[ "$1" = "build" ] && build +[ "$1" = "install" ] && install diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest new file mode 100644 index 0000000..e2eed8f --- /dev/null +++ b/package/pkginfo.manifest @@ -0,0 +1,39 @@ +Version:1.0.1 +Source:dynamic-analysis-ide-eplugin +Maintainer:Juyoung Kim <j0.kim@samsung.com>, Sanghyun Lee <sanghyunnim.lee@samsung.com> + +Package:dynamic-analysis-ide-eplugin +OS:ubuntu-32 +Build-host-os:ubuntu-32 +Build-dependency:indigo-pde [ubuntu-32], base-ide-product [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32], nativeappcommon-eplugin [ubuntu-32], nativecpp-eplugin [ubuntu-32] +Install-dependency:base-ide-product [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32], nativeappcommon-eplugin [ubuntu-32], nativecpp-eplugin [ubuntu-32] +Description:Native cpp extension plugin + +Package:dynamic-analysis-ide-eplugin +OS:windows-32 +Build-host-os:ubuntu-32 +Build-dependency:indigo-winpde [windows-32], base-ide-product [windows-32], common-eplugin [windows-32], nativecommon-eplugin [windows-32], nativeappcommon-eplugin [windows-32], nativecpp-eplugin [windows-32] +Install-dependency:base-ide-product [windows-32], common-eplugin [windows-32], nativecommon-eplugin [windows-32], nativeappcommon-eplugin [windows-32], nativecpp-eplugin [windows-32] +Description:Native cpp extension plugin + +Package:dynamic-analysis-ide-eplugin +OS:ubuntu-64 +Build-host-os:ubuntu-32 +Build-dependency:indigo-pde [ubuntu-64], base-ide-product [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-64], nativecpp-eplugin [ubuntu-64] +Install-dependency:base-ide-product [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-64], nativecpp-eplugin [ubuntu-64] +Description:Native cpp extension plugin + +Package:dynamic-analysis-ide-eplugin +OS:windows-64 +Build-host-os:ubuntu-32 +Build-dependency:indigo-winpde [windows-64], base-ide-product [windows-64], common-eplugin [windows-64], nativecommon-eplugin [windows-64], nativeappcommon-eplugin [windows-64], nativecpp-eplugin [windows-64] +Install-dependency:base-ide-product [windows-64], common-eplugin [windows-64], nativecommon-eplugin [windows-64], nativeappcommon-eplugin [windows-64], nativecpp-eplugin [windows-64] +Description:Native cpp extension plugin + +Package:dynamic-analysis-ide-eplugin +OS:macos-64 +Build-host-os:ubuntu-32 +Build-dependency:indigo-macpde [macos-64], base-ide-product [macos-64], common-eplugin [macos-64], nativecommon-eplugin [macos-64], nativeappcommon-eplugin [macos-64], nativecpp-eplugin [macos-64] +Install-dependency:base-ide-product [macos-64], common-eplugin [macos-64], nativecommon-eplugin [macos-64], nativeappcommon-eplugin [macos-64], nativecpp-eplugin [macos-64] +Description:Native cpp extension plugin + |