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

Support for configurable debug origin/port (issue 1429) #1546

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Examples/2048/2048.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "2048" */;
buildPhases = (
4CED848A1B37581600715E21 /* ShellScript */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
Expand Down Expand Up @@ -230,6 +231,22 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4CED848A1B37581600715E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
3 changes: 2 additions & 1 deletion Examples/2048/2048/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "AppDelegate.h"

#import "RCTRootView.h"
#import "RCTUtils.h"

@implementation AppDelegate

Expand All @@ -36,7 +37,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* on the same Wi-Fi network.
*/

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.bundle?platform=ios&dev=true"];
jsCodeLocation = RCTPackagerURL(@"/Examples/2048/Game2048.bundle?platform=ios&dev=true");

/**
* OPTION 2
Expand Down
7 changes: 7 additions & 0 deletions Examples/2048/2048/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>RCTPackager</key>
<dict>
<key>url</key>
<string>http://localhost</string>
<key>port</key>
<integer>8088</integer>
</dict>
</dict>
</plist>
17 changes: 17 additions & 0 deletions Examples/Movies/Movies.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Movies" */;
buildPhases = (
4CED84A71B37590B00715E21 /* ShellScript */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
Expand Down Expand Up @@ -320,6 +321,22 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4CED84A71B37590B00715E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
3 changes: 2 additions & 1 deletion Examples/Movies/Movies/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import "RCTLinkingManager.h"
#import "RCTRootView.h"
#import "RCTUtils.h"

@implementation AppDelegate

Expand All @@ -37,7 +38,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* on the same Wi-Fi network.
*/

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true"];
jsCodeLocation = RCTPackagerURL(@"/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true");

/**
* OPTION 2
Expand Down
11 changes: 11 additions & 0 deletions Examples/Movies/Movies/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,16 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>RCTPackager</key>
<dict>
<key>url</key>
<string>http://localhost</string>
<key>port</key>
<integer>8089</integer>
</dict>
</dict>
</plist>
17 changes: 17 additions & 0 deletions Examples/SampleApp/iOS/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SampleApp" */;
buildPhases = (
4CED847C1B3756CA00715E21 /* ShellScript */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
Expand Down Expand Up @@ -513,6 +514,22 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4CED847C1B3756CA00715E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
00E356EA1AD99517003FC87E /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
18 changes: 12 additions & 6 deletions Examples/SampleApp/iOS/SampleApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<dict>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>RCTPackager</key>
<dict>
<key>url</key>
<string>http://localhost</string>
<key>port</key>
<integer>8087</integer>
</dict>
</dict>
</plist>
17 changes: 17 additions & 0 deletions Examples/TicTacToe/TicTacToe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TicTacToe" */;
buildPhases = (
4CED84BE1B3759D900715E21 /* ShellScript */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
Expand Down Expand Up @@ -290,6 +291,22 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4CED84BE1B3759D900715E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
5 changes: 3 additions & 2 deletions Examples/TicTacToe/TicTacToe/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "AppDelegate.h"

#import "RCTRootView.h"
#import "RCTUtils.h"

@implementation AppDelegate

Expand All @@ -36,8 +37,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* on the same Wi-Fi network.
*/

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios&dev=true"];

jsCodeLocation = RCTPackagerURL(@"/Examples/TicTacToe/TicTacToeApp.bundle?platform=ios&dev=true");
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
Expand Down
16 changes: 11 additions & 5 deletions Examples/TicTacToe/TicTacToe/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>RCTPackager</key>
<dict>
<key>url</key>
<string>http://localhost</string>
<key>port</key>
<integer>8090</integer>
</dict>
</dict>
</plist>
36 changes: 33 additions & 3 deletions Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
1497CFB11B21F5E400C1F8F2 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */; };
1497CFB21B21F5E400C1F8F2 /* RCTSparseArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAA1B21F5E400C1F8F2 /* RCTSparseArrayTests.m */; };
1497CFB31B21F5E400C1F8F2 /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */; };
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; };
14B6DA821B276C5900BF4DD1 /* libRCTTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58005BEE1ABA80530062E044 /* libRCTTest.a */; };
14D6D7111B220EB3001FB087 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14D6D7101B220EB3001FB087 /* libOCMock.a */; };
14D6D71E1B2222EF001FB087 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; };
Expand All @@ -52,7 +51,7 @@
14D6D7291B2222EF001FB087 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; };
14DC67F41AB71881001358AB /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14DC67F11AB71876001358AB /* libRCTPushNotification.a */; };
3578590A1B28D2CF00341EDB /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 357859011B28D2C500341EDB /* libRCTLinking.a */; };
3DB99D0C1BA0340600302749 /* UIExplorerIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB99D0B1BA0340600302749 /* UIExplorerIntegrationTests.m */; };
4CED845A1B3754F400715E21 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; };
834C36EC1AF8DED70019C93C /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 834C36D21AF8DA610019C93C /* libRCTSettings.a */; };
83636F8F1B53F22C009F943E /* RCTUIManagerScenarioTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */; };
8385CEF51B873B5C00C6273E /* RCTImageLoaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */; };
Expand Down Expand Up @@ -260,7 +259,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */,
4CED845A1B3754F400715E21 /* libReact.a in Frameworks */,
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */,
134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */,
138DEE241B9EDFB6007F4EA5 /* libRCTCameraRoll.a in Frameworks */,
Expand Down Expand Up @@ -557,6 +556,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 004D28AD1AAF61C70097A701 /* Build configuration list for PBXNativeTarget "UIExplorerUnitTests" */;
buildPhases = (
4CED84D91B3760EE00715E21 /* ShellScript */,
004D289A1AAF61C70097A701 /* Sources */,
004D289B1AAF61C70097A701 /* Frameworks */,
004D289C1AAF61C70097A701 /* Resources */,
Expand All @@ -574,6 +574,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "UIExplorer" */;
buildPhases = (
4CC373051B23ADA4004C3480 /* ShellScript */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
Expand Down Expand Up @@ -828,6 +829,35 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4CC373051B23ADA4004C3480 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
4CED84D91B3760EE00715E21 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "if [ -d \"$SRCROOT/../../packager\" ]\nthen\n PACKAGER_ROOT=$SRCROOT/../../packager\nelse\n PACKAGER_ROOT=$SRCROOT/node_modules/react-native/packager\nfi\n\n$PACKAGER_ROOT/launchPackager.command ${INFOPLIST_FILE}\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
004D289A1AAF61C70097A701 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
5 changes: 3 additions & 2 deletions Examples/UIExplorer/UIExplorer/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "RCTBridge.h"
#import "RCTJavaScriptLoader.h"
#import "RCTRootView.h"
#import "RCTUtils.h"

@interface AppDelegate() <RCTBridgeDelegate>

Expand Down Expand Up @@ -59,8 +60,8 @@ - (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
* on the same Wi-Fi network.
*/

sourceURL = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerApp.ios.bundle?platform=ios&dev=true"];

sourceURL = RCTPackagerURL(@"/Examples/UIExplorer/UIExplorerApp.ios.bundle?platform=ios&dev=true");
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
Expand Down
20 changes: 13 additions & 7 deletions Examples/UIExplorer/UIExplorer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation, otherwise it is going to *fail silently*!</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand All @@ -36,13 +34,21 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSLocationWhenInUseUsageDescription</key>
<string>You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation, otherwise it is going to *fail silently*!</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>RCTPackager</key>
<dict>
<key>url</key>
<string>http://localhost</string>
<key>port</key>
<integer>8081</integer>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just have URL here instead of parts? Seems like in the end these will get glued together anyways. IMHO it's much easier to deal with URLs.

</dict>
<key>NSAppTransportSecurity</key>
<dict>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Libraries/RCTTest/RCTTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ - (instancetype)initWithApp:(NSString *)app
_scriptURL = [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"];
RCTAssert(_scriptURL != nil, @"Could not locate main.jsBundle");
#else
_scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=ios&dev=true", app]];
_scriptURL = RCTPackagerURL( [NSString stringWithFormat:@"/%@.bundle?platform=ios&dev=true", app] );
#endif
}
return self;
Expand Down
Loading