Skip to content

Commit

Permalink
Bump Gradle and AGP to version 8 (#114)
Browse files Browse the repository at this point in the history
* Bump Gradle and AGP to version 8
Migrate Android support to AndroidX

* Update java and Android tools in semaphore config
  • Loading branch information
koral-- authored Jul 27, 2023
1 parent 90930a8 commit b018c02
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ blocks:
jobs:
- name: Build
commands:
- wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip -O ~/android-commandline-tools.zip
- wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O ~/android-commandline-tools.zip
- mkdir -p ~/android-sdk/
- unzip ~/android-commandline-tools.zip -d ~/android-sdk/cmdline-tools/
- mv ~/android-sdk/cmdline-tools/cmdline-tools/ ~/android-sdk/cmdline-tools/latest
- export PATH=$PATH:~/android-sdk/cmdline-tools/latest/bin
- yes | sdkmanager "ndk;23.0.7599858"
- export PATH=$PATH:~/android-sdk/ndk/23.0.7599858/
- yes | sdkmanager "ndk;25.2.9519653"
- export PATH=$PATH:~/android-sdk/ndk/25.2.9519653/
- export ANDROID_SDK_ROOT=~/android-sdk
- checkout
- sem-version java 11
- sem-version java 17
- ./gradlew build
- artifact push job app/build/outputs/apk/release/app-release.apk
11 changes: 5 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
}

android {
compileSdkVersion 33
compileSdk 33

signingConfigs {
debug {
Expand Down Expand Up @@ -45,16 +45,15 @@ android {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}

lintOptions {
namespace 'jp.co.cyberagent.stf'
lint {
informational 'ExpiredTargetSdkVersion'
}

}

dependencies {
//TODO consider migrating to androidx
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.core:core:1.10.1'
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
compileOnly fileTree(dir: '../shim/libs', include: ['*.jar'])
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="jp.co.cyberagent.stf">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/jp/co/cyberagent/stf/IdentityActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Gravity;
Expand All @@ -19,6 +17,9 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

Expand Down Expand Up @@ -151,7 +152,8 @@ private void unlock() {
}

public static class IntentBuilder {
@Nullable private String serial;
@Nullable
private String serial;

public IntentBuilder() {
}
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/jp/co/cyberagent/stf/MinitouchAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.Display;
import android.view.InputDevice;
Expand All @@ -45,7 +44,6 @@
import jp.co.cyberagent.stf.compat.WindowManagerWrapper;
import jp.co.cyberagent.stf.util.InternalApi;

@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class MinitouchAgent extends Thread {
private static final String TAG = MinitouchAgent.class.getSimpleName();
private static final String SOCKET = "minitouchagent";
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/jp/co/cyberagent/stf/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import android.os.Build;
import android.os.IBinder;
import android.os.Process;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;

import android.util.Log;

import com.google.protobuf.InvalidProtocolBufferException;
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.0.2'
}
}

Expand All @@ -14,7 +14,7 @@ allprojects {
google()
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
Expand Down
7 changes: 6 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
android.enableJetifier=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
24 changes: 16 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down

0 comments on commit b018c02

Please sign in to comment.