From e5c028d577955b96636238d4ef89f90febca7b22 Mon Sep 17 00:00:00 2001 From: Pranav Pandey Date: Fri, 19 Jul 2024 14:39:00 +0530 Subject: [PATCH] Gradle plugin 8.5.1 Gradle wrapper 8.7-bin. Refactor gradle build files. Improve javadoc for maven artifact. --- LICENSE | 2 +- README.md | 2 +- build.gradle | 8 ++-- dynamic-dialogs/build.gradle | 6 ++- dynamic-dialogs/maven.gradle | 49 +++++++++++++++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 47 insertions(+), 22 deletions(-) diff --git a/LICENSE b/LICENSE index ddb4931..7a28495 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2017-2022 Pranav Pandey + Copyright 2017-2024 Pranav Pandey Copyright 2015 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/README.md b/README.md index 2c39780..ee8ca00 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Pranav Pandey ## License - Copyright 2017-2023 Pranav Pandey + Copyright 2017-2024 Pranav Pandey Copyright 2015 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/build.gradle b/build.gradle index f57acaf..1763654 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 Pranav Pandey + * Copyright 2017-2024 Pranav Pandey * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' + classpath 'com.android.tools.build:gradle:8.5.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" } } @@ -50,8 +50,8 @@ allprojects { } } -task clean(type: Delete) { - delete rootProject.buildDir +tasks.register('clean', Delete) { + delete rootProject.layout.buildDirectory } ext { diff --git a/dynamic-dialogs/build.gradle b/dynamic-dialogs/build.gradle index 67a8875..94cec4c 100644 --- a/dynamic-dialogs/build.gradle +++ b/dynamic-dialogs/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 Pranav Pandey + * Copyright 2017-2024 Pranav Pandey * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,9 @@ project.afterEvaluate { destinationDir = new File(destinationDir, variant.baseName) source = variant.sourceSets.collect { - it.java.sourceFiles }.inject { m, i -> m + i + it.java.sourceFiles + }.inject { + m, i -> m + i } doFirst { classpath = project.files(variant.javaCompileProvider.get().classpath.files, diff --git a/dynamic-dialogs/maven.gradle b/dynamic-dialogs/maven.gradle index e0e8312..fc113b0 100644 --- a/dynamic-dialogs/maven.gradle +++ b/dynamic-dialogs/maven.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 Pranav Pandey + * Copyright 2017-2024 Pranav Pandey * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,28 +22,48 @@ version = mavenVersion // Android libraries if (project.hasProperty("android")) { - task sourcesJar(type: Jar) { + tasks.register('sourcesJar', Jar) { archiveClassifier.set("sources") from android.sourceSets.main.java.srcDirs } - task javadoc(type: Javadoc) { - dependsOn("generateReleaseRFile") + tasks.register('javadoc', Javadoc) { + dependsOn "generateReleaseRFile" + title "${referenceTitle}

${versionDesc}

${mavenVersion}
" + failOnError = false - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + source = android.sourceSets.main.java.sourceFiles doNotTrackState("Javadoc needs to be generated every time.") - failOnError = false + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') + } + + options.memberLevel = JavadocMemberLevel.PROTECTED + exclude "**/R", "**/R.**", "**/R\$**", "**/BuildConfig*" + + options.windowTitle = "${referenceTitle}" + options.links('http://docs.oracle.com/javase/8/docs/api', + 'http://docs.oracle.com/javase/17/docs/api') + options.links('https://developer.android.com/reference') + options.linksOffline('https://developer.android.com/reference', + 'https://developer.android.com/reference/androidx') + options.linksOffline('https://developer.android.com/reference', + 'https://developer.android.com/reference/com/google/android/material') + options.links('https://pranavpandey.org/dynamic-utils') } } else { // Java libraries - task sourcesJar(type: Jar, dependsOn: classes) { + tasks.register('sourcesJar', Jar) { + dependsOn classes + archiveClassifier.set("sources") from sourceSets.main.allSource } } -task javadocJar(type: Jar, dependsOn: javadoc) { +tasks.register('javadocJar', Jar) { + dependsOn javadoc + archiveClassifier.set("javadoc") from javadoc.destinationDir } @@ -96,7 +116,7 @@ publishing { dependenciesNode = asNode().appendNode('dependencies') } - // Add all that are 'compile' + // Add all that are 'compile' dependencies. configurations.api.allDependencies.each { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', it.group) @@ -117,13 +137,16 @@ signing { } afterEvaluate { project -> - // Fix javadoc generation + // Fix javadoc generation. javadoc.classpath += files(android.libraryVariants.collect { variant -> variant.javaCompileProvider.get().classpath.files }) def pomTask = "generatePomFileForLibraryPublication" + def dependencies = [javadocJar, sourcesJar, assembleRelease, pomTask] - // Convenience task to prepare everything we need for releases - task prepareArtifacts(dependsOn: [javadocJar, sourcesJar, assembleRelease, pomTask]) { } + // Convenience task to prepare everything we need for releases. + tasks.register('prepareArtifacts') { + dependsOn dependencies + } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92bf66c..97e4426 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip