mirror of
https://gitea.com/actions/setup-android.git
synced 2025-12-12 19:36:59 +00:00
[2/2] Read version of cmdline-tools/latest, if version is correct - use it
This commit is contained in:
6
dist/index.js
vendored
6
dist/index.js
vendored
@@ -8591,9 +8591,9 @@ function findPreinstalledSdkManager() {
|
|||||||
if (result.isFound) {
|
if (result.isFound) {
|
||||||
const propertiesFile = path.join(ANDROID_SDK_ROOT, 'cmdline-tools', 'latest', 'source.properties');
|
const propertiesFile = path.join(ANDROID_SDK_ROOT, 'cmdline-tools', 'latest', 'source.properties');
|
||||||
if (fs.existsSync(propertiesFile)) {
|
if (fs.existsSync(propertiesFile)) {
|
||||||
const correctRevisionString = `Pkg.Revision=${CMDLINE_TOOLS_VERSION}`;
|
result.isCorrectVersion = fs
|
||||||
console.log(correctRevisionString);
|
.readFileSync(propertiesFile, 'utf8')
|
||||||
result.isCorrectVersion = fs.readFileSync(propertiesFile, 'utf8').includes(correctRevisionString);
|
.includes(`Pkg.Revision=${CMDLINE_TOOLS_VERSION}`);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/main.ts
11
src/main.ts
@@ -48,6 +48,17 @@ function findPreinstalledSdkManager(): {
|
|||||||
result.exePath = getSdkManagerPath('latest')
|
result.exePath = getSdkManagerPath('latest')
|
||||||
result.isFound = fs.existsSync(result.exePath)
|
result.isFound = fs.existsSync(result.exePath)
|
||||||
if (result.isFound) {
|
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
|
return result
|
||||||
}
|
}
|
||||||
result.exePath = ''
|
result.exePath = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user