Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24644] Decouple Hyperloop logic and Ti SDK #174

Merged
merged 5 commits into from
May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ rm -rf plugins
mkdir -p plugins/hyperloop/$VERSION
cp -R temp/* plugins/hyperloop/$VERSION
rm -rf temp
cp -R ../plugins/windows plugins/hyperloop/$VERSION/hooks/
cp -R ../windows/sdk_plugins/windows plugins/hyperloop/$VERSION/hooks/
zip -q -r hyperloop-$VERSION.zip *
rm -rf modules
rm -rf plugins
Expand Down
26 changes: 0 additions & 26 deletions plugins/windows/hyperloop.js

This file was deleted.

3 changes: 3 additions & 0 deletions windows/plugins/hooks/hyperloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ exports.init = function(logger, config, cli, nodeappc) {
for (var i = 0; i < files.length; i++) {
fs.createReadStream(path.join(from, files[i])).pipe(fs.createWriteStream(path.join(to, files[i])));
}
// Don't copy TitaniumWindows_Hyperloop.winmd
var exclude_file = path.join(to, 'TitaniumWindows_Hyperloop.winmd');
fs.existsSync(exclude_file) && fs.unlinkSync(exclude_file);
}
});
});
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{620bd446-2194-4f36-ac67-91052ad56549}</ProjectGuid>
<OutputType>winmdobj</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TitaniumWindows_Hyperloop</RootNamespace>
<AssemblyName>TitaniumWindows_Hyperloop</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile32</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\phone\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\phone\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
<ItemGroup>
<TargetPlatform Include="Windows, Version=8.1" />
<TargetPlatform Include="WindowsPhoneApp, Version=8.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\src\TypeHelper.cs" />
<Compile Include="..\src\Properties\AssemblyInfo.cs" />
</ItemGroup>
<% if (externalReferences.length > 0) { -%>
<ItemGroup>
<% for(var i = 0; i < externalReferences.length; i++) { -%>
<Reference Include="<%= externalReferences[i].Include %>">
<HintPath><%= externalReferences[i].HintPath %></HintPath>
</Reference>
<% } -%>
</ItemGroup>
<% } -%>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TitaniumWindows_Hyperloop", "TitaniumWindows_Hyperloop.csproj", "{620BD446-2194-4F36-AC67-91052AD56549}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{620BD446-2194-4F36-AC67-91052AD56549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Debug|Any CPU.Build.0 = Debug|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Release|Any CPU.ActiveCfg = Release|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TitaniumWindows_Hyperloop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TitaniumWindows_Hyperloop")]
[assembly: AssemblyCopyright("Copyright © Axway 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;

namespace TitaniumWindows_Hyperloop
{
public delegate void HyperloopEventHandler(Event evt, object e);

public sealed class Event
{
public event HyperloopEventHandler GotEvent;

public object Target { get; set; }
public string Name { get; set; }

public Event(string name, object target)
{
Target = target;
Name = name;
}

public void HandleEvent(object sender, object e)
{
GotEvent?.Invoke(this, e);
}
}

public sealed class EventHelper
{

<% for(var key in native_events) { -%>
public static Event add_<%- native_events[key].signature %>(object target)
{
Event evt = new Event("<%- native_events[key].name %>", target);
((<%- native_events[key].type %>)target).<%- native_events[key].name %> += evt.HandleEvent;
return evt;
}

public static void remove_<%- native_events[key].signature %>(object evt, object target)
{
((<%- native_events[key].type %>)target).<%- native_events[key].name %> -= ((Event)evt).HandleEvent;
}
<% } -%>
}


public sealed class TypeHelper
{
private static Dictionary<string, string> KnownTypes = new Dictionary<string, string>()
{
{ "Object", typeof(System.Object).AssemblyQualifiedName },
{ "String", typeof(System.String).AssemblyQualifiedName },
{ "System.Object", typeof(System.Object).AssemblyQualifiedName },
{ "System.String", typeof(System.String).AssemblyQualifiedName },
{ "System.Exception", typeof(System.Exception).AssemblyQualifiedName },
{ "System.Double", typeof(System.Double).AssemblyQualifiedName },
{ "System.SByte", typeof(System.SByte).AssemblyQualifiedName },
{ "System.Byte", typeof(System.Byte).AssemblyQualifiedName },
{ "System.Single", typeof(System.Single).AssemblyQualifiedName },
{ "System.Decimal", typeof(System.Decimal).AssemblyQualifiedName },
{ "System.Int64", typeof(System.Int64).AssemblyQualifiedName },
{ "System.Int32", typeof(System.Int32).AssemblyQualifiedName },
{ "System.Int16", typeof(System.Int16).AssemblyQualifiedName },
{ "System.UInt64", typeof(System.UInt64).AssemblyQualifiedName },
{ "System.UInt32", typeof(System.UInt32).AssemblyQualifiedName },
{ "System.UInt16", typeof(System.UInt16).AssemblyQualifiedName },
{ "System.Boolean", typeof(System.Boolean).AssemblyQualifiedName }
};

private static Dictionary<string, string> AssemblyQualifiedName = new Dictionary<string, string>()
{
<% for(var key in native_types) { -%>
{ "<%- native_types[key].name %>", typeof(<%- native_types[key].name %>).AssemblyQualifiedName },
<% } -%>
};

public static Type GetType(string className)
{
if (!KnownTypes.ContainsKey(className) && !AssemblyQualifiedName.ContainsKey(className))
{
throw new TypeLoadException("Unable to find AssemblyQualifiedName for " + className);
}

//
// Extract assembly qualified name for Windows namespace.
//
string assemblyQualifiedName;
if (!KnownTypes.TryGetValue(className, out assemblyQualifiedName))
{
AssemblyQualifiedName.TryGetValue(className, out assemblyQualifiedName);
}

Type type = Type.GetType(assemblyQualifiedName);
if (type == null)
{
throw new TypeLoadException("Unable to load " + className);
}

return type;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{620bd446-2194-4f36-ac67-91052ad56549}</ProjectGuid>
<OutputType>winmdobj</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TitaniumWindows_Hyperloop</RootNamespace>
<AssemblyName>TitaniumWindows_Hyperloop</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile32</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\phone\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\phone\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
<ItemGroup>
<TargetPlatform Include="Windows, Version=8.1" />
<TargetPlatform Include="WindowsPhoneApp, Version=8.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\src\TypeHelper.cs" />
<Compile Include="..\src\Properties\AssemblyInfo.cs" />
</ItemGroup>
<% if (externalReferences.length > 0) { -%>
<ItemGroup>
<% for(var i = 0; i < externalReferences.length; i++) { -%>
<Reference Include="<%= externalReferences[i].Include %>">
<HintPath><%= externalReferences[i].HintPath %></HintPath>
</Reference>
<% } -%>
</ItemGroup>
<% } -%>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TitaniumWindows_Hyperloop", "TitaniumWindows_Hyperloop.csproj", "{620BD446-2194-4F36-AC67-91052AD56549}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{620BD446-2194-4F36-AC67-91052AD56549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Debug|Any CPU.Build.0 = Debug|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Release|Any CPU.ActiveCfg = Release|Any CPU
{620BD446-2194-4F36-AC67-91052AD56549}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal