You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/09/16 14:06:13 UTC
[2/3] cordova-lib git commit: CB-8615 Improves plugman tests for
Windows
CB-8615 Improves plugman tests for Windows
* Adds Windows10 project to tests
* Verifies <framework> copy dir
* Verifies <framework> reference string
* Adds tests for target-dir and versions attributes
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/eefd7af6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/eefd7af6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/eefd7af6
Branch: refs/heads/master
Commit: eefd7af6589525c1d9f35ca884dec52c1c10b3b2
Parents: ccdf9a6
Author: sgrebnov <v-...@microsoft.com>
Authored: Fri Sep 4 21:12:43 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Sep 16 14:57:04 2015 +0300
----------------------------------------------------------------------
.../spec-plugman/platforms/windows.spec.js | 68 ++++++++++++++++----
.../org.test.plugins.dummyplugin/plugin.xml | 2 +
.../src/windows/dummy5.dll | 0
.../src/windows/dummy6.dll | 0
.../windows/CordovaApp.Windows10.jsproj | 61 ++++++++++++++++++
5 files changed, 118 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/eefd7af6/cordova-lib/spec-plugman/platforms/windows.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows.spec.js b/cordova-lib/spec-plugman/platforms/windows.spec.js
index ddaa9ce..f9fe6cb 100644
--- a/cordova-lib/spec-plugman/platforms/windows.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows.spec.js
@@ -73,7 +73,8 @@ beforeEach(function () {
all: 'CordovaApp.projitems',
phone: 'CordovaApp.Phone.jsproj',
windows: 'CordovaApp.Windows.jsproj',
- windows8: 'CordovaApp.Windows80.jsproj'
+ windows8: 'CordovaApp.Windows80.jsproj',
+ windows10: 'CordovaApp.Windows10.jsproj'
}, windows8: {
all: 'TestApp.jsproj',
windows8: 'TestApp.jsproj'
@@ -125,8 +126,35 @@ beforeEach(function () {
projects.push(proj_files.master);
}
+ // Check that installed framework reference is properly added to project.
+ var checkInstalledFrameworkReference = function (tag, elementToInstall, xml) {
+ var frameworkCustomPathElement = xml.find(xpath);
+ expect(frameworkCustomPathElement).not.toBe(null);
+ var frameworkCustomPath = frameworkCustomPathElement.text;
+ expect(frameworkCustomPath).not.toBe(null);
+ var targetDir = elementToInstall.targetDir || '';
+ var frameworkCustomExpectedPath = path.join('plugins', dummy_id, targetDir,
+ path.basename(elementToInstall.src));
+ expect(frameworkCustomPath).toEqual(frameworkCustomExpectedPath);
+ };
+
+ // Check that framework file was copied to correct path
+ var checkInstalledFrameworkPath = function (framework) {
+ var targetDir = framework.targetDir || '';
+ var dest = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummy_id, targetDir, path.basename(framework.src));
+ var copiedSuccessfully = fs.existsSync(path.resolve(dest));
+ expect(copiedSuccessfully).toBe(true);
+ };
+
var appendToRootFake = function (itemGroup) {
expect(itemGroup).toContainXmlPath(xpath);
+ // In case we install framework with 'custom' attribute set to 'true'
+ // we verify that file is copied to correct dir and reference is added properly.
+ // This is not required in case of 'projectReference' attribute is used.
+ if (tag === 'framework' && elementToInstall.type !== 'projectReference') {
+ checkInstalledFrameworkReference(tag, elementToInstall, itemGroup);
+ checkInstalledFrameworkPath(elementToInstall);
+ }
};
var projectsAddedToSpies = [];
@@ -194,7 +222,7 @@ beforeEach(function () {
validateInstalledProjects('lib-file', libfiles[0], xpath, ['all']);
xpath = 'SDKReference[@Include="TestSDK2, Version=1.0"]';
- validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone']);
+ validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone', 'windows10']);
xpath = 'SDKReference[@Include="TestSDK3, Version=1.0"]';
validateInstalledProjects('lib-file', libfiles[2], xpath, ['phone']);
@@ -231,10 +259,16 @@ beforeEach(function () {
validateInstalledProjects('framework', frameworks[1], xpath, ['all']);
xpath = 'Reference[@Include="dummy3"]/HintPath';
- validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8']);
+ validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8', 'windows10']);
xpath = 'Reference[@Include="dummy4"][@Condition="\'$(Platform)\'==\'ARM\'"]/HintPath';
validateInstalledProjects('framework', frameworks[3], xpath, ['phone']);
+
+ xpath = 'Reference[@Include="dummy5"]/HintPath';
+ validateInstalledProjects('framework', frameworks[4], xpath, ['phone']);
+
+ xpath = 'Reference[@Include="dummy6"]/HintPath';
+ validateInstalledProjects('framework', frameworks[5], xpath, ['windows', 'windows10', 'phone']);
});
});
@@ -243,16 +277,16 @@ beforeEach(function () {
it('should write to correct project files when conditions are specified', function () {
var xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy1.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x64\'"]';
- validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
+ validateInstalledProjects('framework', frameworks[6], xpath, ['all']);
xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy2.vcxproj') + '"]';
- validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
+ validateInstalledProjects('framework', frameworks[7], xpath, ['windows8']);
xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy3.vcxproj') + '"]';
- validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
+ validateInstalledProjects('framework', frameworks[8], xpath, ['windows', 'windows8', 'windows10']);
xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy4.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x86\'"]';
- validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
+ validateInstalledProjects('framework', frameworks[9], xpath, ['windows', 'phone']);
});
});
});
@@ -335,7 +369,7 @@ beforeEach(function () {
incText = 'TestSDK2, Version=1.0';
targetConditions = {versions: '>=8.1', deviceTarget: undefined, arch: undefined};
- validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone']);
+ validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone', 'windows10']);
incText = 'TestSDK3, Version=1.0';
targetConditions = {versions: undefined, deviceTarget: 'phone', arch: undefined};
@@ -369,12 +403,20 @@ beforeEach(function () {
incText = 'dummy3';
targetConditions = {versions: undefined, deviceTarget: 'windows', arch: undefined};
- validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8']);
+ validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8', 'windows10']);
incText = 'dummy4';
targetConditions = {versions: '8.1', deviceTarget: 'phone', arch: 'ARM'};
validateUninstalledProjects('framework', frameworks[3], path, incText, targetConditions, ['phone']);
+ incText = 'dummy5';
+ targetConditions = {versions: undefined, deviceTarget: 'phone', arch: undefined};
+ validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['phone']);
+
+ incText = 'dummy6';
+ targetConditions = {versions: '>=8.1', deviceTarget: undefined, arch: undefined};
+ validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows', 'windows10', 'phone']);
+
done();
});
});
@@ -391,19 +433,19 @@ beforeEach(function () {
var xmlPath = 'ItemGroup/ProjectReference';
var incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy1.vcxproj');
var targetConditions = {versions: undefined, deviceTarget: undefined, arch: 'x64'};
- validateUninstalledProjects('framework', frameworks[4], xmlPath, incText, targetConditions, ['all']);
+ validateUninstalledProjects('framework', frameworks[6], xmlPath, incText, targetConditions, ['all']);
incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy2.vcxproj');
targetConditions = {versions: '<8.1', deviceTarget: undefined, arch: undefined};
- validateUninstalledProjects('framework', frameworks[5], xmlPath, incText, targetConditions, ['windows8']);
+ validateUninstalledProjects('framework', frameworks[7], xmlPath, incText, targetConditions, ['windows8']);
incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy3.vcxproj');
targetConditions = {versions: undefined, deviceTarget: 'win', arch: undefined};
- validateUninstalledProjects('framework', frameworks[6], xmlPath, incText, targetConditions, ['windows', 'windows8']);
+ validateUninstalledProjects('framework', frameworks[8], xmlPath, incText, targetConditions, ['windows', 'windows8', 'windows10']);
incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy4.vcxproj');
targetConditions = {versions: '8.1', deviceTarget: 'all', arch: 'x86'};
- validateUninstalledProjects('framework', frameworks[7], xmlPath, incText, targetConditions, ['windows', 'phone']);
+ validateUninstalledProjects('framework', frameworks[9], xmlPath, incText, targetConditions, ['windows', 'phone']);
done();
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/eefd7af6/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
index 02bb445..b8c4ec5 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
@@ -192,6 +192,8 @@
<framework src="src/windows/dummy2.dll" versions=">=8.0"/>
<framework src="src/windows/dummy3.dll" device-target="windows"/>
<framework src="src/windows/dummy4.dll" device-target="phone" versions="8.1" arch="ARM"/>
+ <framework src="src/windows/dummy5.dll" custom="true" target-dir="phoneDir" device-target="phone" />
+ <framework src="src/windows/dummy6.dll" custom="true" target-dir="sharedDir" versions=">=8.1" />
<framework src="src/windows/dummy1.vcxproj" type="projectReference" arch="x64"/>
<framework src="src/windows/dummy2.vcxproj" type="projectReference" versions="<8.1"/>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/eefd7af6/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy5.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy5.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy5.dll
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/eefd7af6/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy6.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy6.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy6.dll
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/eefd7af6/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows10.jsproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows10.jsproj b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows10.jsproj
new file mode 100644
index 0000000..e4b9b06
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows10.jsproj
@@ -0,0 +1,61 @@
+<?xml version='1.0' encoding='utf-8'?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <OutputPath>build\windows\$(Configuration)\$(Platform)\</OutputPath>
+ <IntermediateOutputPath>build\windows\bld\</IntermediateOutputPath>
+ <AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
+ </PropertyGroup>
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|AnyCPU">
+ <Configuration>Debug</Configuration>
+ <Platform>AnyCPU</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|ARM">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x86">
+ <Configuration>Debug</Configuration>
+ <Platform>x86</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|AnyCPU">
+ <Configuration>Release</Configuration>
+ <Platform>AnyCPU</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM">
+ <Configuration>Release</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x86">
+ <Configuration>Release</Configuration>
+ <Platform>x86</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>f9b0ae20-c91c-42b9-9c6e-d3bc28b4509e</ProjectGuid>
+ </PropertyGroup>
+ <Import Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0'">
+ <VisualStudioVersion>14.0</VisualStudioVersion>
+ </PropertyGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
+ <PropertyGroup>
+ <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
+ <TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
+ <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
+ <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(VisualStudioVersion)' < '14.0'">
+ <TargetPlatformVersion>10.0</TargetPlatformVersion>
+ <TargetPlatformMinVersion>10.0</TargetPlatformMinVersion>
+ </PropertyGroup>
+</Project>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org