You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/09/19 01:19:16 UTC

[1/4] git commit: CB-7520 refine image names, use wildcard to include MRT images

Repository: cordova-windows
Updated Branches:
  refs/heads/master a315941ef -> eb3a46887


CB-7520 refine image names, use wildcard to include MRT images


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/44afcd3e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/44afcd3e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/44afcd3e

Branch: refs/heads/master
Commit: 44afcd3eb58dd06e0fb56643bfefcde8baebc662
Parents: 93d463d
Author: sgrebnov <v-...@microsoft.com>
Authored: Thu Sep 4 16:33:18 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Sep 11 11:44:01 2014 +0400

----------------------------------------------------------------------
 windows/template/CordovaApp.Phone.jsproj          |   7 +------
 windows/template/CordovaApp.Windows.jsproj        |   5 +----
 windows/template/CordovaApp.Windows80.jsproj      |   9 +++------
 .../template/images/SplashScreen.scale-100.png    | Bin 0 -> 24855 bytes
 .../template/images/SplashScreen.scale-240.png    | Bin 68705 -> 0 bytes
 .../images/SplashScreenPhone.scale-240.png        | Bin 0 -> 68705 bytes
 .../images/Square150x150Logo.scale-100.png        | Bin 0 -> 11600 bytes
 .../template/images/Square30x30Logo.scale-100.png | Bin 0 -> 2831 bytes
 .../images/Square310x310Logo.scale-100.png        | Bin 0 -> 35751 bytes
 .../template/images/Square70x70Logo.scale-100.png | Bin 0 -> 8361 bytes
 windows/template/images/StoreLogo.scale-100.png   | Bin 0 -> 4052 bytes
 .../template/images/Wide310x150Logo.scale-100.png | Bin 0 -> 12517 bytes
 windows/template/images/logo.png                  | Bin 11600 -> 0 bytes
 windows/template/images/smalllogo.png             | Bin 2831 -> 0 bytes
 windows/template/images/splashscreen.png          | Bin 24855 -> 0 bytes
 windows/template/images/storelogo.png             | Bin 4052 -> 0 bytes
 windows/template/package.phone.appxmanifest       |   9 +++++++--
 windows/template/package.windows.appxmanifest     |  17 +++++++++++++----
 windows/template/package.windows80.appxmanifest   |   6 +++---
 19 files changed, 28 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/CordovaApp.Phone.jsproj
----------------------------------------------------------------------
diff --git a/windows/template/CordovaApp.Phone.jsproj b/windows/template/CordovaApp.Phone.jsproj
index d6eafb6..43e4fe2 100644
--- a/windows/template/CordovaApp.Phone.jsproj
+++ b/windows/template/CordovaApp.Phone.jsproj
@@ -78,12 +78,7 @@
     <AppxManifest Include="package.phone.appxmanifest">
       <SubType>Designer</SubType>
     </AppxManifest>
-    <Content Include="images\Square150x150Logo.scale-240.png" />
-    <Content Include="images\Square44x44Logo.scale-240.png" />
-    <Content Include="images\Wide310x150Logo.scale-240.png" />
-    <Content Include="images\Square71x71Logo.scale-240.png" />
-    <Content Include="images\SplashScreen.scale-240.png" />
-    <Content Include="images\StoreLogo.scale-240.png" />
+    <Content Include="images\*.png" Exclude="images\*.scale-180.*" />
   </ItemGroup>
   <ItemGroup>
     <SDKReference Include="Microsoft.Phone.WinJS.2.1, Version=1.0" />

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/CordovaApp.Windows.jsproj
----------------------------------------------------------------------
diff --git a/windows/template/CordovaApp.Windows.jsproj b/windows/template/CordovaApp.Windows.jsproj
index 70d4d06..6905ba6 100644
--- a/windows/template/CordovaApp.Windows.jsproj
+++ b/windows/template/CordovaApp.Windows.jsproj
@@ -77,10 +77,7 @@
     <AppxManifest Include="package.windows.appxmanifest">
       <SubType>Designer</SubType>
     </AppxManifest>
