Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

构建配置优化 #652

Merged
merged 3 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions apkbuilder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ plugins {
}

android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
minSdk = versions.mini
targetSdk = versions.target
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
12 changes: 4 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import java.util.Properties
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
id("com.jakewharton.butterknife")
id("kotlin-kapt")
}
Expand All @@ -26,9 +25,7 @@ if (propFile.exists()) {
// }
//}
android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
applicationId = "org.autojs.autoxjs"
minSdk = versions.mini
Expand Down Expand Up @@ -60,8 +57,7 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
composeOptions {
kotlinCompilerExtensionVersion = "1.2.0-rc01"
kotlinCompilerVersion = "1.6.20"
kotlinCompilerExtensionVersion = compose_version
}
signingConfigs {
if (propFile.exists()) {
Expand Down Expand Up @@ -188,7 +184,7 @@ dependencies {
implementation("androidx.compose.material:material:$compose_version")
implementation("androidx.compose.ui:ui-tooling-preview:$compose_version")
implementation("androidx.activity:activity-compose:1.3.1")
implementation("org.chromium.net:cronet-embedded:76.3809.111")
// implementation("org.chromium.net:cronet-embedded:76.3809.111")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version")
debugImplementation("androidx.compose.ui:ui-tooling:$compose_version")

Expand All @@ -197,7 +193,7 @@ dependencies {
exclude(group = "com.android.support", module = "support-annotations")
}
testImplementation("junit:junit:4.13.2")
// Kotlin
// Kotlin携程
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2")
// Android Annotations
annotationProcessor("org.androidannotations:androidannotations:$AAVersion")
Expand Down Expand Up @@ -288,7 +284,7 @@ dependencies {
implementation(project(":apkbuilder"))
implementation("androidx.multidex:multidex:2.0.1")

val lifecycle_version = "2.5.0-rc01"
val lifecycle_version = "2.5.1"
// ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
// ViewModel utilities for Compose
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/autojs/autojs/ui/widget/EWebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import com.stardust.autojs.script.StringScriptSource
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import org.autojs.autojs.Pref
import org.autojs.autoxjs.R
import org.autojs.autojs.model.script.Scripts
import org.autojs.autojs.tool.ImageSelector
import org.autojs.autoxjs.R
import java.io.File
import java.io.IOException
import java.io.InputStream
Expand Down Expand Up @@ -183,7 +183,7 @@ open class EWebView : FrameLayout, SwipeRefreshLayout.OnRefreshListener,
setNeedInitialFocus(true);
saveFormData = true;
cacheMode = android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK //使用缓存
setAppCacheEnabled(false);
// setAppCacheEnabled(false);
domStorageEnabled = true
databaseEnabled = true //开启 database storage API 功能
pluginState = android.webkit.WebSettings.PluginState.ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SwipeRefreshWebView : ThemeColorSwipeRefreshLayout {
setNeedInitialFocus(true);
saveFormData = true;
cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK //使用缓存
setAppCacheEnabled(false);
// setAppCacheEnabled(false);
domStorageEnabled = true
databaseEnabled = true //开启 database storage API 功能
pluginState = WebSettings.PluginState.ON
Expand Down
9 changes: 1 addition & 8 deletions autojs/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-android-extensions")
}

android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
minSdk = versions.mini
targetSdk = versions.target
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -22,11 +19,7 @@ android {
}


compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
lintOptions.isAbortOnError = false
lint.abortOnError = false
sourceSets {
named("main") {
// jniLibs.srcDirs = listOf("src/main/jniLibs")
Expand Down
24 changes: 12 additions & 12 deletions autojs/src/main/assets/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,33 @@ runtime.init();
}
};

// 初始化基础模块
global.timers = require('__timers__.js')(runtime, global);
// 初始化基础模块
global.timers = require('__timers__.js')(runtime, global);

//初始化不依赖环境的模块
global.JSON = require('__json2__.js');
global.util = global.$util = require('__util__.js');
global.device = runtime.device;
//初始化不依赖环境的模块
global.JSON = require('__json2__.js');
global.util = global.$util = require('__util__.js');
global.device = runtime.device;

global.process = require('process')
global.Promise = require('bluebird.js');
global.process = require('process')
global.Promise = require('bluebird');

//设置JavaScriptBridges用于与Java层的交互和数据转换
runtime.bridges.setBridges(require('__bridges__.js'));
//设置JavaScriptBridges用于与Java层的交互和数据转换
runtime.bridges.setBridges(require('__bridges__.js'));

//初始化全局函数
require("__globals__")(runtime, global);
//初始化一般模块
(function (scope) {
var modules = ['app', 'automator', 'console', 'dialogs', 'files', 'io', 'selector', 'shell', 'web', 'ui',
"images", "threads", "events", "engines", "RootAutomator", "http", "storages", "floaty",
"sensors", "media", "plugins", "continuation", "$zip", "$base64", "$crypto","paddle"];
"sensors", "media", "plugins", "continuation", "$zip", "$base64", "$crypto", "paddle"];
var len = modules.length;
for (var i = 0; i < len; i++) {
var m = modules[i];
let module = require('__' + m + '__')(scope.runtime, scope);
scope[m] = module;
if(!m.startsWith('$')) {
if (!m.startsWith('$')) {
scope['$' + m] = module;
}
}
Expand Down
50 changes: 27 additions & 23 deletions autojs/src/main/assets/modules/axios/browser-libs/XMLHttpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,32 +126,36 @@
setReadonlyAttribute(xhr, '_call', call, false);
call.enqueue({
onFailure(call, e) {
xhr._setReadyState(4);
setReadonlyAttribute(xhr, 'statusText', e.message)
if (e instanceof InterruptedIOException) {
xhr.dispatchEvent(new Event('timeout'));
}
xhr.dispatchEvent(new Event('error'))
xhr.dispatchEvent(new Event('loadend'))
atl.removeTask()
},
onResponse(call, res) {
setReadonlyAttribute(xhr, 'status', res.code());
setReadonlyAttribute(xhr, 'statusText', res.message());
setReadonlyAttribute(xhr, 'responseURL', res.request().url().toString())
setReadonlyAttribute(xhr, '_resHeaders', res.headers(), false)
xhr._setReadyState(2);
try {
XMLHttpRequest._parserResBody
.parser(xhr.responseType, xhr, res.body());

} catch (e) {
res.close();
setImmediate(() => {
xhr._setReadyState(4);
setReadonlyAttribute(xhr, 'statusText', e.message)
if (e instanceof InterruptedIOException) {
xhr.dispatchEvent(new Event('timeout'));
}
xhr.dispatchEvent(new Event('error'))
xhr.dispatchEvent(new Event('loadend'))
}
atl.removeTask();
atl.removeTask()
})
},
onResponse(call, res) {
setImmediate(() => {
setReadonlyAttribute(xhr, 'status', res.code());
setReadonlyAttribute(xhr, 'statusText', res.message());
setReadonlyAttribute(xhr, 'responseURL', res.request().url().toString())
setReadonlyAttribute(xhr, '_resHeaders', res.headers(), false)
xhr._setReadyState(2);
try {
XMLHttpRequest._parserResBody
.parser(xhr.responseType, xhr, res.body());

} catch (e) {
res.close();
xhr._setReadyState(4);
xhr.dispatchEvent(new Event('error'))
xhr.dispatchEvent(new Event('loadend'))
}
atl.removeTask();
})
}
})
}
Expand Down
4 changes: 3 additions & 1 deletion autojs/src/main/assets/modules/npm/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ function addTask(th, fn, callback) {
})
}
function createThread() {
return threads.start(() => {
let th = threads.start(() => {
setInterval(() => { }, 1000)
})
th.waitFor()
return th
}

stream.fromInputStream = function (inp, options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;

import com.stardust.autojs.core.graphics.ScriptCanvasView;
import com.stardust.autojs.core.ui.inflater.DynamicLayoutInflater;
Expand Down
5 changes: 1 addition & 4 deletions automator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-android-extensions")
}

android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
minSdk = versions.mini
targetSdk = versions.target
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
lintOptions.isAbortOnError = false
lint.abortOnError = false
buildTypes {
named("release") {
isMinifyEnabled = false
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ buildscript {
maven("https://maven.aliyun.com/repository/central")
google { url = uri("https://maven.aliyun.com/repository/google") }
mavenCentral { url = uri("https://maven.aliyun.com/repository/public") }
// maven { url = uri("https://jitpack.io") }
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.2")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ data class Versions(
@SerializedName("appVersionName")
val appVersionName: String = "6.3.4",
@SerializedName("buildTool")
val buildTool: String = "32.0.0",
val buildTool: String = "33.0.0",
@SerializedName("compile")
val compile: Int = 0,
val compile: Int = 33,
@SerializedName("devVersionCode")
val devVersionCode: Int = 634,
@SerializedName("devVersionName")
Expand Down
1 change: 0 additions & 1 deletion ci_test.txt

This file was deleted.

3 changes: 0 additions & 3 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-android-extensions")
}

android {

buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
Expand Down
7 changes: 7 additions & 0 deletions dependencies.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
library("okhttp", "com.squareup.okhttp3:okhttp:4.10.0")
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ org.gradle.caching=true

android.useAndroidX=true
android.enableJetifier=true
android.useDeprecatedNdk=true
#android.useDeprecatedNdk=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
8 changes: 1 addition & 7 deletions inrt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import kotlin.collections.*
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
}

val propFile: File = File("E:/资料/jks/autojs-inrt/sign.properties");
Expand All @@ -16,7 +15,6 @@ if (propFile.exists()) {
}

android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile
defaultConfig {
applicationId = "org.autojs.autoxjs.inrt"
Expand All @@ -40,11 +38,7 @@ android {
add("MissingTranslation")
add("ExtraTranslation")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
encoding = "utf-8"
}

signingConfigs {
if (propFile.exists()) {
getByName("release") {
Expand Down
8 changes: 5 additions & 3 deletions paddleocr/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ plugins {
}

android {
buildToolsVersion = versions.buildTool
compileSdk = versions.compile

defaultConfig {
minSdk = versions.mini
targetSdk = versions.target
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildTypes {
named("release") {
isMinifyEnabled = false
Expand All @@ -28,7 +30,7 @@ android {
}

dependencies {
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation(libs.okhttp)
implementation("androidx.core:core-ktx:1.8.0")
}
dependencies {
Expand Down
Loading
Loading