Skip to content

Commit ecf6352

Browse files
ymarianhunterstich
authored andcommitted
Update gradle version
PiperOrigin-RevId: 320229763 (cherry picked from commit cb4c1ed)
1 parent ca0110d commit ecf6352

File tree

9 files changed

+124
-102
lines changed

9 files changed

+124
-102
lines changed

build.gradle

Lines changed: 27 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.3.2'
9-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
8+
classpath 'com.android.tools.build:gradle:4.0.0'
109
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1110
}
1211
}
@@ -54,7 +53,7 @@ ext {
5453
preDexLibs = !project.hasProperty('disablePreDex')
5554

5655
mavenRepoUrl = (project.hasProperty('mavenRepoUrl')
57-
? project.property('mavenRepoUrl') : 'file://localhost/tmp/myRepo/')
56+
? project.property('mavenRepoUrl') : '/tmp/myRepo/')
5857

5958
// Current version of the library (could be in-development/unreleased).
6059
mdcLibraryVersion = '1.2.0-rc01'
@@ -72,6 +71,30 @@ task clean(type: Delete) {
7271
delete rootProject.buildDir
7372
}
7473

74+
String[] disabledLints = [
75+
'CustomViewStyleable',
76+
'CutPasteId',
77+
'GifUsage',
78+
'GradleDependency',
79+
'GradleOverrides',
80+
'IconDuplicates',
81+
'IconLauncherShape',
82+
'InflateParams',
83+
'MergeRootFrame',
84+
'MissingClass',
85+
'PrivateResource',
86+
'PxUsage',
87+
'RestrictedApi',
88+
'StringFormatMatches',
89+
'SupportAnnotationUsage',
90+
'SwitchIntDef',
91+
'UnusedAttribute',
92+
'UnusedResources',
93+
'VectorDrawableCompat',
94+
'VectorRaster',
95+
'WrongConstant',
96+
]
97+
7598
private def getTransformedProjectPath(projectPath) {
7699
def pathComponents = projectPath.tokenize('/')
77100
def result = ''
@@ -202,7 +225,7 @@ subprojects {
202225

203226
lintOptions {
204227
baseline file("baseline.xml")
205-
disable 'IconLauncherShape', 'IconDuplicates', 'SwitchIntDef', 'PxUsage', 'PrivateResource', 'GradleDependency', 'GradleOverrides', 'VectorRaster', 'GifUsage'
228+
disable disabledLints
206229
warningsAsErrors true
207230
}
208231

@@ -233,59 +256,6 @@ subprojects {
233256
it.enabled = false
234257
}
235258
})
236-
237-
project.android {
238-
task sourcesJar(type: Jar) {
239-
classifier = 'sources'
240-
from(android.sourceSets.main.java.srcDirs) {
241-
// Needed because we have Java sources and resources in same directory
242-
include '**/*.java'
243-
includeEmptyDirs = false
244-
}
245-
}
246-
247-
artifacts {
248-
archives sourcesJar
249-
}
250-
}
251-
252-
if (project.uploadArchives.repositories.hasProperty("mavenDeployer")) {
253-
project.uploadArchives.repositories.mavenDeployer.pom {
254-
project {
255-
name 'Material Components for Android'
256-
description 'Material Components for Android is a static library that you can add to your Android application in order to use APIs that provide implementations of the Material Design specification. Compatible on devices running API 14 or later.'
257-
url 'https://github.com/material-components/material-components-android'
258-
inceptionYear '2015'
259-
licenses {
260-
license {
261-
name 'The Apache Software License, Version 2.0'
262-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
263-
distribution 'repo'
264-
}
265-
}
266-
developers {
267-
developer {
268-
name 'The Android Open Source Project'
269-
}
270-
}
271-
scm {
272-
connection 'scm:git:https://github.com/material-components/material-components-android.git'
273-
url 'https://github.com/material-components/material-components-android'
274-
}
275-
}
276-
// Adds a <type> tag for each dependency. This assumes that all dependencies except
277-
// for "annotation" are aars, but it can break if in the future the artifactId
278-
// changes or we depend on anything else that's not an aar.
279-
// TODO(b/73783252): Remove this once Gradle automatically determines dependency types.
280-
whenConfigured { pom ->
281-
pom.dependencies.findAll { dependency ->
282-
if (dependency.artifactId != 'annotation' && dependency.artifactId != 'lifecycle-common-java8') {
283-
dependency.type = 'aar'
284-
}
285-
}
286-
}
287-
}
288-
}
289259
}
290260
}
291261
}

catalog/java/io/material/catalog/bottomnav/res/layout/cat_bottom_navs_animated.xml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@
1515
~ limitations under the License.
1616
-->
1717