-    <Content Include="images\logo.png" />
-    <Content Include="images\smalllogo.png" />
-    <Content Include="images\splashscreen.png" />
-    <Content Include="images\storelogo.png" />
+    <Content Include="images\*.png" Exclude="images\*.scale-240.*" />
     <None Include="CordovaApp_TemporaryKey.pfx" />
   </ItemGroup>
   <ItemGroup>

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/CordovaApp.Windows80.jsproj
----------------------------------------------------------------------
diff --git a/windows/template/CordovaApp.Windows80.jsproj b/windows/template/CordovaApp.Windows80.jsproj
index a72ec70..a50df83 100644
--- a/windows/template/CordovaApp.Windows80.jsproj
+++ b/windows/template/CordovaApp.Windows80.jsproj
@@ -20,7 +20,7 @@
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <OutputPath>build\windows80\$(Configuration)\$(Platform)\</OutputPath>
-  <IntermediateOutputPath>build\windows80\bld\</IntermediateOutputPath>
+    <IntermediateOutputPath>build\windows80\bld\</IntermediateOutputPath>
   </PropertyGroup>
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|AnyCPU">
@@ -75,10 +75,7 @@
     <AppxManifest Include="package.windows80.appxmanifest">
       <SubType>Designer</SubType>
     </AppxManifest>
-    <Content Include="images\logo.png" />
-    <Content Include="images\smalllogo.png" />
-    <Content Include="images\splashscreen.png" />
-    <Content Include="images\storelogo.png" />
+    <Content Include="images\*.png" Exclude="images\*.scale-240.*" />
     <None Include="CordovaApp_TemporaryKey.pfx" />
   </ItemGroup>
   <ItemGroup>
@@ -90,4 +87,4 @@
     <PreBuildEvent>
     </PreBuildEvent>
   </PropertyGroup>
-</Project>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/SplashScreen.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/SplashScreen.scale-100.png b/windows/template/images/SplashScreen.scale-100.png
new file mode 100644
index 0000000..d1e6c98
Binary files /dev/null and b/windows/template/images/SplashScreen.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/SplashScreen.scale-240.png
----------------------------------------------------------------------
diff --git a/windows/template/images/SplashScreen.scale-240.png b/windows/template/images/SplashScreen.scale-240.png
deleted file mode 100644
index 3e433b9..0000000
Binary files a/windows/template/images/SplashScreen.scale-240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/SplashScreenPhone.scale-240.png
----------------------------------------------------------------------
diff --git a/windows/template/images/SplashScreenPhone.scale-240.png b/windows/template/images/SplashScreenPhone.scale-240.png
new file mode 100644
index 0000000..3e433b9
Binary files /dev/null and b/windows/template/images/SplashScreenPhone.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/Square150x150Logo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/Square150x150Logo.scale-100.png b/windows/template/images/Square150x150Logo.scale-100.png
new file mode 100644
index 0000000..86a48a8
Binary files /dev/null and b/windows/template/images/Square150x150Logo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/Square30x30Logo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/Square30x30Logo.scale-100.png b/windows/template/images/Square30x30Logo.scale-100.png
new file mode 100644
index 0000000..0e648ef
Binary files /dev/null and b/windows/template/images/Square30x30Logo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/Square310x310Logo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/Square310x310Logo.scale-100.png b/windows/template/images/Square310x310Logo.scale-100.png
new file mode 100644
index 0000000..35c9f96
Binary files /dev/null and b/windows/template/images/Square310x310Logo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/Square70x70Logo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/Square70x70Logo.scale-100.png b/windows/template/images/Square70x70Logo.scale-100.png
new file mode 100644
index 0000000..96a4ad9
Binary files /dev/null and b/windows/template/images/Square70x70Logo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/StoreLogo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/StoreLogo.scale-100.png b/windows/template/images/StoreLogo.scale-100.png
new file mode 100644
index 0000000..dd00478
Binary files /dev/null and b/windows/template/images/StoreLogo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/Wide310x150Logo.scale-100.png
----------------------------------------------------------------------
diff --git a/windows/template/images/Wide310x150Logo.scale-100.png b/windows/template/images/Wide310x150Logo.scale-100.png
new file mode 100644
index 0000000..4a75b94
Binary files /dev/null and b/windows/template/images/Wide310x150Logo.scale-100.png differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/logo.png
----------------------------------------------------------------------
diff --git a/windows/template/images/logo.png b/windows/template/images/logo.png
deleted file mode 100644
index 86a48a8..0000000
Binary files a/windows/template/images/logo.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/smalllogo.png
----------------------------------------------------------------------
diff --git a/windows/template/images/smalllogo.png b/windows/template/images/smalllogo.png
deleted file mode 100644
index 0e648ef..0000000
Binary files a/windows/template/images/smalllogo.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/splashscreen.png
----------------------------------------------------------------------
diff --git a/windows/template/images/splashscreen.png b/windows/template/images/splashscreen.png
deleted file mode 100644
index d1e6c98..0000000
Binary files a/windows/template/images/splashscreen.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/images/storelogo.png
----------------------------------------------------------------------
diff --git a/windows/template/images/storelogo.png b/windows/template/images/storelogo.png
deleted file mode 100644
index dd00478..0000000
Binary files a/windows/template/images/storelogo.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/package.phone.appxmanifest
----------------------------------------------------------------------
diff --git a/windows/template/package.phone.appxmanifest b/windows/template/package.phone.appxmanifest
index aaa9f52..332f429 100644
--- a/windows/template/package.phone.appxmanifest
+++ b/windows/template/package.phone.appxmanifest
@@ -40,9 +40,14 @@
                          Description="CordovaApp"
                          ForegroundText="light"
                          BackgroundColor="transparent">
-        <m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png" Square71x71Logo="images\Square71x71Logo.png">
+        <m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png"
+                        Square71x71Logo="images\Square71x71Logo.png">
+          <m3:ShowNameOnTiles>
+            <m3:ShowOn Tile="square150x150Logo" />
+            <m3:ShowOn Tile="wide310x150Logo" />
+          </m3:ShowNameOnTiles>
         </m3:DefaultTile>
-        <m3:SplashScreen Image="images\SplashScreen.png" />
+        <m3:SplashScreen Image="images\SplashScreenPhone.png" />
       </m3:VisualElements>
     </Application>
   </Applications>

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/package.windows.appxmanifest
----------------------------------------------------------------------
diff --git a/windows/template/package.windows.appxmanifest b/windows/template/package.windows.appxmanifest
index 72a8d0e..40deedf 100644
--- a/windows/template/package.windows.appxmanifest
+++ b/windows/template/package.windows.appxmanifest
@@ -22,7 +22,7 @@
   <Properties>
     <DisplayName>$projectname$</DisplayName>
     <PublisherDisplayName>$username$</PublisherDisplayName>
-    <Logo>images\storelogo.png</Logo>
+    <Logo>images\StoreLogo.png</Logo>
   </Properties>
   <Prerequisites>
     <OSMinVersion>6.3.0</OSMinVersion>
@@ -37,9 +37,18 @@
                          Description="CordovaApp"
                          ForegroundText="light"
                          BackgroundColor="#464646"
-                         Square150x150Logo="images\Logo.png"
-                         Square30x30Logo="images\SmallLogo.png">
-        <m2:SplashScreen Image="images\splashscreen.png" />
+                         Square150x150Logo="images\Square150x150Logo.png"
+                         Square30x30Logo="images\Square30x30Logo.png">
+        <m2:DefaultTile Square70x70Logo="images\Square70x70Logo.png"
+                        Square310x310Logo="images\Square310x310Logo.png"
+                        Wide310x150Logo="images\Wide310x150Logo.png">
+          <m2:ShowNameOnTiles>
+            <m2:ShowOn Tile="square150x150Logo" />
+            <m2:ShowOn Tile="wide310x150Logo" />
+            <m2:ShowOn Tile="square310x310Logo" />
+          </m2:ShowNameOnTiles>
+        </m2:DefaultTile>
+        <m2:SplashScreen Image="images\SplashScreen.png" />
       </m2:VisualElements>
     </Application>
   </Applications>

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/44afcd3e/windows/template/package.windows80.appxmanifest
----------------------------------------------------------------------
diff --git a/windows/template/package.windows80.appxmanifest b/windows/template/package.windows80.appxmanifest
index 9262457..4062746 100644
--- a/windows/template/package.windows80.appxmanifest
+++ b/windows/template/package.windows80.appxmanifest
@@ -34,12 +34,12 @@
   <Applications>
     <Application Id="$safeprojectname$" StartPage="www/index.html">
       <VisualElements DisplayName="$projectname$" 
-                      Logo="images\logo.png" 
-                      SmallLogo="images\smalllogo.png"
+                      Logo="images\Square150x150Logo.png" 
+                      SmallLogo="images\Square30x30Logo.png"
                       Description="CordovaApp" 
                       ForegroundText="light" 
                       BackgroundColor="#464646">
-        <DefaultTile ShowName="allLogos" />
+        <DefaultTile ShowName="allLogos" WideLogo="images\Wide310x150Logo.png"/>
         <SplashScreen Image="images\splashscreen.png" />
       </VisualElements>
     </Application>


[3/4] git commit: CB-7520 copy MRT images defined in config.xml

Posted by pu...@apache.org.
CB-7520 copy MRT images defined in config.xml


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/87ba72f7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/87ba72f7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/87ba72f7

Branch: refs/heads/master
Commit: 87ba72f78711e29aa53753fd61b622c574de55a2
Parents: b2848a9
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Sep 9 14:49:45 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Sep 11 11:44:46 2014 +0400

----------------------------------------------------------------------
 windows/template/cordova/lib/ConfigParser.js |  82 +++--------------
 windows/template/cordova/lib/prepare.js      | 103 ++++++++++++++++------
 2 files changed, 85 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/87ba72f7/windows/template/cordova/lib/ConfigParser.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/ConfigParser.js b/windows/template/cordova/lib/ConfigParser.js
index 36a3e9d..a08ccd6 100644
--- a/windows/template/cordova/lib/ConfigParser.js
+++ b/windows/template/cordova/lib/ConfigParser.js
@@ -114,99 +114,39 @@ ConfigParser.prototype = {
         return ret;
     },
     /**
-     * Returns all resources for the platform specified.
-     * @param  {String} platform     The platform.
+     * Returns all resources.
      * @param {string}  resourceName Type of static resources to return.
      *                               "icon" and "splash" currently supported.
      * @return {Array}               Resources for the platform specified.
      */
-    getStaticResources: function(platform, resourceName) {
-        var ret = [],
-            staticResources = [];
-        if (platform) { // platform specific icons
-            this.doc.findall('platform[@name=\'' + platform + '\']/' + resourceName).forEach(function(elt){
-                elt.platform = platform; // mark as platform specific resource
-                staticResources.push(elt);
-            });
-        }
-        // root level resources
-        staticResources = staticResources.concat(this.doc.findall(resourceName));
-        // parse resource elements
-        staticResources.forEach(function (elt) {
+    getStaticResources: function(resourceName) {
+        return this.doc.findall(resourceName).map(function (elt) {
             var res = {};
             res.src = elt.attrib.src;
+            res.target = elt.attrib.target;
             res.density = elt.attrib['density'] || elt.attrib['cdv:density'] || elt.attrib['gap:density'];
             res.platform = elt.platform || null; // null means icon represents default icon (shared between platforms)
             res.width = elt.attrib.width;
             res.height = elt.attrib.height;
 
-            // default icon
-            if (!res.width && !res.height && !res.density) {
-                ret.defaultResource = res;
-            }
-            ret.push(res);
+            return res;
         });
-
-        /**
-         * Returns resource with specified width and/or height.
-         * @param  {number} width Width of resource.
-         * @param  {number} height Height of resource.
-         * @return {Resource} Resource object or null if not found.
-         */
-        ret.getBySize = function(width, height) {
-            if (!width && !height){
-                throw 'One of width or height must be defined';
-            }
-            for (var idx in this){
-                var res = this[idx];
-                // If only one of width or height is not specified, use another parameter for comparation
-                // If both specified, compare both.
-                if ((!width || (width == res.width)) &&
-                    (!height || (height == res.height))){
-                    return res;
-                }
-            }
-            return null;
-        };
-
-        /**
-         * Returns resource with specified density.
-         * @param  {string} density Density of resource.
-         * @return {Resource}       Resource object or null if not found.
-         */
-        ret.getByDensity = function (density) {
-            for (var idx in this) {
-                if (this[idx].density == density) {
-                    return this[idx];
-                }
-            }
-            return null;
-        };
-
-        /** Returns default icons */
-        ret.getDefault = function() {
-            return ret.defaultResource;
-        };
-
-        return ret;
     },
 
     /**
-     * Returns all icons for specific platform.
-     * @param  {string} platform Platform name
+     * Returns all defined icons.
      * @return {Resource[]}      Array of icon objects.
      */
-    getIcons: function(platform) {
-        return this.getStaticResources(platform, 'icon');
+    getIcons: function() {
+        return this.getStaticResources('icon');
     },
 
     /**
-     * Returns all splash images for specific platform.
-     * @param  {string} platform Platform name
+     * Returns all defined splash images.
      * @return {Resource[]}      Array of Splash objects.
      */
-    getSplashScreens: function(platform) {
-        return this.getStaticResources(platform, 'splash');
+    getSplashScreens: function() {
+        return this.getStaticResources('splash');
     },
 
     /**

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/87ba72f7/windows/template/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/prepare.js b/windows/template/cordova/lib/prepare.js
index ed159a0..f28ebea 100644
--- a/windows/template/cordova/lib/prepare.js
+++ b/windows/template/cordova/lib/prepare.js
@@ -186,43 +186,88 @@ function copyImages(config) {
 
     function copyImage(src, dest) {
         src = path.join(appRoot, src),
-        dest = path.join(platformRoot, dest);
-        console.log('Copying image from ' + src + ' to ' + dest);
+        dest = path.join(platformRoot, 'images', dest);
+        //console.log('Copying image from ' + src + ' to ' + dest);
         shell.cp('-f', src, dest);
     }
 
-    // Icons, supported by the platform
-    var platformIcons = [
-        {dest: 'images/logo.png', width: 150, height: 150},
-        {dest: 'images/smalllogo.png', width: 30, height: 30},
-        {dest: 'images/storelogo.png', width: 50, height: 50},
-        {dest: 'images/StoreLogo.scale-240.png', width: 120, height: 120},
-        {dest: 'images/Square44x44Logo.scale-240.png', width: 106, height: 106},
-        {dest: 'images/Square71x71Logo.scale-240.png', width: 170, height: 170},
-        {dest: 'images/Square150x150Logo.scale-240.png', width: 360, height: 360},
-        {dest: 'images/Wide310x150Logo.scale-240.png', width: 744, height: 360},
-    ];
-
-    var icons = config.getIcons();
-    platformIcons.forEach(function (item) {
-        var img = icons.getBySize(item.width, item.height);
-        if (img) {
-            copyImage(img.src, item.dest);
+    function copyMrtImage(src, dest) {
+        var srcDir = path.dirname(src),
+            srcExt = path.extname(src),
+            srcFileName = path.basename(src, srcExt);
+     
+        var destExt = path.extname(dest),
+            destFileName = path.basename(dest, destExt);
+
+        // all MRT images: logo.png, logo.scale-100.png, logo.scale-200.png, etc
+        var images = fs.readdirSync(srcDir).filter(function(e) { 
+            return e.match('^'+srcFileName + '(.scale-[0-9]+)?' + srcExt);
+        });
+        // warn if no images found
+        if (images.length == 0) {
+            console.log('No images found for target: ' + destFileName);
+            return;
         }
-    });
+        // copy images with new name but keeping scale suffix
+        images.forEach(function(img) {
+            var scale = path.extname(path.basename(img, srcExt));
+            if (scale == '') {
+                scale = '.scale-100';
+            }
+            copyImage(path.join(srcDir, img), destFileName+scale+destExt);
+        });
+        
+    }
 
-    // Splash screen images, supported by the platform
-    var platformSplashImages = [
-        {dest: 'images/splashscreen.png', width: 620, height: 300},
-        {dest: 'images/SplashScreen.scale-240.png', width: 1152, height: 1920}
+    // Platform default images
+    var platformImages = [
+        {dest: 'Square150x150Logo.scale-100.png', width: 150, height: 150},
+        {dest: 'Square30x30Logo.scale-100.png', width: 30, height: 30},
+        {dest: 'StoreLogo.scale-100.png', width: 50, height: 50},
+        {dest: 'SplashScreen.scale-100.png', width: 620, height: 300},
+        // scaled images are specified here for backward compatibility only so we can find them by size
+        {dest: 'StoreLogo.scale-240.png', width: 120, height: 120},
+        {dest: 'Square44x44Logo.scale-240.png', width: 106, height: 106},
+        {dest: 'Square71x71Logo.scale-240.png', width: 170, height: 170},
+        {dest: 'Square70x70Logo.scale-100.png', width: 70, height: 70},
+        {dest: 'Square150x150Logo.scale-240.png', width: 360, height: 360},
+        {dest: 'Square310x310Logo.scale-100.png', width: 310, height: 310},
+        {dest: 'Wide310x150Logo.scale-100.png', width: 310, height: 150},
+        {dest: 'Wide310x150Logo.scale-240.png', width: 744, height: 360},
+        {dest: 'SplashScreenPhone.scale-240.png', width: 1152, height: 1920}
     ];
 
-    var splashImages = config.getSplashScreens();
+    function findPlatformImage(width, height) {
+        if (!width && !height){
+            // this could be default image, 
+            // Windows requires specific image dimension so we can't apply it
+            return null;
+        }
+        for (var idx in platformImages){
+            var res = platformImages[idx];
+            // If only one of width or height is not specified, use another parameter for comparation
+            // If both specified, compare both.
+            if ((!width || (width == res.width)) &&
+                (!height || (height == res.height))){
+                return res;
+            }
+        }
+        return null;
+    }
 
-    platformSplashImages.forEach(function (item) {
-        var img = splashImages.getBySize(item.width, item.height);
-        if (img) {
-            copyImage(img.src, item.dest);
+    var images = config.getIcons().concat(config.getSplashScreens());
+
+    images.forEach(function (img) {
+        if (img.target) {
+            copyMrtImage(img.src, img.target + '.png');
+        } else {
+            // find target image by size
+            var targetImg = findPlatformImage (img.width, img.height);
+            if (targetImg) {
+                copyImage(img.src, targetImg.dest);
+            } else {
+                console.log('The following image is skipped due to unsupported size: ' + img.src);
+            }
         }
     });
 }


[4/4] git commit: Merge branch 'MRT' of https://github.com/MSOpenTech/cordova-windows

Posted by pu...@apache.org.
Merge branch 'MRT' of https://github.com/MSOpenTech/cordova-windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/eb3a4688
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/eb3a4688
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/eb3a4688

Branch: refs/heads/master
Commit: eb3a468870c4181567dd2b07aa0de77700f2e486
Parents: a315941 87ba72f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Sep 18 16:18:52 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Sep 18 16:18:52 2014 -0700

----------------------------------------------------------------------
 windows/template/CordovaApp.Phone.jsproj        |   7 +-
 windows/template/CordovaApp.Windows.jsproj      |   5 +-
 windows/template/CordovaApp.Windows80.jsproj    |   9 +-
 windows/template/cordova/lib/ConfigParser.js    |  82 ++-------------
 windows/template/cordova/lib/package.js         |  56 +++++-----
 windows/template/cordova/lib/prepare.js         | 103 +++++++++++++------
 windows/template/cordova/lib/run.js             |   2 +-
 .../template/images/SplashScreen.scale-100.png  | Bin 0 -> 24855 bytes
 .../template/images/SplashScreen.scale-240.png  | Bin 68705 -> 0 bytes
 .../images/SplashScreenPhone.scale-240.png      | Bin 0 -> 68705 bytes
 .../images/Square150x150Logo.scale-100.png      | Bin 0 -> 11600 bytes
 .../images/Square30x30Logo.scale-100.png        | Bin 0 -> 2831 bytes
 .../images/Square310x310Logo.scale-100.png      | Bin 0 -> 35751 bytes
 .../images/Square70x70Logo.scale-100.png        | Bin 0 -> 8361 bytes
 windows/template/images/StoreLogo.scale-100.png | Bin 0 -> 4052 bytes
 .../images/Wide310x150Logo.scale-100.png        | Bin 0 -> 12517 bytes
 windows/template/images/logo.png                | Bin 11600 -> 0 bytes
 windows/template/images/smalllogo.png           | Bin 2831 -> 0 bytes
 windows/template/images/splashscreen.png        | Bin 24855 -> 0 bytes
 windows/template/images/storelogo.png           | Bin 4052 -> 0 bytes
 windows/template/package.phone.appxmanifest     |   9 +-
 windows/template/package.windows.appxmanifest   |  17 ++-
 windows/template/package.windows80.appxmanifest |   6 +-
 23 files changed, 137 insertions(+), 159 deletions(-)
----------------------------------------------------------------------



[2/4] git commit: CB-7520 .appxbundle package format support

Posted by pu...@apache.org.
CB-7520 .appxbundle package format support


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/b2848a97
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/b2848a97
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/b2848a97

Branch: refs/heads/master
Commit: b2848a979944f29d0b3e6a2167a4b3b1257bb261
Parents: 44afcd3
Author: sgrebnov <v-...@microsoft.com>
Authored: Thu Sep 4 18:36:28 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Sep 11 11:44:11 2014 +0400

----------------------------------------------------------------------
 windows/template/cordova/lib/package.js | 56 ++++++++++++----------------
 windows/template/cordova/lib/run.js     |  2 +-
 2 files changed, 24 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/b2848a97/windows/template/cordova/lib/package.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/package.js b/windows/template/cordova/lib/package.js
index 95a15c2..6538fdd 100644
--- a/windows/template/cordova/lib/package.js
+++ b/windows/template/cordova/lib/package.js
@@ -41,53 +41,43 @@ module.exports.getPackage = function (projectType, buildtype, buildArch) {
         return fs.statSync(pkgDir).isDirectory();
     });
 
-    // Retrieve package infos for all packages found
-    // that corresponds to package properties provided
-    return Q.all(pkgDirs.map(function (pkgDir) {
-        // get info about package
-        return module.exports.getInfo(pkgDir).then(function(pkgInfo) {
+    for (var dir in pkgDirs) {
+        var packageFiles = fs.readdirSync(pkgDirs[dir]).filter(function(e) {
+            return e.match('.*.(appx|appxbundle)$');
+        });
+
+        for (var pkgFile in packageFiles) {
+            var packageFile = path.join(pkgDirs[dir], packageFiles[pkgFile]);
+            var pkgInfo = module.exports.getPackageFileInfo(packageFile);
+
             if (pkgInfo && pkgInfo.type == projectType &&
                 pkgInfo.arch == buildArch && pkgInfo.buildtype == buildtype) {
                 // if package's properties are corresponds to properties provided
                 // resolve the promise with this package's info
                 return Q.resolve(pkgInfo);
             }
-            // else resove with no info
-            return Q.resolve();
-        });
-    })).then(function (packages) {
-        for (var idx in packages) {
-            // iterate through infos found and resolve with first
-            if (packages[idx]) {
-                return Q.resolve(packages[idx]);
-            }
         }
-        // else reject because seems that no corresponding packages found
-        return Q.reject('Package with specified parameters not found in AppPackages folder');
-    });
+    }
+    // reject because seems that no corresponding packages found
+    return Q.reject('Package with specified parameters not found in AppPackages folder');
 };
 
 // returns package info object or null if it is not valid package
-module.exports.getInfo = function (packagePath) {
-    if (!fs.statSync(packagePath).isDirectory()){
-        return Q.reject('Provided path is not a directory');
-    }
-    // This RE matches with package folder name like:
-    // CordovaApp.Phone_0.0.1.0_AnyCPU_Debug_Test
-    // Group:     ( 1 ) (  2  ) (  3 ) ( 4 )
-    var props = /.*\.(Phone|Windows|Windows80)_((?:\d\.)*\d)_(AnyCPU|x64|x86|ARM)(?:_(Debug))?_Test$/i.exec(path.basename(packagePath));
-    if (props){
-        // return package info object inside of promise
-        return Q.resolve({path: packagePath,
-            type      : props[1].toLowerCase(),
+module.exports.getPackageFileInfo = function (packageFile) {
+    var pkgName = path.basename(packageFile);
+    // CordovaApp.Windows_0.0.1.0_anycpu_debug.appx
+    // CordovaApp.Phone_0.0.1.0_x86_debug.appxbundle
+    var props = /.*\.(Phone|Windows|Windows80)_((?:\d\.)*\d)_(AnyCPU|x64|x86|ARM)(?:_(Debug))?.(appx|appxbundle)$/i.exec(pkgName);
+    if (props) {
+        return {type      : props[1].toLowerCase(),
             arch      : props[3].toLowerCase(),
             buildtype : props[4] ? props[4].toLowerCase() : "release",
             file      : props[1].toLowerCase() != "phone" ?
-                path.join(packagePath, 'Add-AppDevPackage.ps1') :
-                path.join(packagePath, path.basename(packagePath).replace(/_test$/i, '') + '.appx')
-        });
+                path.join(packageFile, '..', 'Add-AppDevPackage.ps1') :
+                packageFile
+        };
     }
-    return Q.reject('Can\'t fetch info for package at ' + packagePath);
+    return null;
 };
 
 // return package app ID fetched from appxmanifest

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/b2848a97/windows/template/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/run.js b/windows/template/cordova/lib/run.js
index 87fe36d..1bd1904 100644
--- a/windows/template/cordova/lib/run.js
+++ b/windows/template/cordova/lib/run.js
@@ -65,7 +65,7 @@ module.exports.run = function (argv) {
     return buildPackages.then(function () {
         return packages.getPackage(projectType, buildType, buildArchs[0]);
     }).then(function(pkg) {
-        console.log('\nDeploying ' + pkg.type + ' package to ' + deployTarget);
+        console.log('\nDeploying ' + pkg.type + ' package to ' + deployTarget + ':\n' + pkg.file);
         return pkg.type == "phone" ?
             packages.deployToPhone(pkg.file, deployTarget) :
             packages.deployToDesktop(pkg.file, deployTarget);