From 1ded27b16426275f7ecd1c28dc8de09bb3128d7e Mon Sep 17 00:00:00 2001 From: Yang Date: Sat, 28 Aug 2021 17:59:37 +1000 Subject: [PATCH] build-tools to 31.0.0; SDK cmd-line tools to 5.0. (#174) * Update build-tools to 31.0.0. Add API 31 emulator to workflow. Update SDK command-line tools to 5.0 * Update test fixture dependencies. * Test API 31 with macos-11. * Add android:exported to AndroidManifest. * Format --- .github/workflows/workflow.yml | 14 +++++++++----- lib/input-validator.js | 10 +--------- lib/sdk-installer.js | 6 +++--- src/sdk-installer.ts | 6 +++--- test-fixture/app/build.gradle | 15 ++++++--------- test-fixture/app/src/main/AndroidManifest.xml | 4 +++- .../app/src/main/res/layout/activity_main.xml | 9 +++------ test-fixture/build.gradle | 4 ++-- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 31 insertions(+), 39 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a9ec3fb1..82ec0720 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -18,6 +18,7 @@ jobs: os: [macos-latest, ubuntu-latest] api-level: [16, 23, 29] target: [default, google_apis] + arch: [x86] exclude: - os: ubuntu-latest api-level: 23 @@ -30,15 +31,18 @@ jobs: - target: google_apis api-level: 29 include: - - os: macos-11 - api-level: 30 - target: google_apis - os: macos-latest api-level: 24 target: playstore + arch: x86 - os: macos-latest api-level: 28 target: google_apis + arch: x86 + - os: macos-11 + api-level: 31 + target: google_apis + arch: x86_64 steps: - name: checkout @@ -84,7 +88,7 @@ jobs: with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} - arch: x86 + arch: ${{ matrix.arch }} profile: Galaxy Nexus cores: 2 sdcard-path-or-size: 100M @@ -100,7 +104,7 @@ jobs: with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} - arch: x86 + arch: ${{ matrix.arch }} profile: Galaxy Nexus cores: 2 ram-size: 2048M diff --git a/lib/input-validator.js b/lib/input-validator.js index 58346435..206738fb 100644 --- a/lib/input-validator.js +++ b/lib/input-validator.js @@ -2,15 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.checkEmulatorBuild = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkForceAvdCreation = exports.checkArch = exports.checkTarget = exports.checkApiLevel = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0; exports.MIN_API_LEVEL = 15; -exports.VALID_TARGETS = [ - 'default', - 'google_apis', - 'google_apis_playstore', - 'android-wear', - 'android-wear-cn', - 'android-tv', - 'google-tv' -]; +exports.VALID_TARGETS = ['default', 'google_apis', 'google_apis_playstore', 'android-wear', 'android-wear-cn', 'android-tv', 'google-tv']; exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a']; function checkApiLevel(apiLevel) { if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) { diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index b9d80e2a..80c02a4d 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -34,9 +34,9 @@ const exec = __importStar(require("@actions/exec")); const io = __importStar(require("@actions/io")); const tc = __importStar(require("@actions/tool-cache")); const fs = __importStar(require("fs")); -const BUILD_TOOLS_VERSION = '30.0.3'; -const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip'; -const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip'; +const BUILD_TOOLS_VERSION = '31.0.0'; +const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip'; +const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * and the system image for the chosen API level, CPU arch, and target. diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index f7e25fcf..47971622 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -4,9 +4,9 @@ import * as io from '@actions/io'; import * as tc from '@actions/tool-cache'; import * as fs from 'fs'; -const BUILD_TOOLS_VERSION = '30.0.3'; -const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip'; -const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip'; +const BUILD_TOOLS_VERSION = '31.0.0'; +const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip'; +const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, diff --git a/test-fixture/app/build.gradle b/test-fixture/app/build.gradle index 09ece342..a07d7aa0 100644 --- a/test-fixture/app/build.gradle +++ b/test-fixture/app/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdkVersion 31 + buildToolsVersion "31.0.0" defaultConfig { applicationId "com.example.testapp" minSdkVersion 15 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" @@ -26,10 +26,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'androidx.core:core-ktx:1.5.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - testImplementation 'junit:junit:4.13' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation 'androidx.appcompat:appcompat:1.3.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } diff --git a/test-fixture/app/src/main/AndroidManifest.xml b/test-fixture/app/src/main/AndroidManifest.xml index 1d8d8422..c3fb7827 100644 --- a/test-fixture/app/src/main/AndroidManifest.xml +++ b/test-fixture/app/src/main/AndroidManifest.xml @@ -9,7 +9,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/test-fixture/app/src/main/res/layout/activity_main.xml b/test-fixture/app/src/main/res/layout/activity_main.xml index 4fc24441..e9e5e85a 100644 --- a/test-fixture/app/src/main/res/layout/activity_main.xml +++ b/test-fixture/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - + android:layout_gravity="center" /> - \ No newline at end of file + \ No newline at end of file diff --git a/test-fixture/build.gradle b/test-fixture/build.gradle index b00e3395..f288a804 100644 --- a/test-fixture/build.gradle +++ b/test-fixture/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.5.30' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.1' + classpath 'com.android.tools.build:gradle:7.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index ca6c85c0..f956ad03 100644 --- a/test-fixture/gradle/wrapper/gradle-wrapper.properties +++ b/test-fixture/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip