From d9af10d068f3411b8b8079d65f368b7ca3dc3dea Mon Sep 17 00:00:00 2001 From: Alex Maksakov Date: Tue, 8 Dec 2020 11:57:15 +0300 Subject: [PATCH] updated AGP to 3.6.4, changed publishing plugin to maven-publish' --- build.gradle | 12 +- changelog.md | 7 + gradle.properties | 1 + gradle/publish-lib.gradle | 161 ++++++++--------------- gradle/wrapper/gradle-wrapper.properties | 4 +- scrollingpagerindicator/build.gradle | 2 +- 6 files changed, 71 insertions(+), 116 deletions(-) create mode 100644 changelog.md diff --git a/build.gradle b/build.gradle index e4f4f15..e73cc27 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +def useMavenLocal = project.hasProperty("useMavenLocal") buildscript { @@ -7,12 +7,13 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.6.4' } } allprojects { repositories { + if (useMavenLocal) mavenLocal() google() jcenter() } @@ -27,8 +28,11 @@ ext { compileSdk = 28 targetSdk = 28 - appCompatVersion = "1.1.0" - constraintLayoutVersion = "1.1.3" + isRelease = project.hasProperty('release') + versionName = isRelease ? VERSION_NAME : "$VERSION_NAME-SNAPSHOT" + + appCompatVersion = "1.2.0" + constraintLayoutVersion = "2.0.4" viewPagerVersion = "1.0.0" viewPager2Version = "1.0.0" cardViewVersion = "1.0.0" diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..222c1f1 --- /dev/null +++ b/changelog.md @@ -0,0 +1,7 @@ +## 1.2.1 + +#### Fixes +#### Changes +-[scrollingpagerindicator] updated android gradle plugin to 3.6.4 +-[scrollingpagerindicator] changed publishing plugin to maven-publish +#### Additions diff --git a/gradle.properties b/gradle.properties index 0efeb03..11ce787 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,7 @@ # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m +android.useAndroidX=true # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/gradle/publish-lib.gradle b/gradle/publish-lib.gradle index 053d347..4047929 100755 --- a/gradle/publish-lib.gradle +++ b/gradle/publish-lib.gradle @@ -13,127 +13,88 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +apply plugin: 'maven-publish' -apply plugin: 'maven' -apply plugin: 'signing' - -version = VERSION_NAME -group = GROUP - -def isReleaseBuild() { - return VERSION_NAME.contains("SNAPSHOT") == false +def getEnvValueOrEmpty(String key) { + String value = System.getenv(key) + return value != null ? value : "" } -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +def getReleaseRepository() { + return getEnvValueOrEmpty("PRIVATE_NEXUS_RELEASE_URL") } -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" +def getSnapshotRepository() { + return getEnvValueOrEmpty("PRIVATE_NEXUS_SNAPSHOT_URL") } def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : '' + return getEnvValueOrEmpty("PRIVATE_NEXUS_USER") } def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : '' + return getEnvValueOrEmpty("PRIVATE_NEXUS_PASSWORD") } afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + publishing { + publications { + mavenAar(MavenPublication) { + from components.release + groupId GROUP + version versionName + afterEvaluate { + artifact sourcesJar + artifact javadocJar } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - + pom { + name = POM_NAME + packaging = POM_PACKAGING + description = POM_DESCRIPTION + url = POM_URL scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION + url = POM_SCM_URL + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION } - licenses { license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST } } - developers { developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME } } } } } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task install(type: Upload, dependsOn: assemble) { - repositories.mavenInstaller { - configuration = configurations.archives - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } + repositories { + maven { + url isRelease ? getReleaseRepository() : getSnapshotRepository() + credentials { + username = getRepositoryUsername() + password = getRepositoryPassword() } } } } - task androidJavadocs(type: Javadoc, dependsOn: preBuild) { + tasks.register('sourcesJar', Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs + } + + tasks.register('androidJavadocJar', Javadoc) { + dependsOn(preBuild) + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') + } source = android.sourceSets.main.java.source classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) classpath += files(android.libraryVariants.collect { variant -> @@ -141,27 +102,9 @@ afterEvaluate { project -> }) } - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.source - } - - if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } - } - - artifacts { - archives androidSourcesJar - archives androidJavadocsJar - + tasks.register('javadocJar', Jar) { + dependsOn(tasks.named('androidJavadocJar')) + archiveClassifier.set('javadoc') + from "$buildDir/docs/javadoc" } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 842baab..21792eb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 22 12:47:41 MSK 2018 +#Mon Dec 07 17:17:41 MSK 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/scrollingpagerindicator/build.gradle b/scrollingpagerindicator/build.gradle index 633f2b5..c813d6b 100644 --- a/scrollingpagerindicator/build.gradle +++ b/scrollingpagerindicator/build.gradle @@ -15,7 +15,7 @@ android { } libraryVariants.all { - it.generateBuildConfig.enabled = false + it.getGenerateBuildConfigProvider().get().enabled = false } }