mirror of
https://github.com/android-actions/setup-android
synced 2024-11-22 05:29:34 -08:00
[2/2] Read version of cmdline-tools/latest, if version is correct - use it
This commit is contained in:
parent
4360e92aa0
commit
1ba064a8a2
2 changed files with 14 additions and 3 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
@ -8591,9 +8591,9 @@ function findPreinstalledSdkManager() {
|
|||
if (result.isFound) {
|
||||
const propertiesFile = path.join(ANDROID_SDK_ROOT, 'cmdline-tools', 'latest', 'source.properties');
|
||||
if (fs.existsSync(propertiesFile)) {
|
||||
const correctRevisionString = `Pkg.Revision=${CMDLINE_TOOLS_VERSION}`;
|
||||
console.log(correctRevisionString);
|
||||
result.isCorrectVersion = fs.readFileSync(propertiesFile, 'utf8').includes(correctRevisionString);
|
||||
result.isCorrectVersion = fs
|
||||
.readFileSync(propertiesFile, 'utf8')
|
||||
.includes(`Pkg.Revision=${CMDLINE_TOOLS_VERSION}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -48,6 +48,17 @@ function findPreinstalledSdkManager(): {
|
|||
result.exePath = getSdkManagerPath('latest')
|
||||
result.isFound = fs.existsSync(result.exePath)
|
||||
if (result.isFound) {
|
||||
const propertiesFile = path.join(
|
||||
ANDROID_SDK_ROOT,
|
||||
'cmdline-tools',
|
||||
'latest',
|
||||
'source.properties'
|
||||
)
|
||||
if (fs.existsSync(propertiesFile)) {
|
||||
result.isCorrectVersion = fs
|
||||
.readFileSync(propertiesFile, 'utf8')
|
||||
.includes(`Pkg.Revision=${CMDLINE_TOOLS_VERSION}`)
|
||||
}
|
||||
return result
|
||||
}
|
||||
result.exePath = ''
|
||||
|
|
Loading…
Reference in a new issue