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

CB-11964: Do a clean when installing a plugin to get around the bug #339

Closed
wants to merge 6 commits into from

Conversation

infil00p
Copy link
Member

@infil00p infil00p commented Oct 6, 2016

This is a quick fix for the problem, and it might fix some other build errors. I'm not sure about doing it here, because it might break more stuff, but hey, that's what PRs and CI are for. :)

@infil00p
Copy link
Member Author

infil00p commented Oct 6, 2016

OK, so, WTF was that? It appears that we have a test suite problem.

…ment, code duplication is needed because of builderEnv
@codecov-io
Copy link

codecov-io commented Oct 6, 2016

Current coverage is 35.66% (diff: 71.42%)

Merging #339 into master will increase coverage by 0.51%

@@             master       #339   diff @@
==========================================
  Files            12         12          
  Lines          1007       1015     +8   
  Methods         198        200     +2   
  Messages          0          0          
  Branches        168        168          
==========================================
+ Hits            354        362     +8   
  Misses          653        653          
  Partials          0          0          

Powered by Codecov. Last update 37384c5...f1c7d94

//the Gradle bug introduced by the Android Gradle Plugin Version 2.2
//TODO: Delete when the next version of Android Gradle plugin comes out

this.clean();
Copy link
Contributor

@alsorokin alsorokin Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it out of promise chain intentionally? I think that this.clean() returns a promise.

I've tried to merge it to the promise chain, but got the following exception upon cordova platform add:

Error: ENOENT: no such file or directory, open 'C:\Cordova\foo\platforms\android\assets\www\cordova_plugins.js'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1156:15)
    at C:\Cordova\foo\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:137:12
    at _fulfilled (C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:796:13)
    at C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:857:14
    at runSingle (C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Cordova\foo\platforms\android\cordova\node_modules\q\q.js:125:13)

I wonder why it works the way you put it and if it is dangerous to leave it like this.

Copy link
Member Author

@infil00p infil00p Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's dangerous, but I can't even get it to clean inside the promise chain. If we can get it to work in a safer way, that'd be better.

@@ -349,13 +354,24 @@ Api.prototype.run = function(runOptions) {
*/
Api.prototype.clean = function(cleanOptions) {
var self = this;
try {
Copy link
Contributor

@alsorokin alsorokin Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of doing this try catch in product code we could just mock Api.prototype.clean() in tests. Please see my attempt at doing so:
https://github.com/alsorokin/cordova-android/commit/3eae22f25887c3b84a20dfaf4bdca9e45d6e77e9

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a better solution.

@infil00p
Copy link
Member Author

infil00p commented Oct 7, 2016

Moving the example into core, tested it locally, everything appears to check out on MacOS. Hopefully there's no weird Windows issues.

@infil00p
Copy link
Member Author

infil00p commented Oct 7, 2016

OK, there's something wrong with how we're cleaning in the chain. I think we need to do it later in the promise chain. I hate promise chains much more than what people called "callback hell".

@infil00p infil00p changed the title CB-11964: Do a clean when installing a plugin to et around the bug CB-11964: Do a clean when installing a plugin to get around the bug Oct 7, 2016
@infil00p
Copy link
Member Author

infil00p commented Oct 7, 2016

@alsorokin I'm going to keep the commits exploded and as is on this PR. If this looks good to you, I'll merge this in tonight.

@alsorokin
Copy link
Contributor

Tested it on Windows, it works! LGTM

@asfgit asfgit closed this in fb53452 Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants