Skip to content

Commit

Permalink
[453701] Add support for Windows Phone 8 platform
Browse files Browse the repository at this point in the history
Initial support for Windows Phone 8 platform. It does not contain
Windows Phone 7.X support because this system is no longer supported. It
contains set of basic features to create, launch and export native wp8
applications. I have tried to avoid any 3rd party tools for accessing
Windows registry. In result, it uses reg command instead.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=453701
Change-Id: Ic0b6732e85bab0bf8845cbe1643b53a862815bfb
Signed-off-by: wgalanciak <[email protected]>
  • Loading branch information
wgalanciak committed Dec 1, 2014
1 parent 6363434 commit accf5d0
Show file tree
Hide file tree
Showing 44 changed files with 3,116 additions and 0 deletions.
16 changes: 16 additions & 0 deletions features/org.eclipse.thym.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,20 @@
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.thym.wp.core"
os="win32"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.thym.wp.ui"
os="win32"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
4 changes: 4 additions & 0 deletions plugins/org.eclipse.thym.core/res/platforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
'android' = {
download_url:'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.6.3;sf=tgz',
version: '3.6.3'
},
'wp8' = {
download_url:'https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git;a=snapshot;h=3.6.3;sf=tgz',
version: '3.6.3'
}
},
'3.5.0' = {
Expand Down
7 changes: 7 additions & 0 deletions plugins/org.eclipse.thym.wp.core/.classpath
Original file line number Diff line number Diff line change
@@ -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.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions plugins/org.eclipse.thym.wp.core/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.thym.wp.core</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>
19 changes: 19 additions & 0 deletions plugins/org.eclipse.thym.wp.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.thym.wp.core;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: org.eclipse.thym.wp.core.WPCore
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.thym.core,
org.eclipse.debug.core,
org.apache.commons.io;bundle-version="[2.0.0,2.1.0)"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-NativeCode: lib/x86/ICE_JNIRegistry.dll; selection-filter="(&(osgi.arch=x86)(osgi.os=win32))",

This comment has been minimized.

Copy link
@mickaelistria

mickaelistria Dec 2, 2014

Those libs aren't part of the commit. Is this expected? Is the license for those DLLs Eclipse-friendly?

lib/x86_64/ICE_JNIRegistry.dll; selection-filter="(&(osgi.arch=x86_64)(osgi.os=win32))", *
Export-Package: org.eclipse.thym.wp.core,
org.eclipse.thym.wp.core.vstudio
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Eclipse-PlatformFilter: (osgi.os=win32)
5 changes: 5 additions & 0 deletions plugins/org.eclipse.thym.wp.core/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
13 changes: 13 additions & 0 deletions plugins/org.eclipse.thym.wp.core/plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
###############################################################################
# Copyright (c) 2014 Zend Technologies Ltd.
# 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:
# Red Hat Inc. - initial API and implementation and/or initial documentation
# Zend Technologies Ltd. - initial implementation
###############################################################################
Bundle-Vendor = Eclipse.org - Thym
Bundle-Name = Hybrid Mobile App. Dev. Windows Phone 8 Core
32 changes: 32 additions & 0 deletions plugins/org.eclipse.thym.wp.core/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.thym.core.platformSupport">
<platform
id="org.eclipse.thym.wp.core.platformSupport"
libraryResolver="org.eclipse.thym.wp.core.WPLibraryResolver"
platform="Windows Phone 8 (Visual Studio)"
platformID="wp8"
pluginInstallActionFactory="org.eclipse.thym.wp.internal.core.vstudio.WPPluginInstallationActionsFactory"
projectGenerator="org.eclipse.thym.wp.internal.core.vstudio.WPProjectGenerator">
</platform>
</extension>
<extension
point="org.eclipse.thym.core.projectBuilder">
<builder
delegate="org.eclipse.thym.wp.core.vstudio.MSBuild"
id="org.eclipse.thym.wp.core.projectBuilder"
platform="Windows Phone 8 (Visual Studio)">
</builder>
</extension>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
delegate="org.eclipse.thym.wp.internal.core.WPLaunchDelegate"
id="org.eclipse.thym.wp.core.WPLaunchConfigurationType"
modes="run"
name="Windows Phone 8 Emulator">
</launchConfigurationType>
</extension>
</plugin>
14 changes: 14 additions & 0 deletions plugins/org.eclipse.thym.wp.core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.thym</groupId>
<artifactId>plugins</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<groupId>.org.eclipse.thym.plugins</groupId>
<artifactId>org.eclipse.thym.wp.core</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*******************************************************************************
* Copyright (c) 2014 Zend Technologies Ltd.
* 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:
* Red Hat Inc. - initial API and implementation and/or initial documentation
* Zend Technologies Ltd. - initial implementation
*******************************************************************************/
package org.eclipse.thym.wp.core;

import java.io.File;
import java.util.Arrays;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.thym.wp.core.vstudio.WPConstants;
import org.eclipse.thym.wp.internal.core.WindowsRegistry;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
* @author Wojciech Galanciak, 2014
*
*/
public class WPCore implements BundleActivator {

public static final String WP_LAUNCH_ID = "org.eclipse.thym.wp.core.WPLaunchConfigurationType"; //$NON-NLS-1$

public static final String PLUGIN_ID = "org.eclipse.thym.wp.core"; //$NON-NLS-1$

private static final String THYM_UI_ID = "org.eclipse.thym.ui"; //$NON-NLS-1$

private static final String WINDOWS_PHONE_REG = "HKLM\\Software\\Wow6432Node\\Microsoft\\Microsoft SDKs\\WindowsPhone"; //$NON-NLS-1$
private static final String INSTALL_PATH = "Install Path"; //$NON-NLS-1$

private static BundleContext context;

private static ILog logger;

static BundleContext getContext() {
return context;
}

/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
WPCore.context = bundleContext;
logger = Platform.getLog(getContext().getBundle());
}

/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
WPCore.context = null;
}

public static void log(int status, String message, Throwable throwable) {
logger.log(new Status(status, PLUGIN_ID, message, throwable));
}

/**
* Get path to Windows Phone SDK root folder.
*
* @return path to Windows Phone SDK root folder or <code>null</code> if SDK
* cannot be retrieved from preferences or detected from Windows
* registry.
* @throws CoreException
*/
public static String getSDKLocation() throws CoreException {
String sdkLocation = Platform.getPreferencesService().getString(
THYM_UI_ID, WPConstants.WINDOWS_PHONE_SDK_LOCATION_PREF, null,
null);
if (sdkLocation == null) {
File location = detectSDK();
if (location.exists()) {
sdkLocation = location.getAbsolutePath();
IEclipsePreferences prefs = InstanceScope.INSTANCE
.getNode(THYM_UI_ID);
prefs.put(WPConstants.WINDOWS_PHONE_SDK_LOCATION_PREF,
sdkLocation);
}
}
return sdkLocation;
}

private static File detectSDK() throws CoreException {
String[] versions = WindowsRegistry.getChildren(WINDOWS_PHONE_REG);
if (versions.length > 0) {
Arrays.sort(versions);
String installPath = null;
for (int i = versions.length - 1; i >= 0; i--) {
installPath = WindowsRegistry.readRegistry(
WINDOWS_PHONE_REG + "\\" + versions[i] + "\\" + INSTALL_PATH, //$NON-NLS-1$ //$NON-NLS-2$
INSTALL_PATH);
if (installPath != null) {
break;
}
}
if (installPath != null) {
return new File(installPath);
}
}
return null;
}

}
Loading

0 comments on commit accf5d0

Please sign in to comment.