diff --git a/build.gradle b/build.gradle index f06af1c5..0ffe9473 100644 --- a/build.gradle +++ b/build.gradle @@ -1,32 +1,8 @@ -buildscript { - - ext.kotlin_version = '1.4.10' - - repositories { - maven { url 'https://maven.aliyun.com/repository/public' } - maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } - maven { url 'https://maven.aliyun.com/repository/google' } - mavenCentral() - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - plugins { - id "org.jetbrains.intellij" version "0.4.2" + id "org.jetbrains.kotlin.jvm" version "1.5.21" + id "org.jetbrains.intellij" version "1.2.0" } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - - -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'kotlin-kapt' - - repositories { maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } @@ -35,6 +11,12 @@ repositories { jcenter() } +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + + + + sourceSets { main { resources { @@ -48,26 +30,32 @@ if (!hasProperty('StudioCompilePath')) { } intellij { - pluginName 'adb_idea' - updateSinceUntilBuild false + pluginName = 'adb_idea' + updateSinceUntilBuild = false + localPath = project.hasProperty("StudioRunPath") ? StudioRunPath : StudioCompilePath + instrumentCode { + compilerVersion = "212.4746.92" + } + instrumentTestCode { + compilerVersion = "212.4746.92" + } - intellij.localPath = project.hasProperty("StudioRunPath") ? StudioRunPath : StudioCompilePath } group 'com.developerphil.intellij.plugin.adbidea' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" - compile "org.jooq:joor-java-8:0.9.7" + implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21' + implementation 'org.jooq:joor-java-8:0.9.14' compileOnly fileTree(dir: "$StudioCompilePath/plugins/android/lib", include: ['*.jar']) compileOnly fileTree(dir: "$StudioCompilePath/lib", include: ['*.jar']) - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' testImplementation fileTree(dir: "$StudioCompilePath/plugins/android/lib", include: ['*.jar']) testImplementation fileTree(dir: "$StudioCompilePath/lib", include: ['*.jar']) testImplementation "org.mockito:mockito-core:1.+" - testImplementation "com.google.truth:truth:1.0.1" + testImplementation 'com.google.truth:truth:1.1.3' } @@ -82,4 +70,5 @@ task(verifySetup) { } -compileJava.dependsOn verifySetup \ No newline at end of file +compileJava.dependsOn verifySetup +buildSearchableOptions.enabled = false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f3d88b1c..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a95009c3..3c4101c3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 24467a14..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt b/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt index eda723ef..62e4318e 100644 --- a/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt +++ b/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt @@ -4,256 +4,17 @@ import com.android.ddmlib.* import com.android.ddmlib.log.LogReceiver import com.android.sdklib.AndroidVersion import java.io.File +import java.lang.reflect.Proxy import java.util.concurrent.Future import java.util.concurrent.TimeUnit -data class FakeDevice(private val serialNumber: String) : IDevice { - +data class FakeDevice(private val serialNumber: String) : IDevice by stub() { override fun getSerialNumber(): String { return serialNumber } +} - // --------------- - // NOT IMPLEMENTED - // --------------- - - override fun installRemotePackage(p0: String?, p1: Boolean, p2: InstallReceiver?, vararg p3: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun installRemotePackage(p0: String?, p1: Boolean, p2: InstallReceiver?, p3: Long, p4: Long, p5: TimeUnit?, vararg p6: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun installPackage(p0: String?, p1: Boolean, p2: InstallReceiver?, vararg p3: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun installPackage(p0: String?, p1: Boolean, p2: InstallReceiver?, p3: Long, p4: Long, p5: TimeUnit?, vararg p6: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Long, p3: Long, p4: TimeUnit?) { - throw UnsupportedOperationException("not implemented") - } - - override fun isOffline(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun startScreenRecorder(p0: String?, p1: ScreenRecorderOptions?, p2: IShellOutputReceiver?) { - throw UnsupportedOperationException("not implemented") - } - - override fun reboot(p0: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getMountPoint(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getClients(): Array { - throw UnsupportedOperationException("not implemented") - } - - override fun runLogService(p0: String?, p1: LogReceiver?) { - throw UnsupportedOperationException("not implemented") - } - - override fun installRemotePackage(p0: String?, p1: Boolean, vararg p2: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getVersion(): AndroidVersion { - throw UnsupportedOperationException("not implemented") - } - - override fun getClientName(p0: Int): String { - throw UnsupportedOperationException("not implemented") - } - - override fun isOnline(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun runEventLogService(p0: LogReceiver?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getLanguage(): String { - throw UnsupportedOperationException("not implemented") - } - - override fun root(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun isBootLoader(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun getSystemProperty(p0: String?): Future { - throw UnsupportedOperationException("not implemented") - } - - override fun isEmulator(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun getFileListingService(): FileListingService { - throw UnsupportedOperationException("not implemented") - } - - override fun isRoot(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun removeForward(p0: Int, p1: Int) { - throw UnsupportedOperationException("not implemented") - } - - override fun removeForward(p0: Int, p1: String?, p2: IDevice.DeviceUnixSocketNamespace?) { - throw UnsupportedOperationException("not implemented") - } - - override fun createForward(p0: Int, p1: Int) { - throw UnsupportedOperationException("not implemented") - } - - override fun createForward(p0: Int, p1: String?, p2: IDevice.DeviceUnixSocketNamespace?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getAbis(): MutableList { - throw UnsupportedOperationException("not implemented") - } - - override fun pushFile(p0: String?, p1: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun removeRemotePackage(p0: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getName(): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getClient(p0: String?): Client { - throw UnsupportedOperationException("not implemented") - } - - override fun getBattery(): Future { - throw UnsupportedOperationException("not implemented") - } - - override fun getBattery(p0: Long, p1: TimeUnit?): Future { - throw UnsupportedOperationException("not implemented") - } - - override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Int) { - throw UnsupportedOperationException("not implemented") - } - - override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?) { - throw UnsupportedOperationException("not implemented") - } - - override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Long, p3: TimeUnit?) { - throw UnsupportedOperationException("not implemented") - } - - override fun hasClients(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun getPropertySync(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getProperties(): MutableMap { - throw UnsupportedOperationException("not implemented") - } - - override fun getProperty(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getAvdName(): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getRegion(): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getState(): IDevice.DeviceState { - throw UnsupportedOperationException("not implemented") - } - - override fun getPropertyCacheOrSync(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun installPackages(p0: MutableList?, p1: Boolean, p2: MutableList?, p3: Long, p4: TimeUnit?) { - throw UnsupportedOperationException("not implemented") - } - - override fun pullFile(p0: String?, p1: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun getDensity(): Int { - throw UnsupportedOperationException("not implemented") - } - - override fun uninstallPackage(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun getSyncService(): SyncService { - throw UnsupportedOperationException("not implemented") - } - - override fun installPackage(p0: String?, p1: Boolean, vararg p2: String?) { - throw UnsupportedOperationException("not implemented") - } - - override fun syncPackageToDevice(p0: String?): String { - throw UnsupportedOperationException("not implemented") - } - - override fun arePropertiesSet(): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun supportsFeature(p0: IDevice.Feature?): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun supportsFeature(p0: IDevice.HardwareFeature?): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun getScreenshot(): RawImage { - throw UnsupportedOperationException("not implemented") - } - - override fun getScreenshot(p0: Long, p1: TimeUnit?): RawImage { - throw UnsupportedOperationException("not implemented") - } - - override fun getBatteryLevel(): Int { - throw UnsupportedOperationException("not implemented") - } - - override fun getBatteryLevel(p0: Long): Int { - throw UnsupportedOperationException("not implemented") - } - - override fun getPropertyCount(): Int { - throw UnsupportedOperationException("not implemented") - } -} \ No newline at end of file +inline fun stub(): T = Proxy.newProxyInstance( + T::class.java.classLoader, + arrayOf(T::class.java) +) { _, _, _ -> throw NotImplementedError() } as T \ No newline at end of file