Sebastien Lorber created CB-6705:
------------------------------------

             Summary: platform add requires platforms and plugins dirs to exist
                 Key: CB-6705
                 URL: https://issues.apache.org/jira/browse/CB-6705
             Project: Apache Cordova
          Issue Type: Bug
          Components: CLI
    Affects Versions: 3.4.0
         Environment: Ubuntu 12
            Reporter: Sebastien Lorber
            Priority: Trivial


{code}
sebastien@sebastien-xps:stample-Phonegap (master *+)$ cordova platform add 
android
Creating android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: co.stample
        Name: stample-phonegap
        Android target: android-19
Copying template files...
shell.js: internal error
Error: ENOENT, no such file or directory 'platforms/android/assets'
    at Object.fs.mkdirSync (fs.js:642:18)
    at 
/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/node_modules/shelljs/src/cp.js:173:14
    at Array.forEach (native)
    at Object._cp 
(/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/node_modules/shelljs/src/cp.js:156:11)
    at Object.cp 
(/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/node_modules/shelljs/src/common.js:172:23)
    at 
/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/lib/create.js:166:19
    at setShellFatal 
(/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/lib/create.js:45:5)
    at 
/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/lib/create.js:164:9
    at _fulfilled 
(/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done 
(/home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:827:30)
Error: /home/sebastien/.cordova/lib/android/cordova/3.4.0/bin/create: Command 
failed with exit code 1
    at ChildProcess.whenDone 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/src/superspawn.js:126:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)
{code}


This seems to be caused because I choose to not version control the platforms 
and plugins folders.

If I do mkdir platforms I get the following error

{code}
sebastien@sebastien-xps:stample-Phonegap (master *+)$ mkdir platforms
sebastien@sebastien-xps:stample-Phonegap (master *+)$ cordova platform add 
android
Creating android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: co.stample
        Name: stample-phonegap
        Android target: android-19
Copying template files...
Running: android update project --subprojects --path "platforms/android" 
--target android-19 --library "CordovaLib"
Resolved location of library project to: 
/home/sebastien/Desktop/stample-Phonegap/platforms/android/CordovaLib
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'stamplephonegap'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/build.xml
Added file platforms/android/proguard-project.txt
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/CordovaLib/build.xml
Added file platforms/android/CordovaLib/proguard-project.txt

Project successfully created.
Error: ENOENT, no such file or directory 
'/home/sebastien/Desktop/stample-Phonegap/plugins/android.json'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.writeFileSync (fs.js:966:15)
    at Object.save_platform_json 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:435:8)
    at PlatformMunger_process [as process] 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:367:13)
    at Object.exports.process 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/plugman/src/util/config-changes.js:78:12)
    at Object.handlePrepare 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/plugman/src/prepare.js:73:20)
    at 
/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/src/prepare.js:101:25
    at _fulfilled 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch 
(/home/sebastien/Desktop/devhome/install/node-v0.10.24-linux-x64/lib/node_modules/cordova/node_modules/q/q.js:760:13)
{code}


The problem is solved by doing mkdir platforms and mkdir plugins:

{code}
sebastien@sebastien-xps:stample-Phonegap (master *+)$ cordova platform add 
android
Creating android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: co.stample
        Name: stample-phonegap
        Android target: android-19
Copying template files...
Running: android update project --subprojects --path "platforms/android" 
--target android-19 --library "CordovaLib"
Resolved location of library project to: 
/home/sebastien/Desktop/stample-Phonegap/platforms/android/CordovaLib
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'stamplephonegap'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/build.xml
Added file platforms/android/proguard-project.txt
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/CordovaLib/build.xml
Added file platforms/android/CordovaLib/proguard-project.txt

Project successfully created.
{code}



This would be better if the CLI recreated these folders in case of unexistance, 
or at least having a better fail-fast error message like "the platforms folder 
is missing" or something

This bothers me because I create a phonegap starter app, and it forces me to 
version control these 2 folders, and git does not allow version control of 
empty folders as far as I know so I have to put an empty file here just to 
avoid asking the checkouters to manually create the folders themselves

Not a big deal though but it should be easy to fix



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to