Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ec5cb07 authored by Yigit Boyar's avatar Yigit Boyar
Browse files

Restructure project for test apps

This CL updates project to use a local maven repo.
(local as in near source code w/ relative path).
This is necessary to have multiple versions of the
project on the same computer also provides better
separation.

I also moved integration tests to depend on these
because we cannot build the compiler and test app at
the same project.

I've changed library plugin's jar to be a separate
upload task to avoid some build issues in TestApp
when we release a @jar and @aar with same group and
artifact ids.

This CL also adds some convenience methods to
gradle build script to run all tests, prepare maven
repo, run integration tests etc. These were needed
to do CI.

Bug: 19718690
Change-Id: I3c80e09fe7c8c2780ca00c3e9b9ba99a162531cf
parent 0710ff5b
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -48,10 +48,7 @@ dependencies {
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: mavenLocal().url)
            pom.version = '0.3-SNAPSHOT'
            pom.artifactId = 'annotationprocessor'
            pom.groupId='com.android.databinding'
        }
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -53,10 +53,7 @@ dependencies {
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: mavenLocal().url)
            pom.version = '0.3-SNAPSHOT'
            pom.artifactId = 'baseLibrary'
            pom.groupId='com.android.databinding'
        }
    }
}
+49 −3
Original line number Diff line number Diff line
ext.kotlinVersion = '0.10.195'
ext.releaseVersion = "0.3"
ext.snapshotVersion = "0.3-SNAPSHOT"
ext.androidPluginVersion = "1.0.0"
ext.androidPluginVersion = "1.0.1"
ext.javaTargetCompatibility = 1.6
ext.javaSourceCompatibility = 1.6

ext.mavenRepoDir = "${projectDir}/maven-repo"
println "local maven repo is ${ext.mavenRepoDir}."
new File(ext.mavenRepoDir).mkdir()
subprojects {
    apply plugin: 'maven'
    group = 'com.android.databinding'
    version = '0.3-SNAPSHOT'
    repositories {
        mavenLocal()
        mavenCentral()
        maven {
            url "file://$mavenRepoDir"
        }
    }
    uploadArchives {
        repositories {
            mavenDeployer {
                repository(url: "file://$mavenRepoDir")
            }
        }
    }
}

task deleteRepo(type: Delete) {
    delete "$mavenRepoDir"
}

file('integration-tests').listFiles().findAll { it.isDirectory() }.each {
    println("${it.getAbsolutePath()}")
    def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec
    testTask.workingDir 'integration-tests/TestApp'
    //on linux
    testTask.commandLine './gradlew'
    testTask.args 'clean', 'connectedCheck', '--info'
    testTask.dependsOn subprojects.uploadArchives
}

task runIntegrationTests {
    dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') }
}

task runAllTests {
    dependsOn runIntegrationTests
}

allprojects {
    afterEvaluate { project ->
        runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')}
    }
}


task rebuildRepo() {
    dependsOn deleteRepo
    dependsOn subprojects.uploadArchives
}
 No newline at end of file
+6 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

apply plugin: 'java'
apply plugin: "kotlin"
apply plugin: 'maven'


sourceCompatibility = javaTargetCompatibility
@@ -42,7 +41,7 @@ dependencies {
    compile project(":baseLibrary")
    compile project(":grammarBuilder")
    compile project(":xmlGrammar")
    testCompile "com.android.databinding:library:$version@jar"
    testCompile "com.android.databinding:libraryJar:$version@jar"
}

task fatJar(type: Jar) {
@@ -54,7 +53,11 @@ task fatJar(type: Jar) {
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: mavenLocal().url)
            pom.artifactId = 'compiler'
        }
    }
}

project(':library').afterEvaluate { libProject ->
    tasks['compileTestKotlin'].dependsOn libProject.tasks['uploadJarArchives']
}
+5 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.databinding.expr;
import com.android.databinding.reflection.ModelAnalyzer;
import com.android.databinding.reflection.Callable;
import com.android.databinding.reflection.ModelClass;
import com.android.databinding.util.L;

import java.util.List;

@@ -97,7 +98,10 @@ public class FieldAccessExpr extends Expr {
            Expr child = getChild();
            child.resolveType(modelAnalyzer);
            boolean isStatic = child instanceof StaticIdentifierExpr;
            mGetter = modelAnalyzer.findMethodOrField(child.getResolvedType(), mName, isStatic);
            ModelClass resolvedType = child.getResolvedType();
            L.d("resolving %s. Resolved type: %s", this, resolvedType);

            mGetter = modelAnalyzer.findMethodOrField(resolvedType, mName, isStatic);
            if (modelAnalyzer.isObservableField(mGetter.resolvedType)) {
                // Make this the ".get()" and add an extra field access for the observable field
                child.getParents().remove(this);
Loading