-
-
Notifications
You must be signed in to change notification settings - Fork 197
Support multiple .apk files produced from gradle build #3467
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
Conversation
}, | ||
getValidPackageNames: (buildOptions: { isReleaseBuild?: boolean, isForDevice?: boolean }): string[] => { | ||
deviceBuildOutputPath: path.join(...deviceBuildOutputArr), | ||
getValidBuildOutputData: (buildOptions: { isReleaseBuild?: boolean, isForDevice?: boolean }): IValidBuildOutputData => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This { isReleaseBuild?: boolean, isForDevice?: boolean }
could be extracted as a separate interface and be reused here and in platform.d.ts
`${projectData.projectName}.apk`, | ||
`app-${buildMode}.apk` | ||
], | ||
regexes: [/app-.*-(debug|release).apk/, new RegExp(`${packageName}-.*-(debug|release).apk`)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can extract apk
or .apk
to a constant (or use APK_DIR
from constants
, although I suggest a separate constant for example APK_EXTENSION_NAME
) and reuse it in both regexes
In addition, you can use APP_FOLDER_NAME
from constants here, as well as the Configurations
object from common/constants
for getting debug
and release
constants.
I'd suggest we add the ignore case (i
) flag to both regular expressions here just to be on the safe side, too.
`${packageName}-${buildMode}.apk`, | ||
`${projectData.projectName}-${buildMode}.apk`, | ||
`${projectData.projectName}.apk`, | ||
`app-${buildMode}.apk` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reuse the APP_FOLDER_NAME
here
]; | ||
return { | ||
packageNames: [ | ||
`${packageName}-${buildMode}.apk`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you decide to introduce a constant for .apk
you can reuse it here and below
lib/services/ios-project-service.ts
Outdated
getDeviceBuildOutputPath: (options: IRelease): string => { | ||
return path.join(projectRoot, "build", "device"); | ||
}, | ||
deviceBuildOutputPath: path.join(projectRoot, "build", "device"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use BUILD_DIR
from constants
here
lib/services/ios-project-service.ts
Outdated
emulatorBuildOutputPath: path.join(projectRoot, "build", "emulator"), | ||
getValidPackageNames: (buildOptions: { isReleaseBuild?: boolean, isForDevice?: boolean }): string[] => { | ||
getValidBuildOutputData: (buildOptions: { isReleaseBuild?: boolean, isForDevice?: boolean }): IValidBuildOutputData => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you decide to extract
{ isReleaseBuild?: boolean, isForDevice?: boolean }
to an interface you can reuse it here
lib/services/platform-service.ts
Outdated
} | ||
|
||
private getLatestApplicationPackage(buildOutputPath: string, validPackageNames: string[]): IApplicationPackage { | ||
let packages = this.getApplicationPackages(buildOutputPath, validPackageNames); | ||
private createApplicationPackage(filepath: string): IApplicationPackage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method's argument could be named packageName
in order to enable a shorter syntax down below:
return {
packageName,
time: this.$fs.getFsStats(packageName).mtime
};
test/platform-commands.ts
Outdated
} | ||
getValidPackageNames = (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => [""]; | ||
deviceBuildOutputPath = ""; | ||
getValidBuildOutputData = (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => ({ packageNames: [""] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interface can be used here as well
test/stubs.ts
Outdated
}, | ||
getValidPackageNames: (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => [], | ||
deviceBuildOutputPath: "", | ||
getValidBuildOutputData: (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => ({ packageNames: []}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interface may be reused here as well
test/stubs.ts
Outdated
}, | ||
getValidPackageNames: (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => [], | ||
deviceBuildOutputPath: "", | ||
getValidBuildOutputData: (buildOptions: { isForDevice?: boolean, isReleaseBuild?: boolean }) => ({ packageNames: [] }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interface may be reused here as well
e1b983a
to
86ac9bd
Compare
run ci |
2 similar comments
run ci |
run ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay to me
This PR adds support for multiple .apk files produced from gradle build in following cases:
Add this to
app/App_Resources/app.gradle
fileAdd this to
app/App_Resources/app.gradle
file