diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index ce1c8b4..b833ce4 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -13,6 +13,7 @@ jobs: matrix: java: [ '17' ] + environment: build steps: - uses: actions/checkout@v3 - name: set up JDK ${{ matrix.java }} @@ -27,6 +28,9 @@ jobs: ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVENCENTRALPASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + REMOTE_CACHE_URL: ${{ secrets.REMOTE_CACHE_URL }} + REMOTE_CACHE_USER: ${{ secrets.REMOTE_CACHE_USER }} + REMOTE_CACHE_PASS: ${{ secrets.REMOTE_CACHE_PASS }} run: ./gradlew clean build - uses: actions/upload-artifact@v3 with: diff --git a/README.md b/README.md index 8fafc68..872249a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Android tool to output the contents sizes of saved state bundles in onSaveInstan ## Usage To use in debug builds only use: ```Gradle -debugImplementation 'com.pnuema.android:savestateobserver:2.8.0' +debugImplementation 'com.pnuema.android:savestateobserver:2.10.0' ``` Once it has been included as a dependency it will listen for lifecycle state changes and output the following information without any code being inserted in your codebase. diff --git a/app/build.gradle b/app/build.gradle index 8da6a9e..82d92a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,12 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + id 'com.android.application' + alias(libs.plugins.kotlin.android) + alias(libs.plugins.maven.publish) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.dokka) + alias(libs.plugins.toml.version.checker) +} + android { namespace = 'com.pnuema.android.savestateobserver.app' compileSdkVersion 33 @@ -37,8 +44,8 @@ android { dependencies { implementation project(":savestateobserver") - implementation 'com.google.android.material:material:1.8.0' - implementation 'androidx.fragment:fragment-ktx:1.5.6' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.startup:startup-runtime:1.1.1' + implementation (libs.android.material) + implementation (libs.androidx.fragment.ktx) + implementation (libs.androidx.appcompat) + implementation (libs.androidx.startup) } diff --git a/build.gradle b/build.gradle index a965f65..0de7552 100644 --- a/build.gradle +++ b/build.gradle @@ -1,28 +1,18 @@ -apply plugin: 'maven-publish' -apply plugin: "com.vanniktech.maven.publish" - -wrapper { - gradleVersion = '8.1' -} - buildscript { - ext.kotlin_version = '1.8.20' - repositories { google() mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:8.0.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10" - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.25.1' + mavenLocal() } } -allprojects { - repositories { - google() - mavenCentral() - } +plugins { + alias(libs.plugins.androidLibrary).apply(false) + alias(libs.plugins.kotlin.android).apply(false) + alias(libs.plugins.maven.publish).apply(false) + alias(libs.plugins.gradle.cachefix).apply(false) } + +wrapper { + gradleVersion = '8.1.1' +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 60ea68f..237fab9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ android.useAndroidX=true android.enableJetifier=false GROUP=com.pnuema.android -VERSION_NAME=2.9.0 +VERSION_NAME=2.10.0 POM_NAME=SaveStateObserver POM_ARTIFACT_ID=savestateobserver diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..cb7daab --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,37 @@ +[versions] +#libs +kotlinx-serialization = "1.5.0" +vanniktech-maven-publish = "0.25.2" +evalex = "3.0.5" +androidx-startup = "1.1.1" +androidx-appcompat = "1.6.1" +androidx-fragment-ktx = "1.6.0" +android-material = "1.9.0" +junit = "4.13.2" + +#plugins +kotlin= "1.8.20" +gradlePlugins-agp = "8.0.2" +tomlChecker = "0.47.0" +gradleCacheFix = "2.7.1" +dokka = "1.8.20" + +[libraries] +dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } +kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } +evalex = { module = "com.ezylang:EvalEx", version.ref = "evalex"} +androidx-startup = { module = "androidx.startup:startup-runtime", version.ref = "androidx-startup" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "androidx-fragment-ktx" } +android-material = { module = "com.google.android.material:material", version.ref = "android-material" } +junit = { module = "junit:junit", version.ref = "junit" } + +[plugins] +androidLibrary = { id = "com.android.library", version.ref = "gradlePlugins-agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-maven-publish" } +gradle-cachefix = { id = "org.gradle.android.cache-fix", version.ref = "gradleCacheFix" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +toml-version-checker = { id = "com.github.ben-manes.versions", version.ref = "tomlChecker" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c85a1f..37aef8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/savestateobserver/build.gradle b/savestateobserver/build.gradle index 3914565..e32b0f1 100644 --- a/savestateobserver/build.gradle +++ b/savestateobserver/build.gradle @@ -1,9 +1,13 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.dokka' -apply plugin: "com.vanniktech.maven.publish" +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.maven.publish) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.dokka) + alias(libs.plugins.toml.version.checker) +} -version = "2.9.0" +version = "2.10.0" group = "com.pnuema.android" archivesBaseName = 'savestateobserver' @@ -47,9 +51,9 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.startup:startup-runtime:1.1.1' - testImplementation 'junit:junit:4.13.2' + implementation (libs.androidx.appcompat) + implementation (libs.androidx.startup) + testImplementation (libs.junit) } dokkaHtml.configure { diff --git a/settings.gradle b/settings.gradle index acb75dc..a067e94 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,57 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +plugins { + id "com.gradle.enterprise" version "3.13.3" +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + maven { url "https://plugins.gradle.org/m2/" } + gradlePluginPortal() + google() + mavenCentral() + } +} + +gradleEnterprise { + buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } +} + +def cacheUrl = System.getenv("REMOTE_CACHE_URL") == null ? settings["REMOTE_CACHE_URL"] : "${System.getenv("REMOTE_CACHE_URL")}" + +if (cacheUrl != null) { + buildCache { + local { + removeUnusedEntriesAfterDays = 30 + } + + remote(HttpBuildCache) { + url = cacheUrl + enabled = true + push = true + allowUntrustedServer = true + allowInsecureProtocol = false + if (enabled) { + println "Using remote build cache: " + cacheUrl + } + credentials { + username = System.getenv("REMOTE_CACHE_USER") == null ? settings['REMOTE_CACHE_USER'] : "${System.getenv("REMOTE_CACHE_USER")}" + password = System.getenv("REMOTE_CACHE_PASS") == null ? settings['REMOTE_CACHE_PASS'] : "${System.getenv("REMOTE_CACHE_PASS")}" + } + } + } +} else { + println "Not using remote build cache!" +} + include ':savestateobserver', ':app'