diff --git a/README.md b/README.md index a28a244e..72f5c301 100644 --- a/README.md +++ b/README.md @@ -10,17 +10,20 @@ Add the following dependency to your `build.gradle` file: ``` dependencies { - implementation 'com.google.android:flexbox:2.0.1' + implementation 'com.google.android.flexbox:flexbox:3.0.0' } ``` -**Note that the default values for `alignItems` and `alignContent` for `FlexboxLayout` have been changed from `stretch` to `flex_start` starting from 2.0.0, it may break the existing apps. -Please make sure to set `stretch` explicitly if you want to apply the behavior of `stretch`.** +**Starting from 3.0.0, the groupId is changed to `com.google.android.flexbox` in preparation to uploading the artifacts to google maven. +You can still download the artifacts from jcenter for the past versions with the prior groupId (`com.google.android`), but migrating the library 3.0.0 is recommended.** +Note that the default values for `alignItems` and `alignContent` for `FlexboxLayout` have been changed from `stretch` to `flex_start` starting from 2.0.0, it may break the existing apps. +Please make sure to set `stretch` explicitly if you want to apply the behavior of `stretch`. -**Note that starting from 1.1.0, the library is expected to use with AndroidX. Please migrate to [AndroidX](https://developer.android.com/jetpack/androidx/migrate) if you use 1.1.0 or above.** -**Please use 1.0.0 if you haven't migrated to AndroidX.** +Note that starting from 1.1.0, the library is expeced to use with AndroidX. Please migrate to [AndroidX](https://developer.android.com/jetpack/androidx/migrate) if you use 1.1.0 or above. + +Please use 1.0.0 if you haven't migrated to AndroidX. # Usage diff --git a/build.gradle b/build.gradle index c8c3ef55..9d17521a 100644 --- a/build.gradle +++ b/build.gradle @@ -19,23 +19,21 @@ buildscript { ext { minSdkVersion = 14 - targetSdkVersion = 29 - compileSdkVersion = 29 + targetSdkVersion = 30 + compileSdkVersion = 30 - androidGradlePluginVersion = "3.5.2" - androidMavenGradlePluginVersion = "1.5" - androidxAnnotationVersion = "1.1.0" - androidxAppCompatVersion = "1.1.0" - androidxCoreVersion = "1.1.0" - androidxPreferenceVersion = "1.1.0" - androidxRecyclerViewVersion = "1.1.0" - androidxEspressoVersion = "3.2.0" - androidxTestExtVersion = "1.1.1" - androidxTestVersion = "1.2.0" - junitVersion = "4.12" - gradleBintrayPluginVersion = "1.6" - kotlinVersion = "1.3.61" - materialVersion = "1.0.0" + androidGradlePluginVersion = "4.2.0" + androidxAnnotationVersion = "1.2.0" + androidxAppCompatVersion = "1.2.0" + androidxCoreVersion = "1.3.2" + androidxPreferenceVersion = "1.1.1" + androidxRecyclerViewVersion = "1.2.0" + androidxEspressoVersion = "3.3.0" + androidxTestExtVersion = "1.1.2" + androidxTestVersion = "1.3.0" + junitVersion = "4.13.2" + kotlinVersion = "1.4.32" + materialVersion = "1.3.0" } repositories { @@ -44,8 +42,6 @@ buildscript { } dependencies { classpath "com.android.tools.build:gradle:$androidGradlePluginVersion" - classpath "com.github.dcendents:android-maven-gradle-plugin:$androidMavenGradlePluginVersion" - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/demo-playground/build.gradle b/demo-playground/build.gradle index 5d05d282..ad350da5 100644 --- a/demo-playground/build.gradle +++ b/demo-playground/build.gradle @@ -40,6 +40,7 @@ android { dependencies { implementation project(":flexbox") + implementation "androidx.annotation:annotation:${rootProject.androidxAnnotationVersion}" implementation "androidx.appcompat:appcompat:${rootProject.androidxAppCompatVersion}" implementation "androidx.preference:preference:${rootProject.androidxPreferenceVersion}" implementation "com.google.android.material:material:${rootProject.materialVersion}" diff --git a/flexbox/bintray.gradle b/flexbox/bintray.gradle deleted file mode 100644 index 894fe98f..00000000 --- a/flexbox/bintray.gradle +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.jfrog.bintray' -apply from: 'constants.gradle' - -group = mavenGroup -version = mavenVersion - -bintray { - user = hasProperty('BINTRAY_USER') ? getProperty('BINTRAY_USER') : System.getenv('BINTRAY_USER') - key = hasProperty('BINTRAY_KEY') ? getProperty('BINTRAY_KEY') : System.getenv('BINTRAY_KEY') - - configurations = [ 'archives' ] - - pkg { - repo = projectName - name = mavenArtifactId - userOrg = bintrayOrg - licenses = [ 'Apache-2.0' ] - vcsUrl = "${githubUrl}.git" - - version { - name = mavenVersion - released = new Date() - } - } -} diff --git a/flexbox/build.gradle b/flexbox/build.gradle index caac5d03..30a00bc5 100644 --- a/flexbox/build.gradle +++ b/flexbox/build.gradle @@ -16,8 +16,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply from: 'maven.gradle' -apply from: 'bintray.gradle' +apply from: 'maven-puglisher-plugin.gradle' android { compileSdkVersion rootProject.ext.compileSdkVersion diff --git a/flexbox/constants.gradle b/flexbox/constants.gradle index 2ac956e6..fe8fc8f3 100644 --- a/flexbox/constants.gradle +++ b/flexbox/constants.gradle @@ -20,9 +20,9 @@ ext { githubUrl = 'https://github.com/google/flexbox-layout' - mavenGroup = 'com.google.android' + mavenGroup = 'com.google.android.flexbox' mavenArtifactId = 'flexbox' - mavenVersion = '2.0.1' + mavenVersion = '3.0.0' bintrayOrg = 'google' } diff --git a/flexbox/maven-puglisher-plugin.gradle b/flexbox/maven-puglisher-plugin.gradle new file mode 100644 index 00000000..c6cdcc3d --- /dev/null +++ b/flexbox/maven-puglisher-plugin.gradle @@ -0,0 +1,61 @@ +/* + * Copyright 2021 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'maven-publish' +apply from: 'constants.gradle' + +afterEvaluate { + + publishing { + publications { + release(MavenPublication) { + from components.release + + groupId = "$mavenGroup" + artifactId = "$mavenArtifactId" + version = "$mavenVersion" + + artifact androidSourcesJar + + pom { + name = "$projectName" + description = "$projectDesc" + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } + } + developers { + developer { + name = 'Google' + } + } + scm { + connection = "${githubUrl}.git" + url = githubUrl + } + } + } + } + } +} + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs +} \ No newline at end of file diff --git a/flexbox/maven.gradle b/flexbox/maven.gradle deleted file mode 100644 index 322bbcfc..00000000 --- a/flexbox/maven.gradle +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2016 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.github.dcendents.android-maven' -apply from: 'constants.gradle' - -install { - repositories.mavenInstaller { - pom.project { - name projectName - description projectDesc - url githubUrl - inceptionYear '2016' - - packaging 'aar' - groupId mavenGroup - artifactId mavenArtifactId - version mavenVersion - - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - scm { - connection "${githubUrl}.git" - url githubUrl - - } - developers { - developer { - name 'Google' - } - } - } - } -} - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -artifacts { - archives sourcesJar -} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 50ffbdc4..6b9cb5d1 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-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip