{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/9602","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/9602/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/9602/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/9602/events","html_url":"https://github.com/facebook/react-native/pull/9602","id":173405946,"number":9602,"title":"Correction on switch to bundled JS or not + add parameter to be in de…","user":{"login":"mbaroukh","id":3954833,"avatar_url":"https://avatars.githubusercontent.com/u/3954833?v=3","gravatar_id":"","url":"https://api.github.com/users/mbaroukh","html_url":"https://github.com/mbaroukh","followers_url":"https://api.github.com/users/mbaroukh/followers","following_url":"https://api.github.com/users/mbaroukh/following{/other_user}","gists_url":"https://api.github.com/users/mbaroukh/gists{/gist_id}","starred_url":"https://api.github.com/users/mbaroukh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbaroukh/subscriptions","organizations_url":"https://api.github.com/users/mbaroukh/orgs","repos_url":"https://api.github.com/users/mbaroukh/repos","events_url":"https://api.github.com/users/mbaroukh/events{/privacy}","received_events_url":"https://api.github.com/users/mbaroukh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7"},{"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-26T09:10:22Z","updated_at":"2016-09-08T15:13:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/9602","html_url":"https://github.com/facebook/react-native/pull/9602","diff_url":"https://github.com/facebook/react-native/pull/9602.diff","patch_url":"https://github.com/facebook/react-native/pull/9602.patch"},"body":"Hi.\r\n\r\nWhy this pull request :\r\nOn Android, we can make many variant.\r\nFor each variant, you can specify if js is bundled into the apk.\r\nBut you can't specify if JS will be in developpement mode or production mode because the selection on dev mode or prod mode is made with :\r\n`def devEnabled = !targetName.toLowerCase().contains(\"release\")`\r\n\r\nSo this pull request only add a configuration option to allow it. Suppose I have a build named \"Rec7\", I can :\r\n`project.ext.react = [ \r\n        bundleInRec7: true,\r\n        devModeForRec7: false,\r\n]`\r\n\r\nBy the way there is a bug in allowing or not to bundle js in apk.\r\nThe selection is made with this code in local-cli/generator-android/templates/src/app/build.gradle :\r\n`                enabled config.\"bundleIn${targetName}\" ||\r\n                    config.\"bundleIn${buildTypeName.capitalize()}\" ?:\r\n                            targetName.toLowerCase().contains(\"release\")\r\n`\r\nIt works well for all varant except if there is \"release\" in it : \r\nin this case, if you use \"bundleInRelease: false\", the evaluation will go to next part and finally, the only evaluation that will be used is \"targetName.toLowerCase().contains(\"release\")\".\r\nI understand that most times, we wan't to bundle for release, but if the otption exists, it should work as expected.\r\n\r\nSo I just changed for \r\n`\r\nconfig.\"bundleIn${targetName}\"!=null?config.\"bundleIn${targetName}\":\r\n                    config.\"bundleIn${buildTypeName.capitalize()}\"!=null?config.\"bundleIn${buildTypeName.capitalize()}\":\r\n                            targetName.toLowerCase().contains(\"release\")\r\n`\r\nthat will continue to next par if config parameter is null and only if it's null. If it's defined, even if false, it will be used.\r\n\r\nNotes:\r\n- What could be confusing is that devMode parameter will only be valid when js is bundled. I'll try to see if we can use this parameter while using http packager\r\n- Also, I think there is an issue when changing devMode : There must be some caching and bundle did not always occur. And if bundle is not done, the bundled JS will not toggle from/to dev/prod.\r\n\r\nThanks.\r\n\r\nMike"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/245631255","html_url":"https://github.com/facebook/react-native/pull/9602#issuecomment-245631255","issue_url":"https://api.github.com/repos/facebook/react-native/issues/9602","id":245631255,"user":{"login":"mkonicek","id":346214,"avatar_url":"https://avatars.githubusercontent.com/u/346214?v=3","gravatar_id":"","url":"https://api.github.com/users/mkonicek","html_url":"https://github.com/mkonicek","followers_url":"https://api.github.com/users/mkonicek/followers","following_url":"https://api.github.com/users/mkonicek/following{/other_user}","gists_url":"https://api.github.com/users/mkonicek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkonicek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkonicek/subscriptions","organizations_url":"https://api.github.com/users/mkonicek/orgs","repos_url":"https://api.github.com/users/mkonicek/repos","events_url":"https://api.github.com/users/mkonicek/events{/privacy}","received_events_url":"https://api.github.com/users/mkonicek/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T15:13:59Z","updated_at":"2016-09-08T15:13:59Z","body":"> But you can't specify if JS will be in development mode or production mode because the selection on dev mode or prod mode is made with :\r\ndef devEnabled = !targetName.toLowerCase().contains(\"release\")\r\n\r\nI'm curious - why have release JS bundle in a dev Android build, or debug JS bundle in a release build?"}}
{"actor":{"display_login":"mkonicek"}}