18-
<LinearLayout
19-
xmlns:android="http://schemas.android.com/apk/res/android"
20-
android:layout_width="match_parent"
21-
android:layout_height="wrap_content"
22-
android:layout_gravity="bottom"
23-
android:orientation="vertical">
18+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
19+
xmlns:app="http://schemas.android.com/apk/res-auto"
20+
android:layout_width="match_parent"
21+
android:layout_height="wrap_content"
22+
android:layout_gravity="bottom"
23+
android:orientation="vertical">
2424

2525
<com.google.android.material.bottomnavigation.BottomNavigationView
26-
xmlns:android="http://schemas.android.com/apk/res/android"
27-
xmlns:app="http://schemas.android.com/apk/res-auto"
28-
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
29-
android:layout_width="match_parent"
30-
android:layout_height="wrap_content"
31-
app:menu="@menu/bottom_nav_animated_menu"/>
26+
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
app:menu="@menu/bottom_nav_animated_menu" />
3230
</LinearLayout>
3331

3432

catalog/java/io/material/catalog/menu/MenuMainDemoFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ private void showMenu(View v, @MenuRes int menuRes) {
9595
MenuBuilder menuBuilder = (MenuBuilder) popup.getMenu();
9696
//noinspection RestrictedApi
9797
menuBuilder.setOptionalIconsVisible(true);
98+
//noinspection RestrictedApi
9899
for (MenuItem item : menuBuilder.getVisibleItems()) {
99100
int iconMarginPx =
100101
(int)

catalog/java/io/material/catalog/themeswitcher/ThemeSwitcherDialogFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public View onCreateView(
8484
@NonNull LayoutInflater layoutInflater,
8585
@Nullable ViewGroup viewGroup,
8686
@Nullable Bundle bundle) {
87-
View view = layoutInflater.inflate(R.layout.mtrl_theme_switcher_dialog, null);
87+
View view = layoutInflater.inflate(R.layout.mtrl_theme_switcher_dialog, viewGroup, false);
8888
initializeChooseThemeButtons(view);
8989
primaryColorGroup = view.findViewById(R.id.primary_colors);
9090
initializeThemingValues(

docs/building-from-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ git clone https://github.com/material-components/material-components-android.git
2020
Then, build the library's AARs using Gradle:
2121

2222
```sh
23-
./gradlew uploadArchives -PmavenRepoUrl="file://localhost/<path_to_aars>"
23+
./gradlew publish -PmavenRepoUrl="file://localhost/<path_to_aars>"
2424
```
2525

2626
This will output AARs and Maven artifacts for each of the library's modules

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

lib/build.gradle

Lines changed: 83 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'com.github.dcendents.android-maven'
2+
apply plugin: 'maven-publish'
33

4-
archivesBaseName = getArchivesBaseName(project.name)
5-
version = rootProject.ext.mdcLibraryVersion
4+
version = mdcLibraryVersion
65

76
dependencies {
87
api compatibility("annotation")
@@ -18,11 +17,11 @@ dependencies {
1817
api compatibility("vectordrawable")
1918
api compatibility("viewpager2")
2019

21-
testImplementation "androidx.test:core:${project.rootProject.ext.testRunnerVersion}"
22-
testImplementation "androidx.test:runner:${project.rootProject.ext.testRunnerVersion}"
20+
testImplementation "androidx.test:core:${testRunnerVersion}"
21+
testImplementation "androidx.test:runner:${testRunnerVersion}"
2322
testImplementation "junit:junit:4.12"
24-
testImplementation "com.google.truth:truth:${project.rootProject.ext.truthVersion}"
25-
testImplementation "org.mockito:mockito-core:${project.rootProject.ext.mockitoCoreVersion}"
23+
testImplementation "com.google.truth:truth:${truthVersion}"
24+
testImplementation "org.mockito:mockito-core:${mockitoCoreVersion}"
2625
testImplementation "org.robolectric:robolectric:4.3"
2726

2827
testAnnotationProcessor "com.google.auto.service:auto-service:1.0-rc4"
@@ -162,6 +161,9 @@ task generateApiXml(type: Javadoc) {
162161
options.docletpath = [
163162
file(jdiff),
164163
]
164+
165+
// Doclava does not understand -notimestamp option that is default since Gradle 6.0
166+
options.setNoTimestamp(false)
165167
}
166168

167169
doLast {
@@ -171,25 +173,27 @@ task generateApiXml(type: Javadoc) {
171173
}
172174

173175
task generateJdiffReport(type: Javadoc) {
174-
if (project.hasProperty("oldApi")) {
175-
def outputPath = project.hasProperty("outputPath") ? project.property("outputPath") : "diffs-out"
176-
def jdiff = project.property("jdiffjar")
177-
def xerces = project.property("xercesjar")
178-
def oldApi = project.property("oldApi")
179-
def newApi = project.property("newApi")
180-
def newApiDir = project.property("newApiDir")
181-
def oldApiDir = project.property("oldApiDir")
176+
if (project.hasProperty('oldApi')) {
177+
def outputPath = project.hasProperty('outputPath') ? project.property('outputPath') : 'diffs-out'
178+
def jdiff = project.property('jdiffjar')
179+
def xerces = project.property('xercesjar')
180+
def oldApi = project.property('oldApi')
181+
def newApi = project.property('newApi')
182+
def newApiDir = project.property('newApiDir')
183+
def oldApiDir = project.property('oldApiDir')
182184
destinationDir = new File(outputPath)
183185
source = android.sourceSets.main.java.source
184-
source = source.findAll { it.name.endsWith(".java") }
185-
classpath = files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
186-
options.doclet = "jdiff.JDiff"
187-
options.addStringOption("subpackages", ".")
188-
options.addStringOption("newapidir", newApiDir)
189-
options.addStringOption("oldapidir", oldApiDir)
190-
options.addStringOption("oldapi", oldApi)
191-
options.addBooleanOption("verbose", true)
192-
options.addStringOption("newapi", newApi)
186+
source = source.findAll { it.name.endsWith('.java') }
187+
classpath = files('${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar')
188+
options.doclet = 'jdiff.JDiff'
189+
options.addStringOption('subpackages', '.')
190+
options.addStringOption('newapidir', newApiDir)
191+
options.addStringOption('oldapidir', oldApiDir)
192+
options.addStringOption('oldapi', oldApi)
193+
options.addBooleanOption('verbose', true)
194+
options.addStringOption('newapi', newApi)
195+
// Doclava does not understand -notimestamp option that is default since Gradle 6.0
196+
options.setNoTimestamp(false)
193197
options.docletpath = [
194198
file(jdiff),
195199
file(xerces),
@@ -212,13 +216,64 @@ afterEvaluate {
212216
task.classpath += task.project.files(javaCompileProvider.destinationDir)
213217
task.source += javaCompileProvider.source
214218
}
219+
220+
// Doclava does not understand -notimestamp option that is default since Gradle 6.0
221+
task.options.setNoTimestamp(false)
222+
}
223+
}
224+
225+
task androidSourcesJar(type: Jar) {
226+
classifier = 'sources'
227+
from(android.sourceSets.main.java.srcDirs) {
228+
// Needed because we have Java sources and resources in same directory
229+
include '**/*.java'
230+
includeEmptyDirs = false
215231
}
216232
}
217233

218-
uploadArchives {
219-
repositories {
220-
mavenDeployer {
221-
repository(url: rootProject.ext.mavenRepoUrl)
234+
afterEvaluate {
235+
publishing {
236+
repositories {
237+
maven {
238+
url = "$mavenRepoUrl"
239+
}
240+
}
241+
242+
publications {
243+
release(MavenPublication) {
244+
from components.release
245+
246+
artifact androidSourcesJar
247+
248+
groupId = 'com.google.android.material'
249+
artifactId = 'material'
250+
version project.version
251+
pom {
252+
name = 'Material Components for Android'
253+
description = 'Material Components for Android is a static library ' +
254+
'that you can add to your Android application in order to use ' +
255+
'APIs that provide implementations of the Material Design specification. ' +
256+
'Compatible on devices running API 14 or later.'
257+
url = 'https://github.com/material-components/material-components-android'
258+
inceptionYear = '2015'
259+
licenses {
260+
license {
261+
name = 'The Apache Software License, Version 2.0'
262+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
263+
distribution = 'repo'
264+
}
265+
}
266+
developers {
267+
developer {
268+
name = 'The Android Open Source Project'
269+
}
270+
}
271+
scm {
272+
connection = 'scm:git:https://github.com/material-components/material-components-android.git'
273+
url = 'https://github.com/material-components/material-components-android'
274+
}
275+
}
276+
}
222277
}
223278
}
224279
}

testing/java/com/google/android/material/testapp/res/layout/design_bottom_navigation_nonhiding_view.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
android:fitsSystemWindows="true">
2424

2525
<androidx.core.widget.NestedScrollView
26-
xmlns:android="http://schemas.android.com/apk/res/android"
2726
android:id="@+id/scrolling_content"
2827
android:layout_width="match_parent"
2928
android:layout_height="match_parent">

testing/java/com/google/android/material/testapp/res/layout/design_bottom_navigation_view.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
android:fitsSystemWindows="true">
2424

2525
<androidx.core.widget.NestedScrollView
26-
xmlns:android="http://schemas.android.com/apk/res/android"
2726
android:id="@+id/scrolling_content"
2827
android:layout_width="match_parent"
2928
android:layout_height="match_parent">

0 commit comments

Comments
 (0)