diff --git a/build.gradle.kts b/build.gradle.kts index 918072cea4..69bb0791c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,25 +2,28 @@ buildscript { repositories { - jcenter() google() maven { setUrl("https://dl.google.com/dl/android/maven2/") } maven { setUrl("https://mirrors.huaweicloud.com/repository/maven/") } // Huawei Maven mirrors + jcenter() } dependencies { classpath("com.android.tools.build:gradle:${property("ANDROID_BUILD_VERSION")}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${property("KOTLIN_VERSION")}") -// classpath("guru.stefma.bintrayrelease:bintrayrelease:${property("BINTRAY_RELEASE_VERSION")}") classpath("com.novoda:bintray-release:0.9") } } allprojects { repositories { - jcenter() google() maven { setUrl("https://dl.google.com/dl/android/maven2/") } maven { setUrl("https://mirrors.huaweicloud.com/repository/maven/") } // Huawei Maven mirrors maven { setUrl("https://dl.bintray.com/panpf/maven") } + jcenter() } } + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} diff --git a/build_kotlin.gradle b/build_kotlin.gradle deleted file mode 100644 index 7c2be7a416..0000000000 --- a/build_kotlin.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -androidExtensions { - experimental = true -} - -dependencies{ - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION" - implementation "androidx.core:core-ktx:$ANDROIDX_CORE_KTX" -} \ No newline at end of file diff --git a/build_kotlin.gradle.kts b/build_kotlin.gradle.kts new file mode 100644 index 0000000000..1aceeef4e1 --- /dev/null +++ b/build_kotlin.gradle.kts @@ -0,0 +1,11 @@ +apply { from("kotlin-android")} +apply { from("kotlin-android-extensions")} + +//androidExtensions { +// experimental = true +//} + +dependencies{ + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${property("KOTLIN_VERSION")}") + implementation("androidx.core:core-ktx:${property("ANDROIDX_CORE_KTX")}") +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 413f05b8af..8495366cf7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,6 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -android.debug.obsoleteApi=true - # build KOTLIN_VERSION=1.3.11 ANDROID_BUILD_VERSION=3.3.0 @@ -53,4 +51,4 @@ EVENT_BUS_VERSION=3.0.0 RETROFIT_VERSION=2.3.0 LEAK_CANARY_ANDROID_VERSION=1.6.2 FLEXBOX=0.3.2 -PANPF_ANDROIDX=1.0.0-alpha2 \ No newline at end of file +PANPF_ANDROIDX=1.0.0-alpha3 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c2a120538..74c8fe38ea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Oct 19 11:18:57 CST 2018 +#Wed Jan 16 18:00:16 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip \ No newline at end of file diff --git a/sample-video-thumbnail/build.gradle b/sample-video-thumbnail/build.gradle deleted file mode 100644 index 276d007517..0000000000 --- a/sample-video-thumbnail/build.gradle +++ /dev/null @@ -1,80 +0,0 @@ -apply plugin: 'com.android.application' -apply from: '../build_kotlin.gradle' - -Properties localProperties = openProperties("local.properties") -String jksFileName = localProperties.getProperty("sample.storeFile") -File jksFile = jksFileName != null && "" != jksFileName.trim() ? file(jksFileName) : null - -android { - compileSdkVersion COMPILE_SDK_VERSION.toInteger() - - defaultConfig { - applicationId "me.panpf.sketch.sample.videothumbnail" - - minSdkVersion MIN_SDK_VERSION.toInteger() - targetSdkVersion TARGET_SDK_VERSION.toInteger() - versionCode VERSION_CODE.toInteger() - versionName VERSION_NAME - - ndk { - abiFilters "armeabi", 'x86' - } - } - - signingConfigs { - release { - storeFile jksFile - storePassword localProperties.getProperty('sample.storePassword') - keyAlias localProperties.getProperty('sample.keyAlias') - keyPassword localProperties.getProperty('sample.keyPassword') - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation project(':sketch') - - implementation "androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT" - implementation "androidx.recyclerview:recyclerview:$ANDROIDX_RECYCLERVIEW" - implementation "androidx.constraintlayout:constraintlayout:$ANDROIDX_CONSTRAINTLAYOUT" - - implementation "androidx.lifecycle:lifecycle-extensions:$ANDROIDX_LIFECYCLE" - implementation "androidx.lifecycle:lifecycle-viewmodel:$ANDROIDX_LIFECYCLE" - implementation "androidx.lifecycle:lifecycle-livedata:$ANDROIDX_LIFECYCLE" - kapt "androidx.lifecycle:lifecycle-compiler:$ANDROIDX_LIFECYCLE" - implementation "androidx.paging:paging-runtime:$ANDROIDX_PAGING" - - implementation "me.panpf:assembly-adapter:$ASSEMBLY_ADAPTER_VERSION" - implementation "me.panpf:assembly-adapter-ktx:$ASSEMBLY_ADAPTER_VERSION" - implementation "me.panpf:assembly-paged-list-adapter:$ASSEMBLY_ADAPTER_VERSION" - implementation "me.panpf:androidx-kt:$PANPF_ANDROIDX" - implementation "me.panpf:androidx-kt-arch:$PANPF_ANDROIDX" - - implementation "com.github.wseemann:FFmpegMediaMetadataRetriever:$FFMPEG_MEDIA_METADATA_RETRIEVER_VERSION" - - debugImplementation "com.squareup.leakcanary:leakcanary-android:$LEAK_CANARY_ANDROID_VERSION" - debugImplementation "com.squareup.leakcanary:leakcanary-support-fragment:$LEAK_CANARY_ANDROID_VERSION" - releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY_ANDROID_VERSION" - testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY_ANDROID_VERSION" -} - -Properties openProperties(String fileName) { - File propertiesFile = new File(projectDir, fileName) - if (!propertiesFile.exists()) { - return new Properties() - } - FileInputStream inputStream = new FileInputStream(propertiesFile) - Properties properties = new Properties() - properties.load(inputStream) - inputStream.close() - return properties -} diff --git a/sample-video-thumbnail/build.gradle.kts b/sample-video-thumbnail/build.gradle.kts new file mode 100644 index 0000000000..63e15ab392 --- /dev/null +++ b/sample-video-thumbnail/build.gradle.kts @@ -0,0 +1,77 @@ +import com.android.build.gradle.BaseExtension +import org.jetbrains.kotlin.kapt3.base.Kapt.kapt +import java.util.Properties + +plugins { + id("com.android.application") + kotlin("android") + kotlin("android.extensions") +} +//apply { from("../build_kotlin.gradle") } + +val localProperties = Properties().apply { project.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) } }.takeIf { !it.isEmpty } +val jksFile = localProperties?.getProperty("sample.storeFile")?.let { file(it) } ?: null + +configure { + compileSdkVersion(property("COMPILE_SDK_VERSION").toString().toInt()) + + defaultConfig { + applicationId = "me.panpf.sketch.sample.videothumbnail" + + minSdkVersion(property("MIN_SDK_VERSION").toString().toInt()) + targetSdkVersion(property("TARGET_SDK_VERSION").toString().toInt()) + versionCode = property("VERSION_CODE").toString().toInt() + versionName = property("VERSION_NAME").toString() + + ndk { + abiFilters("armeabi", "x86") + } + } + + signingConfigs { + create("release"){ + storeFile = jksFile + storePassword = localProperties?.getProperty ("sample.storePassword") + keyAlias = localProperties?.getProperty ("sample.keyAlias") + keyPassword = localProperties?.getProperty ("sample.keyPassword") + } + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile ("proguard-android.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("release") + } + } +} + +dependencies { + implementation(project(":sketch")) + + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${property("KOTLIN_VERSION")}") + implementation("androidx.core:core-ktx:${property("ANDROIDX_CORE_KTX")}") + + implementation("androidx.appcompat:appcompat:${property("ANDROIDX_APPCOMPAT")}") + implementation("androidx.recyclerview:recyclerview:${property("ANDROIDX_RECYCLERVIEW")}") + implementation("androidx.constraintlayout:constraintlayout:${property("ANDROIDX_CONSTRAINTLAYOUT")}") + + implementation("androidx.lifecycle:lifecycle-extensions:${property("ANDROIDX_LIFECYCLE")}") + implementation("androidx.lifecycle:lifecycle-viewmodel:${property("ANDROIDX_LIFECYCLE")}") + implementation("androidx.lifecycle:lifecycle-livedata:${property("ANDROIDX_LIFECYCLE")}") + kapt("androidx.lifecycle:lifecycle-compiler:${property("ANDROIDX_LIFECYCLE")}") + implementation("androidx.paging:paging-runtime:${property("ANDROIDX_PAGING")}") + + implementation("me.panpf:assembly-adapter:${property("ASSEMBLY_ADAPTER_VERSION")}") + implementation("me.panpf:assembly-adapter-ktx:${property("ASSEMBLY_ADAPTER_VERSION")}") + implementation("me.panpf:assembly-paged-list-adapter:${property("ASSEMBLY_ADAPTER_VERSION")}") + implementation("me.panpf:androidx-kt:${property("PANPF_ANDROIDX")}") + implementation("me.panpf:androidx-kt-arch:${property("PANPF_ANDROIDX")}") + + implementation("com.github.wseemann:FFmpegMediaMetadataRetriever:${property("FFMPEG_MEDIA_METADATA_RETRIEVER_VERSION")}") + + debugImplementation("com.squareup.leakcanary:leakcanary-android:${property("LEAK_CANARY_ANDROID_VERSION")}") + debugImplementation("com.squareup.leakcanary:leakcanary-support-fragment:${property("LEAK_CANARY_ANDROID_VERSION")}") + releaseImplementation("com.squareup.leakcanary:leakcanary-android-no-op:${property("LEAK_CANARY_ANDROID_VERSION")}") + testImplementation("com.squareup.leakcanary:leakcanary-android-no-op:${property("LEAK_CANARY_ANDROID_VERSION")}") +} diff --git a/sample/build.gradle b/sample/build.gradle index 40e06cc64a..6894d7cf42 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -60,11 +60,6 @@ android { abortOnError false } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - aaptOptions { noCompress "bmp" } diff --git a/settings.gradle.kts b/settings.gradle.kts index d1b6eaffd4..57b088a10c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ include( // ":sample", ":sketch" -// ":sketch-gif" -// , ":sample-video-thumbnail" + ,":sketch-gif" + , ":sample-video-thumbnail" ) \ No newline at end of file diff --git a/sketch-gif/build.gradle.kts b/sketch-gif/build.gradle.kts index ad050bbcc2..2ed6235b92 100644 --- a/sketch-gif/build.gradle.kts +++ b/sketch-gif/build.gradle.kts @@ -1,9 +1,9 @@ import com.android.build.gradle.BaseExtension import com.novoda.gradle.release.PublishExtension +import java.util.Properties plugins { id("com.android.library") -// id("guru.stefma.bintrayrelease") id("com.novoda.bintray-release") } @@ -31,24 +31,6 @@ dependencies { implementation("androidx.annotation:annotation:${property("ANDROIDX_ANNOTATION")}") } -//apply { from("build_upload.gradle.kts") } - -//Properties().apply { project.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) } }.takeIf { !it.isEmpty }?.let { localProperties -> -// // apply { plugin("guru.stefma.bintrayrelease") } -// -//// version = android.defaultConfig.versionName -// version = property("VERSION_NAME").toString() -// group = "me.panpf" -// configure { -// artifactId = "sketch-gif" -// desc = "Android, Image, Load, GIF" -// website = "https://github.com/panpf/sketch" -// userOrg = localProperties.getProperty("bintray.userOrg") -// bintrayUser = localProperties.getProperty("bintray.user") -// bintrayKey = localProperties.getProperty("bintray.apikey") -// } -//} - Properties().apply { project.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) } }.takeIf { !it.isEmpty }?.let { localProperties -> configure { groupId = "me.panpf" diff --git a/sketch-gif/build_upload.gradle.kts b/sketch-gif/build_upload.gradle.kts deleted file mode 100644 index 82ac818f0f..0000000000 --- a/sketch-gif/build_upload.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -//import com.android.build.gradle.internal.publishing.AndroidArtifacts -//import java.util.* -//import guru.stefma.bintrayrelease.PublishExtension -// -//Properties().apply { project.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) } }.takeIf { !it.isEmpty }?.let { localProperties -> -//// apply { plugin("guru.stefma.bintrayrelease") } -// -//// version = android.defaultConfig.versionName -// version = property("VERSION_NAME").toString() -// group = "me.panpf" -// configure { -// artifactId = "sketch-gif" -// desc = "Android, Image, Load, GIF" -// website = "https://github.com/panpf/sketch" -// userOrg = localProperties.getProperty("bintray.userOrg") -// bintrayUser = localProperties.getProperty("bintray.user") -// bintrayKey = localProperties.getProperty("bintray.apikey") -// } -//} \ No newline at end of file diff --git a/sketch/build.gradle.kts b/sketch/build.gradle.kts index b2050970ad..a2d5a3bb47 100644 --- a/sketch/build.gradle.kts +++ b/sketch/build.gradle.kts @@ -1,10 +1,11 @@ import com.android.build.gradle.BaseExtension +import com.novoda.gradle.release.PublishExtension +import java.util.Properties plugins { id("com.android.library") + id("com.novoda.bintray-release") } -//apply(plugin = "com.android.library") -//apply(from = "build_test.gradle") configure { compileSdkVersion(property("COMPILE_SDK_VERSION").toString().toInt()) @@ -16,6 +17,8 @@ configure { versionName = property("VERSION_NAME").toString() consumerProguardFiles("proguard-rules.pro") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -29,6 +32,22 @@ configure { dependencies { compileOnly(project(":sketch-gif")) implementation("androidx.annotation:annotation:${property("ANDROIDX_ANNOTATION")}") + + testImplementation("junit:junit:${property("JUNIT_VERSION")}") + androidTestImplementation("com.android.support.test:runner:${property("ANDROIDX_TEST_RUNNER")}") + androidTestImplementation("com.android.support.test:rules:${property("ANDROIDX_TEST_RULES")}") + androidTestImplementation("androidx.test.espresso:espresso-core:${property("ANDROIDX_TEST_ESPRESSO")}") } -//apply(from = "build_upload.gradle") +Properties().apply { project.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) } }.takeIf { !it.isEmpty }?.let { localProperties -> + configure { + groupId = "me.panpf" + artifactId = "sketch" + publishVersion = property("VERSION_NAME").toString() + desc = "Android, Image, Load, GIF" + website = "https://github.com/panpf/sketch" + userOrg = localProperties.getProperty("bintray.userOrg") + bintrayUser = localProperties.getProperty("bintray.user") + bintrayKey = localProperties.getProperty("bintray.apikey") + } +} diff --git a/sketch/build_test.gradle.kts b/sketch/build_test.gradle.kts deleted file mode 100644 index 7a3f183bee..0000000000 --- a/sketch/build_test.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -import org.gradle.internal.impldep.com.amazonaws.PredefinedClientConfigurations.defaultConfig - -android { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - // config espresso test runner - } - - // runner 和 espresso-web 里都包含了 这两个文件,冲突了 -// packagingOptions { -// exclude "META-INF/maven/com.google.guava/guava/pom.xml" -// exclude "META-INF/maven/com.google.guava/guava/pom.properties" -// } -} - -dependencies { - testImplementation("junit:junit:${("JUNIT_VERSION")}") - androidTestImplementation("com.android.support.test:runner:${("ANDROIDX_TEST_RUNNER")}") - androidTestImplementation("com.android.support.test:rules:${("ANDROIDX_TEST_RULES")}") - androidTestImplementation("androidx.test.espresso:espresso-core:${("ANDROIDX_TEST_ESPRESSO")}") -} \ No newline at end of file diff --git a/sketch/build_upload.gradle.kts b/sketch/build_upload.gradle.kts deleted file mode 100644 index 69388b2b68..0000000000 --- a/sketch/build_upload.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -//def localProperties = new Properties() -//def inputStream -//try { -// inputStream = project.file("local.properties").newDataInputStream() -// localProperties.load(inputStream) -//} catch (IOException e) { -// e.printStackTrace() -//} finally { -// if (inputStream != null) inputStream.close() -//} -//if (!localProperties.isEmpty()) { -// apply plugin: "guru.stefma.bintrayrelease" -// -// version = android.defaultConfig.versionName -// group = 'me.panpf' -// publish { -// artifactId = 'sketch' -// desc = 'Android, Image, Load, GIF' -// website = 'https://github.com/panpf/sketch' -// userOrg = localProperties.getProperty("bintray.userOrg") -// bintrayUser = localProperties.getProperty("bintray.user") -// bintrayKey = localProperties.getProperty("bintray.apikey") -// } -//}