diff --git a/build.gradle b/build.gradle index 85533170..77ad3716 100644 --- a/build.gradle +++ b/build.gradle @@ -19,21 +19,25 @@ apply plugin: 'com.github.ben-manes.versions' buildscript { apply from: rootProject.file('versions.gradle') repositories { - jcenter() + mavenCentral() google() + jcenter() } dependencies { classpath plugs.agp classpath plugs.versions + classpath plugs.publish + classpath plugs.dokka } } allprojects { version = property('VERSION_NAME') repositories { - jcenter() + mavenCentral() google() + jcenter() } } diff --git a/core/build.gradle b/core/build.gradle index 05910e08..eac9eb8c 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -15,6 +15,7 @@ */ apply plugin: 'com.android.library' +apply plugin: "com.vanniktech.maven.publish" group = 'com.facebook.testing.screenshot' @@ -39,10 +40,12 @@ android { afterEvaluate { generateReleaseBuildConfig.enabled = false + tasks.getByName("androidJavadocs") { + exclude '**/BUCK' + } } dependencies { - compileOnly deps.jsr305 implementation deps.supportAppCompat @@ -50,12 +53,10 @@ dependencies { androidTestImplementation deps.dexmaker androidTestImplementation deps.dexmakerDx - + androidTestImplementation deps.junit androidTestImplementation deps.androidTestRules androidTestImplementation deps.espresso androidTestImplementation deps.mockito androidTestImplementation deps.dexmakerMockito androidTestImplementation deps.hamcrest } - -apply from: rootProject.file("gradle/gradle-mvn-push.gradle") diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle deleted file mode 100644 index aa0a1328..00000000 --- a/gradle/gradle-mvn-push.gradle +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2013 Chris Banes - * - * 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' -apply plugin: 'signing' - -def isReleaseBuild() { - return !VERSION_NAME.contains("SNAPSHOT") -} - -def getRepositoryUsername() { - return findProperty('repositoryUsername') ? property('repositoryUsername') : "" -} - -def getRepositoryPassword() { - return findProperty('repositoryPassword') ? property('repositoryPassword') : "" -} - -def configurePom(pom) { - 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 - } - } - } -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - configurePom(pom) - } - } - } - - task installArchives(type: Upload) { - configuration = configurations.archives - repositories { - mavenDeployer { - repository url: "file://${System.properties['user.home']}/.m2/repository" - configurePom(pom) - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - if (property('POM_PACKAGING') == 'aar') { - task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - exclude "**/BUCK" - if (JavaVersion.current().isJava8Compatible()) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } - - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.sourceFiles - } - - artifacts { - archives androidSourcesJar - archives androidJavadocsJar - } - } else { - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir - } - - artifacts { - archives sourcesJar - archives javadocJar - } - } -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..f3d88b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4a6ebcea..f371643e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 83f2acfd..2fe81a7d 100755 --- a/gradlew +++ b/gradlew @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 24467a14..9109989e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" diff --git a/layout-hierarchy-common/build.gradle b/layout-hierarchy-common/build.gradle index fbe4009c..89232194 100644 --- a/layout-hierarchy-common/build.gradle +++ b/layout-hierarchy-common/build.gradle @@ -15,6 +15,7 @@ */ apply plugin: 'com.android.library' +apply plugin: "com.vanniktech.maven.publish" group = 'com.facebook.testing.screenshot' @@ -34,6 +35,9 @@ android { afterEvaluate { generateReleaseBuildConfig.enabled = false + tasks.getByName("androidJavadocs") { + exclude '**/BUCK' + } } dependencies { @@ -42,4 +46,3 @@ dependencies { androidTestImplementation deps.espresso } -apply from: rootProject.file("gradle/gradle-mvn-push.gradle") diff --git a/layout-hierarchy-litho/build.gradle b/layout-hierarchy-litho/build.gradle index 8f3de19a..b417da62 100644 --- a/layout-hierarchy-litho/build.gradle +++ b/layout-hierarchy-litho/build.gradle @@ -15,6 +15,7 @@ */ apply plugin: 'com.android.library' +apply plugin: "com.vanniktech.maven.publish" group = 'com.facebook.testing.screenshot' @@ -34,6 +35,9 @@ android { afterEvaluate { generateReleaseBuildConfig.enabled = false + tasks.getByName("androidJavadocs") { + exclude '**/BUCK' + } } dependencies { @@ -44,4 +48,3 @@ dependencies { androidTestImplementation deps.espresso } -apply from: rootProject.file("gradle/gradle-mvn-push.gradle") diff --git a/plugin/build.gradle b/plugin/build.gradle index 7e4d04f0..88f44ddc 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -16,23 +16,22 @@ buildscript { repositories { - jcenter() + mavenCentral() google() mavenLocal() + jcenter() } dependencies { classpath plugs.kotlin + classpath plugs.publish + classpath plugs.dokka } } apply plugin: 'groovy' apply plugin: 'kotlin' apply plugin: "java-gradle-plugin" - -repositories { - jcenter() - mavenCentral() -} +apply plugin: 'com.vanniktech.maven.publish' final GENERATED_PACKAGE_NAME = "com.facebook.testing.screenshot.generated" final GENERATED_BUILD_DIR = @@ -61,8 +60,7 @@ task generateBuildConfig { dependencies { implementation deps.kotlinStdlib compileOnly plugs.agp - - + testImplementation deps.junit testImplementation plugs.agp testImplementation deps.mockito @@ -108,4 +106,3 @@ task py3Tests(type: Exec) { } -apply from: rootProject.file("gradle/gradle-mvn-push.gradle") diff --git a/versions.gradle b/versions.gradle index 223ce54a..1a39ab44 100644 --- a/versions.gradle +++ b/versions.gradle @@ -17,7 +17,7 @@ ext { final screenshotTestVersion = VERSION_NAME final dexmakerVersion = "1.4" - final lithoVersion = "0.34.0" + final lithoVersion = "0.40.0" versions = [ kotlin : '1.3.61', @@ -27,10 +27,12 @@ ext { ] plugs = [ - agp : "com.android.tools.build:gradle:3.6.0", + agp : "com.android.tools.build:gradle:4.1.1", screenshot : "com.facebook.testing.screenshot:plugin:$screenshotTestVersion", kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}", - versions : 'com.github.ben-manes:gradle-versions-plugin:0.20.0' + versions : 'com.github.ben-manes:gradle-versions-plugin:0.20.0', + publish : 'com.vanniktech:gradle-maven-publish-plugin:0.14.2', + dokka : 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.30' ] deps = [