Coder Social home page Coder Social logo

Comments (7)

janpio avatar janpio commented on June 8, 2024

Ugh, that sounds strange. Will try to reproduce.

from cordova-windows.

janpio avatar janpio commented on June 8, 2024

Hm, I think I can not reproduce this:

I created the project this way:

E:\Projects\throwaway                                                                                                             
λ cordova create cordovaWindows336                                                                                                
Creating a new cordova project.                                                                                                   
                                                                                                                                  
E:\Projects\throwaway                                                                                                             
λ cd cordovaWindows336\                                                                                                           
                                                                                                                                  
E:\Projects\throwaway\cordovaWindows336  ([email protected])                                                                       
λ cordova platform add windows                                                                                                    
Using cordova-fetch for cordova-windows@^7.0.0                                                                                    
Adding windows project...                                                                                                         
Creating Cordova Windows Project:                                                                                                 
        Path: platforms\windows                                                                                                   
        Namespace: io.cordova.hellocordova                                                                                        
        Name: HelloCordova                                                                                                        
cp: no such file or directory: E:\Projects\throwaway\cordovaWindows336\node_modules\cordova-windows\node_modules\winjs\js\base.js 
                                                                                                                                  
cp: no such file or directory: E:\Projects\throwaway\cordovaWindows336\node_modules\cordova-windows\node_modules\winjs\js\base.js 
                                                                                                                                  
Windows project created with [email protected]                                                                                
Plugin 'cordova-plugin-whitelist' found in config.xml... Migrating it to package.json                                             
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project                                                      
Installing "cordova-plugin-whitelist" for windows                                                                                 
Adding cordova-plugin-whitelist to package.json                                                                                   

Then I built once and commited everything to git:

E:\Projects\throwaway\cordovaWindows336 (master -> origin) ([email protected])                                                     
λ cordova build windows                                                                                                           
ENV var MSBUILDDIR is set C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin                          
Building project: E:\Projects\throwaway\cordovaWindows336\platforms\windows\CordovaApp.Windows10.jsproj                           
        Configuration : debug                                                                                                     
        Platform      : anycpu                                                                                                    
        Buildflags    : /p:AppxBundle=Never                                                                                       
        MSBuildTools  : C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin                            
buildProject spawn: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild [                      
  'E:\\Projects\\throwaway\\cordovaWindows336\\platforms\\windows\\CordovaApp.Windows10.jsproj',                                  
  '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',                                                                       
  '/nologo',                                                                                                                      
  '/p:Configuration=debug',                                                                                                       
  '/p:Platform=anycpu',                                                                                                           
  '/p:AppxBundle=Never'                                                                                                           
] { stdio: 'inherit' }                                                                                                            
  prebuild.js: Patching platform `10`                                                                                             
  - Injected `base.js` reference to `/www/index.html`                                                                             
  - Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s*<\/script>)(\s*)/ from /
  tml                                                                                                                             
  - Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base.js">\s*<\/script>)(\s*)/ 
  ndex.html                                                                                                                       
  CordovaApp.Windows10 -> E:\Projects\throwaway\cordovaWindows336\platforms\windows\AppPackages\CordovaApp.Windows10_1.0.0.0_anycp
  t\CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx                                                                                                                                                                                                               

Then I added the changes to config.xml you posted above and built again. This lead to the following git diff:

diff --git a/config.xml b/config.xml
index 7434b5e..faddf6e 100644
--- a/config.xml
+++ b/config.xml
@@ -23,4 +23,11 @@
         <allow-intent href="itms:*" />
         <allow-intent href="itms-apps:*" />
     </platform>
+
+    <platform name="windows">
+        <config-file parent="/Package/Capabilities" target="package.appxmanifest">
+            <Capability Name="allJoyn" />
+        </config-file>
+    </platform>
+    
 </widget>
diff --git a/platforms/windows/AppPackages/CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test/CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx b/platforms/windows/AppPackages/CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test/CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx
index 583aea4..d0bcdbc 100644
Binary files a/platforms/windows/AppPackages/CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test/CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx and b/platforms/windows/AppPackages/CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test/CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx differ
diff --git a/platforms/windows/build/windows/debug/anycpu/win10/AppxManifest.xml b/platforms/windows/build/windows/debug/anycpu/win10/AppxManifest.xml
index 36e605f..dc972a7 100644
--- a/platforms/windows/build/windows/debug/anycpu/win10/AppxManifest.xml
+++ b/platforms/windows/build/windows/debug/anycpu/win10/AppxManifest.xml
@@ -39,6 +39,7 @@
   </Applications>
   <Capabilities>
     <Capability Name="internetClient" />
+    <Capability Name="allJoyn" />
   </Capabilities>
   <build:Metadata>
     <build:Item Name="SharedGUID" Value="9ebdb27f-d75b-4d8c-b53f-7be4a1fe89f9" />
diff --git a/platforms/windows/config.xml b/platforms/windows/config.xml
index e87390b..e32ba6a 100644
--- a/platforms/windows/config.xml
+++ b/platforms/windows/config.xml
@@ -15,4 +15,7 @@
     <allow-intent href="sms:*" />
     <allow-intent href="mailto:*" />
     <allow-intent href="geo:*" />
+    <config-file parent="/Package/Capabilities" target="package.appxmanifest">
+        <Capability Name="allJoyn" />
+    </config-file>
 </widget>
diff --git a/platforms/windows/package.phone.appxmanifest b/platforms/windows/package.phone.appxmanifest
index f63fb9f..42ccab2 100644
--- a/platforms/windows/package.phone.appxmanifest
+++ b/platforms/windows/package.phone.appxmanifest
@@ -35,5 +35,6 @@
     </Applications>
     <Capabilities>
         <Capability Name="internetClientServer" />
+        <Capability Name="allJoyn" />
     </Capabilities>
 </Package>
diff --git a/platforms/windows/package.windows.appxmanifest b/platforms/windows/package.windows.appxmanifest
index f331373..3646983 100644
--- a/platforms/windows/package.windows.appxmanifest
+++ b/platforms/windows/package.windows.appxmanifest
@@ -35,5 +35,6 @@
     </Applications>
     <Capabilities>
         <Capability Name="internetClient" />
+        <Capability Name="allJoyn" />
     </Capabilities>
 </Package>
diff --git a/platforms/windows/package.windows10.appxmanifest b/platforms/windows/package.windows10.appxmanifest
index 3bfe9ba..c265ee8 100644
--- a/platforms/windows/package.windows10.appxmanifest
+++ b/platforms/windows/package.windows10.appxmanifest
@@ -32,5 +32,6 @@
     </Applications>
     <Capabilities>
         <Capability Name="internetClient" />
+        <Capability Name="allJoyn" />
     </Capabilities>
 </Package>
diff --git a/platforms/windows/windows.json b/platforms/windows/windows.json
index 8bd1274..c5a6807 100644
--- a/platforms/windows/windows.json
+++ b/platforms/windows/windows.json
@@ -4,7 +4,41 @@
     "uninstalled": []
   },
   "config_munge": {
-    "files": {}
+    "files": {
+      "package.phone.appxmanifest": {
+        "parents": {
+          "/Package/Capabilities": [
+            {
+              "xml": "<Capability Name=\"allJoyn\" />",
+              "count": 1,
+              "id": "config.xml"
+            }
+          ]
+        }
+      },
+      "package.windows.appxmanifest": {
+        "parents": {
+          "/Package/Capabilities": [
+            {
+              "xml": "<Capability Name=\"allJoyn\" />",
+              "count": 1,
+              "id": "config.xml"
+            }
+          ]
+        }
+      },
+      "package.windows10.appxmanifest": {
+        "parents": {
+          "/Package/Capabilities": [
+            {
+              "xml": "<Capability Name=\"allJoyn\" />",
+              "count": 1,
+              "id": "config.xml"
+            }
+          ]
+        }
+      }
+    }
   },
   "installed_plugins": {
     "cordova-plugin-whitelist": {

That looks correct to me. Am I missing something?

Note that I am using Cordova CLI 9.0.0 ([email protected]) - maybe that makes a difference?

from cordova-windows.

janpio avatar janpio commented on June 8, 2024

Ping @dominic-simplan

from cordova-windows.

dominic-simplan avatar dominic-simplan commented on June 8, 2024

@janpio thank you for taking the time to investige. I can confirm your behaviour with an empty project, but I still get the described issue within my project, even with cordova 9.0.0.

I've setup a new project in order to find out what's causing this issue (https://github.com/dominic-simplan/cordova-windows-config).
While trying to reproduce the issue, I came across a strange behaviour which I don't understand and which might be related.

After running cordova prepare in the linked project, windows.json contains the following (because of the camera plugin):

"package.windows10.appxmanifest": {
  "parents": {
    "/Package/Capabilities": [{
        "xml": "<DeviceCapability Name=\"webcam\" />",
        "count": 1
      }
    ]
  }
}

Now I add this to the config.xml and build the project:

<platform name="windows">
	<config-file parent="/Package/Capabilities" target="package.appxmanifest">
		<Capability Name="allJoyn" />
	</config-file>
</platform>

The windows.json now contains

"package.windows10.appxmanifest": {
  "parents": {
    "/Package/Capabilities": [{
        "xml": "<Capability Name=\"allJoyn\" />",
        "count": 1,
        "id": "config.xml"
      }
    ]
  }
}

Why is the webcam capability gone? <config-file> should append the tag, shouldn't it? Even if I remove the <config-file> from the config.xml again, the according object in the windows.json is now empty:

"package.windows10.appxmanifest": {
  "parents": {
    "/Package/Capabilities": []
  }
}

Before I do any further investigation, I need to understand if this behaviour is correct or not.

from cordova-windows.

janpio avatar janpio commented on June 8, 2024

Interesting observation! Possible the "merging" of multiple config file changes is broken or behaving undefined. (Unfortunately I am not sure what should happen here - but sure doesn't seem good... I would have expected it to contain both, right?) (Next thing to investigate could be to just install 2 plugins that both write into the same file/path/xpath and see if these also overwrite).

from cordova-windows.

janpio avatar janpio commented on June 8, 2024

@knight9999 Might this be another case of apache/cordova#95?

from cordova-windows.

timbru31 avatar timbru31 commented on June 8, 2024

We are archiving this repository following Apache Cordova's Deprecation Policy. We will not continue to work on this repository. Therefore all issues and pull requests are being closed. Thanks for your contribution.

from cordova-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.