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

Dev_Detox build builds react in release mode #73

Closed
DanielZlotin opened this issue Jan 4, 2017 · 15 comments
Closed

Dev_Detox build builds react in release mode #73

DanielZlotin opened this issue Jan 4, 2017 · 15 comments

Comments

@DanielZlotin
Copy link
Contributor

When building the app in dev mode it compiles react in release mode. This is a serious issue.

@LeoNatan
Copy link
Contributor

One discussed solution is to add Debug_Detox configuration to React.xcodeproj. This solution does not scale and requires to have RN specific code in the deployment script, which I will not add (Detox is not only for RN projects). A potential "solution" is to iterate all sub projects and add those configurations, but I don't like this either - it modifies projects which the user has not connected to (What if the user has native open source projects? What if projects from submodules?).

e2e is intended for release checking.

CC @talkol

@LeoNatan
Copy link
Contributor

LeoNatan commented Jan 10, 2017

Another solution is to run Detox from a test target, like proper native tests (& Earl Grey), but that would require major changes.

@DanielZlotin
Copy link
Contributor Author

@LeoNatan this is how React knows not to run the bundler.
Other than stopping the packager to run on compile, we need to compile react with debug configuration, but other than DEBUG=1 I have no clue.

@DanielZlotin
Copy link
Contributor Author

@LeoNatan can we somehow swizzle Xcode's configuration BEFORE the build to be Debug? this will solve everything. From what I can see for some f*cked up reason the checks are for configuration named Debug case-sensitive 😕

@DanielZlotin
Copy link
Contributor Author

@LeoNatan I did manage to inject things to stop the script when compiling, and I managed to also inject all needed C variables (DEBUG=1, RCT_DEBUG=1) which makes it build an almost debug version of react. But this still feels risky and not the correct approach..

@LeoNatan
Copy link
Contributor

Xcode picks configuration in a peculiar way, and I was unable to find a way to inject which configuration to pick for building a sub project.

@DanielZlotin
Copy link
Contributor Author

because apple.

@DanielZlotin
Copy link
Contributor Author

DanielZlotin commented Jan 10, 2017

Maybe running it with #define DEBUG=1 is not that bad? 😕
https://github.com/facebook/react-native/blob/0.39-stable/React/Base/RCTDefines.h

@LeoNatan
Copy link
Contributor

I don't think that solves the packager problem.

@DanielZlotin
Copy link
Contributor Author

The packager can be stopped by injecting into the xcode run script section

@LeoNatan
Copy link
Contributor

@DanielZlotin Inject how? I don't want to assume RN in the Ruby deployment script. It is a generic script that deploys into a target project. All other operations in it are moot. For instance, if a user feels they need to run tests on their debug version, they can comment out the packager script in their RN project locally themselves.

@DanielZlotin
Copy link
Contributor Author

DanielZlotin commented Jan 10, 2017

It's a script we can provide through npm bin for RN users. As this is directly related to detox we should make it easy for ppl using this.

@LeoNatan
Copy link
Contributor

Running this script when? At Detox deployment time? Deployment happens once. However when RN is updated through npm install/yarn, those changes would be lost.

@LeoNatan
Copy link
Contributor

@DanielZlotin Hmm the script above uses a "$NODE_BINARY". We could use that with a fake node that does not package.

@LeoNatan
Copy link
Contributor

Fixed with 99e5a89.
Detox is now injected using DYLD_INSERT_LIBRARIES instead of being linked in product. This is allows attaching Detox to any binary, not just user ones.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants