Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ function runOnAllDevices(
const tasks = args.tasks || ['install' + toPascalCase(args.variant)];
const gradleArgs = getTaskNames(args.appFolder, tasks);

if (args.port != null) {
Copy link
Member

Choose a reason for hiding this comment

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

We should probably use stricter equal operator !==. Or is it used on purpose here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured the value could be undefined if the argument wasn't provided, but I also wasn't sure if it could ever be null too.

I bet I could make this "port" in args or args.port !== undefined

Copy link
Member

Choose a reason for hiding this comment

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

args.port can be: undefined, NaN (we're passing string input through Number()), number

Copy link
Member

Choose a reason for hiding this comment

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

I guess if(args.port) would be less confusing in that case :D

gradleArgs.push('-PreactNativeDevServerPort=' + args.port);
Copy link
Member

Choose a reason for hiding this comment

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

Quick q: Why this is called Preact?

Copy link
Member

Choose a reason for hiding this comment

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

It's how you can pass parameters to Gradle, something like -P reactNativeDevServerPort should also work I guess? But I didn't bother to check it. cc @nhunzaker

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-P for "Set project property for the build script"

Directly from the gradlew usage stuff:

-P, --project-prop        Set project property for the build script (e.g. -Pmyprop=myvalue).

Having no space is definitely confusing.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, gotcha, thanks! I read it "Preact" and asked myself what's going on 😂 Thank you for explaining it!

}

logger.info('Installing the app...');
logger.debug(
`Running command "cd android && ${cmd} ${gradleArgs.join(' ')}"`,
Expand Down