Skip to content

Commit

Permalink
Copy from screenshot-tests-for-android
Browse files Browse the repository at this point in the history
  • Loading branch information
tdrhq committed Oct 10, 2020
0 parents commit 0d69228
Show file tree
Hide file tree
Showing 56 changed files with 1,398 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.pyc
*/build/
.gradle
/repo/
/build
repo
examples/**/build
examples/**/.idea/*
.idea/*
!.idea/codeStyleSettings.xml
*.iml
local.properties
plugin/src/generated
90 changes: 90 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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.
*/

buildscript {
apply from: rootProject.file('versions.gradle')
repositories {
mavenLocal()
jcenter()
google()
}

dependencies {
classpath plugs.agp
classpath plugs.screenshot
classpath plugs.kotlin
classpath "io.screenshotbot:plugin:0.1.0"
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
google()
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.facebook.testing.screenshot'
apply plugin: 'io.screenshotbot.plugin'

android {
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.facebook.testing.screenshot.example"
minSdkVersion 15
targetSdkVersion versions.targetSdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.facebook.testing.screenshot.sample.ScreenshotTestRunner"
}
}

dependencies {
implementation deps.kotlinStdlib

implementation deps.supportAppCompat
implementation deps.supportDesign

implementation deps.lithoCore
implementation deps.lithoWidget
implementation deps.lithoAnnotations
kapt deps.lithoProcessor

implementation deps.soLoader

androidTestImplementation deps.screenshotTestCommon
androidTestImplementation deps.screenshotTestLitho
androidTestImplementation deps.junit
androidTestImplementation(deps.espresso) {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestImplementation deps.androidTestRules
}

screenshots {
multipleDevices true
}

screenshotbot {
channelName "this-is-a-channel"
githubRepo "https://github.com/facebook/screenshot-tests-for-android"
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
org.gradle.configureondemand=true
android.useAndroidX = true
android.enableJetifier = false
139 changes: 139 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* 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
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0d69228

Please sign in to comment.