diff options
153 files changed, 990 insertions, 2509 deletions
@@ -3,3 +3,6 @@ local.properties .gradle maven-repo .caches +*.iml +*.DS_Store +*.idea
\ No newline at end of file diff --git a/baseLibrary/build.gradle b/baseLibrary/build.gradle index 75bdda8d..e1579bef 100644 --- a/baseLibrary/build.gradle +++ b/baseLibrary/build.gradle @@ -17,8 +17,8 @@ apply plugin: 'java' apply plugin: 'application' apply plugin: 'com.android.databinding.bintray' -sourceCompatibility = config.javaTargetCompatibility -targetCompatibility = config.javaSourceCompatibility +sourceCompatibility = dataBindingConfig.javaTargetCompatibility +targetCompatibility = dataBindingConfig.javaSourceCompatibility sourceSets { main { @@ -63,9 +63,9 @@ uploadArchives { pom.project { licenses { license { - name config.licenseName - url config.licenseUrl - distribution config.licenseDistribution + name dataBindingConfig.licenseName + url dataBindingConfig.licenseUrl + distribution dataBindingConfig.licenseDistribution } } } @@ -76,7 +76,7 @@ uploadArchives { task prebuildJar(type : Copy) { dependsOn uploadArchives from "$buildDir/libs/baseLibrary-${version}.jar" - into config.prebuildFolder + into dataBindingConfig.prebuildFolder rename { String fileName -> "databinding-baseLibrary.jar" } diff --git a/build.gradle b/build.gradle index 2560b4ff..00b12068 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.rootFolder = project.projectDir + ext.dataBindingRootFolder = project.projectDir apply from: 'propLoader.gradle' apply from: 'supportBundle.gradle' ext.addRepos(repositories) - if (ext.config.addRemoteRepos) { + if (ext.dataBindingConfig.addRemoteRepos) { dependencies { - classpath "com.android.databinding:localizemaven:${config.extraPluginsVersion}" + classpath "com.android.databinding:localizemaven:${dataBindingConfig.extraPluginsVersion}" } } dependencies { @@ -15,45 +15,48 @@ buildscript { } subprojects { apply plugin: 'maven' - if (config.addRemoteRepos) { + if (dataBindingConfig.addRemoteRepos && !dataBindingConfig.forGradlePlugin) { apply plugin: 'com.android.databinding.localizemaven' } - group = config.group - version = config.version - def url = (config.inReleaseBuild && it.name == "library") ? "file://${config.sharedSupportRepoDir}" : "file://${config.mavenRepoDir}" - uploadArchives { - repositories { - mavenDeployer { - repository(url: url) + if (it.name != "compilationTests") { + group = dataBindingConfig.group + version = dataBindingConfig.version + def url = (!dataBindingConfig.forGradlePlugin && dataBindingConfig.inReleaseBuild && it.name == "library") ? "file://${dataBindingConfig.sharedSupportRepoDir}" : "file://${dataBindingConfig.mavenRepoDir}" + uploadArchives { + repositories { + mavenDeployer { + repository(url: url) + } } } } + buildscript { addRepos(repositories) - dependencies { - classpath "com.android.databinding:bintray:${config.extraPluginsVersion}" - } + dependencies { + classpath "com.android.databinding:bintray:${dataBindingConfig.extraPluginsVersion}" + } } } -if (config.addRemoteRepos) { +if (dataBindingConfig.addRemoteRepos && !dataBindingConfig.forGradlePlugin) { localizeMaven { - localRepoDir = file(config.megaRepoDir) - otherRepoDirs = config.localRepositories + localRepoDir = file(dataBindingConfig.megaRepoDir) + otherRepoDirs = dataBindingConfig.localRepositories } } task deleteRepo(type: Delete) { - delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}" + delete "${dataBindingConfig.mavenRepoDir}/${dataBindingConfig.group.replace('.', '/')}" } task deletePrebuildFolder(type: Delete) { - delete "${config.prebuildFolder}" + delete "${dataBindingConfig.prebuildFolder}" } task deleteEap(type: Delete) { - delete "${config.eapOutDir}" + delete "${dataBindingConfig.eapOutDir}" } @@ -61,8 +64,9 @@ def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec buildExtensionsTask.workingDir file('extensions').getAbsolutePath() buildExtensionsTask.commandLine './gradlew' buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace', - "-PuseReleaseVersion=${config.inReleaseBuild ? 'true' : 'false'}", - "-PaddRemoteRepos=${config.addRemoteRepos ? 'true' : 'false'}" + "-PuseReleaseVersion=${dataBindingConfig.inReleaseBuild ? 'true' : 'false'}", + "-PaddRemoteRepos=${dataBindingConfig.addRemoteRepos ? 'true' : 'false'}", + "-PforGradlePlugin=${dataBindingConfig.forGradlePlugin ? 'true' : 'false'}" buildExtensionsTask.dependsOn subprojects.uploadArchives tasks['bundleSupportLib'].dependsOn buildExtensionsTask @@ -71,8 +75,9 @@ def prepareExtensionPrebuilds = project.tasks.create "prepareExtensionPrebuilds" prepareExtensionPrebuilds.workingDir file('extensions').getAbsolutePath() prepareExtensionPrebuilds.commandLine './gradlew' prepareExtensionPrebuilds.args 'clean', 'preparePrebuilds', '--info', '--stacktrace', - "-PuseReleaseVersion=${config.inReleaseBuild ? 'true' : 'false'}", - "-PaddRemoteRepos=${config.addRemoteRepos ? 'true' : 'false'}" + "-PuseReleaseVersion=${dataBindingConfig.inReleaseBuild ? 'true' : 'false'}", + "-PaddRemoteRepos=${dataBindingConfig.addRemoteRepos ? 'true' : 'false'}", + "-PforGradlePlugin=${dataBindingConfig.forGradlePlugin ? 'true' : 'false'}" prepareExtensionPrebuilds.dependsOn subprojects.uploadArchives file('integration-tests').listFiles().findAll { it.isDirectory() }.each { @@ -82,10 +87,10 @@ file('integration-tests').listFiles().findAll { it.isDirectory() }.each { //on linux testTask.commandLine './gradlew' testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace', - "-PuseReleaseVersion=${config.inReleaseBuild ? 'true' : 'false'}", - "-PaddRemoteRepos=${config.addRemoteRepos ? 'true' : 'false'}" + "-PuseReleaseVersion=${dataBindingConfig.inReleaseBuild ? 'true' : 'false'}", + "-PaddRemoteRepos=${dataBindingConfig.addRemoteRepos ? 'true' : 'false'}", + "-PforGradlePlugin=${dataBindingConfig.forGradlePlugin ? 'true' : 'false'}" testTask.dependsOn subprojects.uploadArchives - testTask.dependsOn buildExtensionsTask } task runIntegrationTests { @@ -111,6 +116,11 @@ allprojects { subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo } subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder } +def dataBindingPublishLocal = tasks.create(name: 'publishLocal') +subprojects.uploadArchives.each { + dataBindingPublishLocal.dependsOn(it) +} + buildExtensionsTask.shouldRunAfter deleteRepo tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary'] @@ -118,7 +128,6 @@ tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibr task rebuildRepo() { dependsOn deleteRepo dependsOn subprojects.uploadArchives - dependsOn buildExtensionsTask } task copySamplesToEap(type : Copy) { @@ -127,31 +136,30 @@ task copySamplesToEap(type : Copy) { exclude "**/build" exclude "**/local.properties" } - into "${config.eapOutDir}/samples" + into "${dataBindingConfig.eapOutDir}/samples" } task copyMavenRepoToEap(type : Copy) { mustRunAfter deleteEap dependsOn rebuildRepo - from(config.mavenRepoDir) - into "${config.eapOutDir}/${config.mavenRepoName}" + from(dataBindingConfig.mavenRepoDir) + into "${dataBindingConfig.eapOutDir}/${dataBindingConfig.mavenRepoName}" } -tasks.create(name : 'createEapConfigFile') << { - def propsFile = new File("${config.eapOutDir}/databinding.properties") +tasks.create(name : 'createEapdataBindingConfigFile') << { + def propsFile = new File("${dataBindingConfig.eapOutDir}/databinding.properties") Properties props = new Properties() - props.setProperty('version', config.version) - props.setProperty('mavenRepoName', config.mavenRepoName) + props.setProperty('version', dataBindingConfig.version) + props.setProperty('mavenRepoName', dataBindingConfig.mavenRepoName) props.store(propsFile.newWriter(), null) } - task batchEAP() { dependsOn deleteEap dependsOn copyMavenRepoToEap dependsOn copySamplesToEap - dependsOn createEapConfigFile + dependsOn createEapdataBindingConfigFile } def fullJar(project) { @@ -160,7 +168,7 @@ def fullJar(project) { localizeTask.dependsOn project.tasks.findByName('buildLicenseNotice') } - if (!config.inReleaseBuild) { + if (!dataBindingConfig.inReleaseBuild || !dataBindingConfig.runProguard) { return } def jarName = project.uploadArchives.repositories.mavenDeployer.pom.artifactId @@ -216,7 +224,7 @@ def fullJar(project) { outputs.file(outputLibrary) doLast { - def jarJarLibrary = new File(config.externalPrebuiltsBase, + def jarJarLibrary = new File(dataBindingConfig.externalPrebuiltsBase, 'tools/common/m2/repository/com/googlecode/jarjar/jarjar/1.3/jarjar-1.3.jar'). getCanonicalPath() // in Ant diff --git a/buildForGradlePlugin.sh b/buildForGradlePlugin.sh new file mode 100755 index 00000000..c222fb3b --- /dev/null +++ b/buildForGradlePlugin.sh @@ -0,0 +1 @@ +./gradlew :dB:compiler:uploadArchives :dB:compilerCommon:uploadArchives :dB:baseLibrary:uploadArchives -PaddRemoteRepos=true -PuseReleaseVersion=true -PforGradlePlugin=true diff --git a/compilationTests/build.gradle b/compilationTests/build.gradle index ae64d72b..0ca1877a 100644 --- a/compilationTests/build.gradle +++ b/compilationTests/build.gradle @@ -1,17 +1,17 @@ apply plugin: 'java' -sourceCompatibility = 1.7 +sourceCompatibility = 1.6 version = '1.0' dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' + testCompile 'junit:junit:4.12' testCompile 'org.apache.commons:commons-lang3:3.3.2' testCompile 'commons-io:commons-io:2.4' testCompile 'commons-codec:commons-codec:1.10' - testCompile project(':compilerCommon') + testCompile project(':dataBinding:compilerCommon') } afterEvaluate { - tasks['test'].systemProperties['useReleaseVersion'] = config.inReleaseBuild ? 'true' : 'false' - tasks['test'].systemProperties['addRemoteRepos'] = config.addRemoteRepos ? 'true' : 'false' + tasks['test'].systemProperties['useReleaseVersion'] = dataBindingConfig.inReleaseBuild ? 'true' : 'false' + tasks['test'].systemProperties['addRemoteRepos'] = dataBindingConfig.addRemoteRepos ? 'true' : 'false' }
\ No newline at end of file diff --git a/compilationTests/src/test/java/android/databinding/compilationTest/BaseCompilationTest.java b/compilationTests/src/test/java/android/databinding/compilationTest/BaseCompilationTest.java index 3bd05321..e008c828 100644 --- a/compilationTests/src/test/java/android/databinding/compilationTest/BaseCompilationTest.java +++ b/compilationTests/src/test/java/android/databinding/compilationTest/BaseCompilationTest.java @@ -31,9 +31,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.attribute.PosixFilePermission; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -52,7 +49,7 @@ import static org.junit.Assert.assertTrue; public class BaseCompilationTest { private static final String PRINT_ENCODED_ERRORS_PROPERTY - = "android.databinding.injected.print.encoded.errors"; + = "android.injected.invoked.from.ide"; @Rule public TestName name = new TestName(); static Pattern VARIABLES = Pattern.compile("!@\\{([A-Za-z0-9_-]*)}"); @@ -147,7 +144,7 @@ public class BaseCompilationTest { protected static Map<String, String> toMap(String... keysAndValues) { assertEquals(0, keysAndValues.length % 2); - Map<String, String> map = new HashMap<>(); + Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < keysAndValues.length; i += 2) { map.put(keysAndValues[i], keysAndValues[i + 1]); } @@ -191,7 +188,7 @@ public class BaseCompilationTest { private Map<String, String> addDefaults(Map<String, String> map) { if (map == null) { - map = new HashMap<>(); + map = new HashMap<String, String>(); } if (!map.containsKey(KEY_MANIFEST_PACKAGE)) { map.put(KEY_MANIFEST_PACKAGE, DEFAULT_APP_PACKAGE); @@ -241,7 +238,7 @@ public class BaseCompilationTest { throws IOException, InterruptedException { setExecutable(); File pathToExecutable = new File(testFolder, "gradlew"); - List<String> args = new ArrayList<>(); + List<String> args = new ArrayList<String>(); args.add(pathToExecutable.getAbsolutePath()); args.add("-P" + PRINT_ENCODED_ERRORS_PROPERTY + "=true"); if ("true".equals(System.getProperties().getProperty("useReleaseVersion", "false"))) { @@ -268,17 +265,8 @@ public class BaseCompilationTest { } private void setExecutable() throws IOException { - Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>(); - //add owners permission - perms.add(PosixFilePermission.OWNER_READ); - perms.add(PosixFilePermission.OWNER_WRITE); - perms.add(PosixFilePermission.OWNER_EXECUTE); - //add group permissions - perms.add(PosixFilePermission.GROUP_READ); - //add others permissions - perms.add(PosixFilePermission.OTHERS_READ); - Files.setPosixFilePermissions(Paths.get(new File(testFolder, "gradlew").getAbsolutePath()), - perms); + File gw = new File(testFolder, "gradlew"); + gw.setExecutable(true); } diff --git a/compilationTests/src/test/java/android/databinding/compilationTest/MultiLayoutVerificationTest.java b/compilationTests/src/test/java/android/databinding/compilationTest/MultiLayoutVerificationTest.java index 0591ea9f..bbf86e7a 100644 --- a/compilationTests/src/test/java/android/databinding/compilationTest/MultiLayoutVerificationTest.java +++ b/compilationTests/src/test/java/android/databinding/compilationTest/MultiLayoutVerificationTest.java @@ -58,25 +58,24 @@ public class MultiLayoutVerificationTest extends BaseCompilationTest { assertTrue(file.exists()); assertEquals(1, report.getLocations().size()); Location location = report.getLocations().get(0); - switch (file.getParentFile().getName()) { - case "layout": - assertEquals(new File(testFolder, - "/app/src/main/res/layout/with_class_name.xml") - .getCanonicalFile(), file.getCanonicalFile()); - String extract = extract("/app/src/main/res/layout/with_class_name.xml", - location); - assertEquals(extract, "AClassName"); - assertEquals(String.format( - ErrorMessages.MULTI_CONFIG_LAYOUT_CLASS_NAME_MISMATCH, - DEFAULT_APP_PACKAGE + ".databinding.AClassName", - "layout/with_class_name"), exception.getBareMessage()); - foundNormal = true; - break; - case "layout-land": + String name = file.getParentFile().getName(); + if ("layout".equals(name)) { + assertEquals(new File(testFolder, + "/app/src/main/res/layout/with_class_name.xml") + .getCanonicalFile(), file.getCanonicalFile()); + String extract = extract("/app/src/main/res/layout/with_class_name.xml", + location); + assertEquals(extract, "AClassName"); + assertEquals(String.format( + ErrorMessages.MULTI_CONFIG_LAYOUT_CLASS_NAME_MISMATCH, + DEFAULT_APP_PACKAGE + ".databinding.AClassName", + "layout/with_class_name"), exception.getBareMessage()); + foundNormal = true; + } else if ("layout-land".equals(name)) { assertEquals(new File(testFolder, "/app/src/main/res/layout-land/with_class_name.xml") .getCanonicalFile(), file.getCanonicalFile()); - extract = extract("/app/src/main/res/layout-land/with_class_name.xml", + String extract = extract("/app/src/main/res/layout-land/with_class_name.xml", location); assertEquals("SomeOtherClassName", extract); assertEquals(String.format( @@ -84,13 +83,12 @@ public class MultiLayoutVerificationTest extends BaseCompilationTest { DEFAULT_APP_PACKAGE + ".databinding.SomeOtherClassName", "layout-land/with_class_name"), exception.getBareMessage()); foundLandscape = true; - break; - default: - fail("unexpected error file"); + } else { + fail("unexpected error file"); } } - assertTrue(result.error, foundNormal); - assertTrue(result.error, foundLandscape); + assertTrue("should find default config error\n" + result.error, foundNormal); + assertTrue("should find landscape error\n" + result.error, foundLandscape); } @Test @@ -117,19 +115,17 @@ public class MultiLayoutVerificationTest extends BaseCompilationTest { assertEquals(result.error, 1, report.getLocations().size()); Location location = report.getLocations().get(0); // validated in switch - String config = file.getParentFile().getName(); + String name = file.getParentFile().getName(); + String config = name; String type = "???"; - switch (file.getParentFile().getName()) { - case "layout": - type = "String"; - foundNormal = true; - break; - case "layout-land": - type = "CharSequence"; - foundLandscape = true; - break; - default: - fail("unexpected error file"); + if ("layout".equals(name)) { + type = "String"; + foundNormal = true; + } else if ("layout-land".equals(name)) { + type = "CharSequence"; + foundLandscape = true; + } else { + fail("unexpected error file"); } assertEquals(new File(testFolder, "/app/src/main/res/" + config + "/layout_with_variable_type.xml") @@ -172,19 +168,17 @@ public class MultiLayoutVerificationTest extends BaseCompilationTest { assertEquals(result.error, 1, report.getLocations().size()); Location location = report.getLocations().get(0); // validated in switch - String config = file.getParentFile().getName(); + String name = file.getParentFile().getName(); + String config = name; String type = "???"; - switch (file.getParentFile().getName()) { - case "layout": - type = typeNormal; - foundNormal = true; - break; - case "layout-land": - type = typeLand; - foundLandscape = true; - break; - default: - fail("unexpected error file"); + if ("layout".equals(name)) { + type = typeNormal; + foundNormal = true; + } else if ("layout-land".equals(name)) { + type = typeLand; + foundLandscape = true; + } else { + fail("unexpected error file"); } assertEquals(new File(testFolder, "/app/src/main/res/" + config + "/layout_with_import_type.xml") @@ -227,22 +221,19 @@ public class MultiLayoutVerificationTest extends BaseCompilationTest { Location location = report.getLocations().get(0); // validated in switch String config = file.getParentFile().getName(); - switch (file.getParentFile().getName()) { - case "layout": - String extract = extract("/app/src/main/res/" + config + "/foo.xml", location); - assertEquals(extract, "<include layout=\"@layout/basic_layout\" " - + "android:id=\"@+id/sharedId\" bind:myVariable=\"@{myVariable}\"/>"); - foundNormal = true; - break; - case "layout-land": - extract = extract("/app/src/main/res/" + config + "/foo.xml", location); - assertEquals(extract, "<TextView android:layout_width=\"wrap_content\" " - + "android:layout_height=\"wrap_content\" android:id=\"@+id/sharedId\" " - + "android:text=\"@{myVariable}\"/>"); - foundLandscape = true; - break; - default: - fail("unexpected error file"); + if ("layout".equals(config)) { + String extract = extract("/app/src/main/res/" + config + "/foo.xml", location); + assertEquals(extract, "<include layout=\"@layout/basic_layout\" " + + "android:id=\"@+id/sharedId\" bind:myVariable=\"@{myVariable}\"/>"); + foundNormal = true; + } else if ("layout-land".equals(config)) { + String extract = extract("/app/src/main/res/" + config + "/foo.xml", location); + assertEquals(extract, "<TextView android:layout_width=\"wrap_content\" " + + "android:layout_height=\"wrap_content\" android:id=\"@+id/sharedId\" " + + "android:text=\"@{myVariable}\"/>"); + foundLandscape = true; + } else { + fail("unexpected error file"); } assertEquals(new File(testFolder, "/app/src/main/res/" + config + "/foo.xml").getCanonicalFile(), diff --git a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java index f86165e2..84d4459f 100644 --- a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java +++ b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java @@ -73,18 +73,19 @@ public class SimpleCompilationTest extends BaseCompilationTest { "/app/src/main/res/layout-sw100dp/main.xml"); CompilationResult result = runGradle("assembleDebug"); assertEquals(result.error, 0, result.resultCode); - File debugOut = new File(testFolder, "/app/build/intermediates/res/merged/debug/"); + File debugOut = new File(testFolder, + "app/build/intermediates/data-binding-layout-out/debug"); Collection<File> layoutFiles = FileUtils.listFiles(debugOut, new SuffixFileFilter(".xml"), new PrefixFileFilter("layout")); assertTrue("test sanity", layoutFiles.size() > 1); for (File layout : layoutFiles) { + final String contents = FileUtils.readFileToString(layout); if (layout.getParent().contains("sw100")) { assertTrue("File has wrong tag:" + layout.getPath(), - FileUtils.readFileToString(layout) - .indexOf("android:tag=\"layout-sw100dp/main_0\"") > 0); + contents.indexOf("android:tag=\"layout-sw100dp/main_0\"") > 0); } else { - assertTrue("File has wrong tag:" + layout.getPath(), - FileUtils.readFileToString(layout).indexOf("android:tag=\"layout/main_0\"") + assertTrue("File has wrong tag:" + layout.getPath() + "\n" + contents, + contents.indexOf("android:tag=\"layout/main_0\"") > 0); } } diff --git a/compilationTests/src/test/resources/app_build.gradle b/compilationTests/src/test/resources/app_build.gradle index d189ca14..22632c58 100644 --- a/compilationTests/src/test/resources/app_build.gradle +++ b/compilationTests/src/test/resources/app_build.gradle @@ -1,10 +1,11 @@ apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion - + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion + dataBinding { + enabled = true + } defaultConfig { minSdkVersion 7 targetSdkVersion 21 @@ -22,8 +23,8 @@ android { exclude 'META-INF/services/javax.annotation.processing.Processor' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 } } diff --git a/compilationTests/src/test/resources/module_build.gradle b/compilationTests/src/test/resources/module_build.gradle index 2eb780a3..112b27b2 100644 --- a/compilationTests/src/test/resources/module_build.gradle +++ b/compilationTests/src/test/resources/module_build.gradle @@ -15,12 +15,13 @@ */ apply plugin: 'com.android.library' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion - + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion + dataBinding { + enabled = true + } defaultConfig { minSdkVersion 7 targetSdkVersion 21 @@ -38,8 +39,8 @@ android { exclude 'META-INF/services/javax.annotation.processing.Processor' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 } } diff --git a/compilationTests/src/test/resources/project_build.gradle b/compilationTests/src/test/resources/project_build.gradle index fcf1b754..4622a5b1 100644 --- a/compilationTests/src/test/resources/project_build.gradle +++ b/compilationTests/src/test/resources/project_build.gradle @@ -1,23 +1,23 @@ buildscript { - ext.rootFolder = new File(project.projectDir, "../../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../../..") apply from: "${project.projectDir}/propLoaderClone.gradle" ext.addRepos(repositories) dependencies { - classpath "com.android.databinding:dataBinder:${config.version}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } } subprojects { apply plugin: 'maven' - group = config.group - version = config.version + group = dataBindingConfig.group + version = dataBindingConfig.version } allprojects { repositories { jcenter() maven { - url config.mavenRepoDir + url dataBindingConfig.mavenRepoDir } } } diff --git a/compiler/build.gradle b/compiler/build.gradle index 34645272..9b5525f7 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -18,27 +18,26 @@ apply plugin: "kotlin" apply plugin: 'com.android.databinding.bintray' -sourceCompatibility = config.javaTargetCompatibility -targetCompatibility = config.javaSourceCompatibility +sourceCompatibility = dataBindingConfig.javaTargetCompatibility +targetCompatibility = dataBindingConfig.javaSourceCompatibility buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${config.kotlinVersion}" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${dataBindingConfig.kotlinVersion}" classpath 'commons-io:commons-io:2.4' } } dependencies { - compile project(":compilerCommon") - compile project(':baseLibrary') + compile project(':dataBinding:compilerCommon') + compile project(':dataBinding:baseLibrary') compile 'org.apache.commons:commons-lang3:3.3.2' compile 'commons-io:commons-io:2.4' compile 'commons-codec:commons-codec:1.10' - compile "org.jetbrains.kotlin:kotlin-stdlib:${config.kotlinVersion}" - + compile "org.jetbrains.kotlin:kotlin-stdlib:${dataBindingConfig.kotlinVersion}" compile 'com.tunnelvisionlabs:antlr4:4.5' testCompile files('../baseLibrary/src/main/java') - testCompile files('../library/src/main/java') + testCompile files('../extensions/library/src/main/java') testCompile 'junit:junit:4.12' } @@ -49,9 +48,9 @@ uploadArchives { pom.project { licenses { license { - name config.licenseName - url config.licenseUrl - distribution config.licenseDistribution + name dataBindingConfig.licenseName + url dataBindingConfig.licenseUrl + distribution dataBindingConfig.licenseDistribution } } } @@ -59,8 +58,4 @@ uploadArchives { } } -project(':library').afterEvaluate { libProject -> - tasks['compileTestKotlin'].dependsOn libProject.tasks['uploadJarArchives'] -} - fullJar(project) diff --git a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessBindable.java b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessBindable.java index ae73d951..d96e5da0 100644 --- a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessBindable.java +++ b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessBindable.java @@ -33,8 +33,6 @@ import java.util.Set; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; @@ -45,7 +43,6 @@ import javax.lang.model.type.TypeKind; import javax.lang.model.util.Types; // binding app info and library info are necessary to trigger this. -@SupportedSourceVersion(SourceVersion.RELEASE_7) public class ProcessBindable extends ProcessDataBinding.ProcessingStep implements BindableHolder { Intermediate mProperties; HashMap<String, HashSet<String>> mLayoutVariables = new HashMap<String, HashSet<String>>(); diff --git a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java index 37dc2a23..d63ec410 100644 --- a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java +++ b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessDataBinding.java @@ -33,7 +33,6 @@ import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.TypeElement; @@ -44,7 +43,6 @@ import javax.lang.model.element.TypeElement; "android.databinding.BindingConversion", "android.databinding.BindingBuildInfo"} ) -@SupportedSourceVersion(SourceVersion.RELEASE_7) /** * Parent annotation processor that dispatches sub steps to ensure execution order. * Use initProcessingSteps to add a new step. @@ -73,6 +71,11 @@ public class ProcessDataBinding extends AbstractProcessor { return done; } + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + private void initProcessingSteps() { final ProcessBindable processBindable = new ProcessBindable(); mProcessingSteps = Arrays.asList( diff --git a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java index ab2b8bff..26706a6a 100644 --- a/compiler/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java +++ b/compiler/src/main/java/android/databinding/annotationprocessor/ProcessExpressions.java @@ -19,6 +19,7 @@ package android.databinding.annotationprocessor; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.SystemUtils; import android.databinding.BindingBuildInfo; import android.databinding.tool.CompilerChef; @@ -133,7 +134,7 @@ public class ProcessExpressions extends ProcessDataBinding.ProcessingStep { } if (forLibraryModule) { Set<String> classNames = compilerChef.getWrittenClassNames(); - String out = StringUtils.join(classNames, System.getProperty("line.separator")); + String out = StringUtils.join(classNames, SystemUtils.LINE_SEPARATOR); L.d("Writing list of classes to %s . \nList:%s", exportClassNamesTo, out); try { //noinspection ConstantConditions diff --git a/compiler/src/main/java/android/databinding/tool/BindingTarget.java b/compiler/src/main/java/android/databinding/tool/BindingTarget.java index 9a05d8d2..762433cc 100644 --- a/compiler/src/main/java/android/databinding/tool/BindingTarget.java +++ b/compiler/src/main/java/android/databinding/tool/BindingTarget.java @@ -164,7 +164,7 @@ public class BindingTarget implements LocationScopeProvider { List<MergedBinding> mergeBindings = new ArrayList<MergedBinding>(); for (final SetterStore.MultiAttributeSetter setter : multiAttributeSetterCalls) { L.d("resolved %s", setter); - final List<Binding> mergedBindings = new ArrayList<>(); + final List<Binding> mergedBindings = new ArrayList<Binding>(); for (String attribute : setter.attributes) { Binding binding = lookup.get(attribute); Preconditions.checkNotNull(binding, "cannot find binding for %s", attribute); diff --git a/compiler/src/main/java/android/databinding/tool/MakeCopy.java b/compiler/src/main/java/android/databinding/tool/MakeCopy.java index f143e21d..7627e06d 100644 --- a/compiler/src/main/java/android/databinding/tool/MakeCopy.java +++ b/compiler/src/main/java/android/databinding/tool/MakeCopy.java @@ -28,6 +28,7 @@ import java.io.FileWriter; import java.io.FilenameFilter; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -166,13 +167,19 @@ public class MakeCopy { private static void processLayoutFiles(String applicationPackage, File resTarget, File srcDir, File xmlDir, int minSdk, boolean isLibrary) { - ArrayList<File> resourceFolders = new ArrayList<File>(); - resourceFolders.add(resTarget); MakeFileWriter makeFileWriter = new MakeFileWriter(srcDir); LayoutXmlProcessor xmlProcessor = new LayoutXmlProcessor(applicationPackage, - resourceFolders, makeFileWriter, minSdk, isLibrary); + makeFileWriter, minSdk, isLibrary, new LayoutXmlProcessor.OriginalFileLookup() { + @Override + public File getOriginalFileFor(File file) { + return file; + } + }); try { - xmlProcessor.processResources(minSdk); + LayoutXmlProcessor.ResourceInput input = new LayoutXmlProcessor.ResourceInput( + false, resTarget,resTarget + ); + xmlProcessor.processResources(input); xmlProcessor.writeLayoutInfoFiles(xmlDir); // TODO Looks like make does not support excluding from libs ? xmlProcessor.writeInfoClass(null, xmlDir, null); diff --git a/compiler/src/main/java/android/databinding/tool/MergedBinding.java b/compiler/src/main/java/android/databinding/tool/MergedBinding.java index 53278752..edeb9ee8 100644 --- a/compiler/src/main/java/android/databinding/tool/MergedBinding.java +++ b/compiler/src/main/java/android/databinding/tool/MergedBinding.java @@ -53,7 +53,7 @@ public class MergedBinding extends Binding { } private static Expr createArgListExpr(ExprModel model, final Iterable<Binding> bindings) { - List<Expr> args = new ArrayList<>(); + List<Expr> args = new ArrayList<Expr>(); for (Binding binding : bindings) { args.add(binding.getExpr()); } @@ -93,13 +93,13 @@ public class MergedBinding extends Binding { @Override public String toJavaCode(String targetViewName, String bindingComponent) { final ArgListExpr args = (ArgListExpr) getExpr(); - final List<String> newValues = new ArrayList<>(); + final List<String> newValues = new ArrayList<String>(); for (Expr expr : args.getChildren()) { newValues.add(expr.toCode().generate()); } final List<String> oldValues; if (requiresOldValue()) { - oldValues = new ArrayList<>(); + oldValues = new ArrayList<String>(); for (Expr expr : args.getChildren()) { oldValues.add("this." + WriterPackage.getOldValueName(expr)); } @@ -112,7 +112,7 @@ public class MergedBinding extends Binding { } private static <T> T[] concat(List<T> l1, List<T> l2, Class<T> klass) { - List<T> result = new ArrayList<>(); + List<T> result = new ArrayList<T>(); result.addAll(l1); result.addAll(l2); return result.toArray((T[]) Array.newInstance(klass, result.size())); diff --git a/compiler/src/main/java/android/databinding/tool/expr/BuiltInVariableExpr.java b/compiler/src/main/java/android/databinding/tool/expr/BuiltInVariableExpr.java index d9167bfa..ab1ab21c 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/BuiltInVariableExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/BuiltInVariableExpr.java @@ -37,7 +37,7 @@ public class BuiltInVariableExpr extends IdentifierExpr { @Override protected List<Dependency> constructDependencies() { - return new ArrayList<>(); + return new ArrayList<Dependency>(); } @Override diff --git a/compiler/src/main/java/android/databinding/tool/expr/Expr.java b/compiler/src/main/java/android/databinding/tool/expr/Expr.java index b321ed1d..b4b950e7 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/Expr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/Expr.java @@ -63,7 +63,7 @@ abstract public class Expr implements VersionProvider, LocationScopeProvider { private boolean mCanBeInvalidated = false; @Nullable - private List<Location> mLocations = new ArrayList<>(); + private List<Location> mLocations = new ArrayList<Location>(); /** * This set denotes the times when this expression is invalid. diff --git a/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java b/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java index c92b79d0..8f3b6bf6 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ExprModel.java @@ -302,8 +302,8 @@ public class ExprModel { int counter = 0; final Iterable<Expr> observables = filterObservables(modelAnalyzer); - List<String> flagMapping = new ArrayList<>(); - mObservables = new ArrayList<>(); + List<String> flagMapping = new ArrayList<String>(); + mObservables = new ArrayList<Expr>(); for (Expr expr : observables) { // observables gets initial ids flagMapping.add(expr.getUniqueKey()); @@ -450,7 +450,7 @@ public class ExprModel { } private List<Expr> filterNonObservableIds(final ModelAnalyzer modelAnalyzer) { - List<Expr> result = new ArrayList<>(); + List<Expr> result = new ArrayList<Expr>(); for (Expr input : mExprMap.values()) { if (input instanceof IdentifierExpr && !input.hasId() @@ -463,7 +463,7 @@ public class ExprModel { } private Iterable<Expr> filterObservables(final ModelAnalyzer modelAnalyzer) { - List<Expr> result = new ArrayList<>(); + List<Expr> result = new ArrayList<Expr>(); for (Expr input : mExprMap.values()) { if (input.isObservable()) { result.add(input); @@ -474,7 +474,7 @@ public class ExprModel { public List<Expr> getPendingExpressions() { if (mPendingExpressions == null) { - mPendingExpressions = new ArrayList<>(); + mPendingExpressions = new ArrayList<Expr>(); for (Expr expr : mExprMap.values()) { // if an expression is NOT dynanic but has conditional dependants, still return it // so that conditional flags can be set @@ -488,7 +488,7 @@ public class ExprModel { public boolean markBitsRead() { // each has should read flags, we set them back on them - List<Expr> markedSomeFlagsRead = new ArrayList<>(); + List<Expr> markedSomeFlagsRead = new ArrayList<Expr>(); for (Expr expr : filterShouldRead(getPendingExpressions())) { expr.markFlagsAsRead(expr.getShouldReadFlags()); markedSomeFlagsRead.add(expr); @@ -498,7 +498,7 @@ public class ExprModel { private boolean pruneDone(List<Expr> markedSomeFlagsAsRead) { boolean marked = true; - List<Expr> markedAsReadList = new ArrayList<>(); + List<Expr> markedAsReadList = new ArrayList<Expr>(); while (marked) { marked = false; for (Expr expr : mExprMap.values()) { @@ -556,7 +556,7 @@ public class ExprModel { } public static List<Expr> filterShouldRead(Iterable<Expr> exprs) { - List<Expr> result = new ArrayList<>(); + List<Expr> result = new ArrayList<Expr>(); for (Expr expr : exprs) { if (!expr.getShouldReadFlags().isEmpty() && !hasConditionalOrNestedCannotReadDependency(expr)) { diff --git a/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java b/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java index cdfa78bb..067a59cb 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java @@ -69,7 +69,7 @@ public class IdentifierExpr extends Expr { @Override protected List<Dependency> constructDependencies() { - return new ArrayList<>(); + return new ArrayList<Dependency>(); } @Override diff --git a/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java b/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java index 1151dfac..d5e85bb5 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java @@ -69,7 +69,7 @@ public class ListenerExpr extends Expr { @Override protected List<Dependency> constructDependencies() { - final List<Dependency> dependencies = new ArrayList<>(); + final List<Dependency> dependencies = new ArrayList<Dependency>(); Dependency dependency = new Dependency(this, getChild()); dependency.setMandatory(true); dependencies.add(dependency); diff --git a/compiler/src/main/java/android/databinding/tool/expr/MethodCallExpr.java b/compiler/src/main/java/android/databinding/tool/expr/MethodCallExpr.java index 9e8e8c16..a81cffe6 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/MethodCallExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/MethodCallExpr.java @@ -38,7 +38,7 @@ public class MethodCallExpr extends Expr { Callable mGetter; static List<Expr> concat(Expr e, List<Expr> list) { - List<Expr> merged = new ArrayList<>(); + List<Expr> merged = new ArrayList<Expr>(); merged.add(e); merged.addAll(list); return merged; diff --git a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java index bdb9450c..8ac352d7 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ResourceExpr.java @@ -27,7 +27,7 @@ public class ResourceExpr extends Expr { private final static Map<String, String> RESOURCE_TYPE_TO_R_OBJECT; static { - RESOURCE_TYPE_TO_R_OBJECT = new HashMap<>(); + RESOURCE_TYPE_TO_R_OBJECT = new HashMap<String, String>(); RESOURCE_TYPE_TO_R_OBJECT.put("colorStateList", "color "); RESOURCE_TYPE_TO_R_OBJECT.put("dimenOffset", "dimen "); RESOURCE_TYPE_TO_R_OBJECT.put("dimenSize", "dimen "); @@ -60,7 +60,7 @@ public class ResourceExpr extends Expr { private Map<String, ModelClass> getResourceToTypeMapping(ModelAnalyzer modelAnalyzer) { if (mResourceToTypeMapping == null) { final Map<String, String> imports = getModel().getImports(); - mResourceToTypeMapping = new HashMap<>(); + mResourceToTypeMapping = new HashMap<String, ModelClass>(); mResourceToTypeMapping.put("anim", modelAnalyzer.findClass("android.view.animation.Animation", imports)); mResourceToTypeMapping.put("animator", modelAnalyzer.findClass("android.animation.Animator", diff --git a/compiler/src/main/java/android/databinding/tool/expr/SymbolExpr.java b/compiler/src/main/java/android/databinding/tool/expr/SymbolExpr.java index 3852b91e..6af6c298 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/SymbolExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/SymbolExpr.java @@ -54,6 +54,6 @@ public class SymbolExpr extends Expr { @Override protected List<Dependency> constructDependencies() { - return new ArrayList<>(); + return new ArrayList<Dependency>(); } } diff --git a/compiler/src/main/java/android/databinding/tool/expr/TernaryExpr.java b/compiler/src/main/java/android/databinding/tool/expr/TernaryExpr.java index 12379c20..90076c4c 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/TernaryExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/TernaryExpr.java @@ -67,7 +67,7 @@ public class TernaryExpr extends Expr { @Override protected List<Dependency> constructDependencies() { - List<Dependency> deps = new ArrayList<>(); + List<Dependency> deps = new ArrayList<Dependency>(); Expr predExpr = getPred(); final Dependency pred = new Dependency(this, predExpr); pred.setMandatory(true); diff --git a/compiler/src/main/java/android/databinding/tool/reflection/SdkUtil.java b/compiler/src/main/java/android/databinding/tool/reflection/SdkUtil.java index e8c962ef..da73f66f 100644 --- a/compiler/src/main/java/android/databinding/tool/reflection/SdkUtil.java +++ b/compiler/src/main/java/android/databinding/tool/reflection/SdkUtil.java @@ -103,7 +103,7 @@ public class SdkUtil { private void buildFullLookup() throws XPathExpressionException { NodeList allClasses = mDoc.getChildNodes().item(0).getChildNodes(); - mFullLookup = new HashMap<>(allClasses.getLength() * 4); + mFullLookup = new HashMap<String, Integer>(allClasses.getLength() * 4); for (int j = 0; j < allClasses.getLength(); j++) { Node node = allClasses.item(j); if (node.getNodeType() != Node.ELEMENT_NODE || !"class" diff --git a/compiler/src/main/java/android/databinding/tool/reflection/annotation/AnnotationAnalyzer.java b/compiler/src/main/java/android/databinding/tool/reflection/annotation/AnnotationAnalyzer.java index f02e0511..4f110889 100644 --- a/compiler/src/main/java/android/databinding/tool/reflection/annotation/AnnotationAnalyzer.java +++ b/compiler/src/main/java/android/databinding/tool/reflection/annotation/AnnotationAnalyzer.java @@ -37,7 +37,7 @@ public class AnnotationAnalyzer extends ModelAnalyzer { public static final Map<String, TypeKind> PRIMITIVE_TYPES; static { - PRIMITIVE_TYPES = new HashMap<>(); + PRIMITIVE_TYPES = new HashMap<String, TypeKind>(); PRIMITIVE_TYPES.put("boolean", TypeKind.BOOLEAN); PRIMITIVE_TYPES.put("byte", TypeKind.BYTE); PRIMITIVE_TYPES.put("short", TypeKind.SHORT); diff --git a/compiler/src/main/java/android/databinding/tool/store/SetterStore.java b/compiler/src/main/java/android/databinding/tool/store/SetterStore.java index b5b0d2b2..45592c4d 100644 --- a/compiler/src/main/java/android/databinding/tool/store/SetterStore.java +++ b/compiler/src/main/java/android/databinding/tool/store/SetterStore.java @@ -449,7 +449,7 @@ public class SetterStore { private void ensureInstanceAdapters() { if (mInstanceAdapters == null) { - HashSet<String> adapters = new HashSet<>(); + HashSet<String> adapters = new HashSet<String>(); for (HashMap<AccessorKey, MethodDescription> methods : mStore.adapterMethods.values()) { for (MethodDescription method : methods.values()) { if (!method.isStatic) { @@ -462,12 +462,12 @@ public class SetterStore { adapters.add(method.type); } } - mInstanceAdapters = new HashMap<>(); + mInstanceAdapters = new HashMap<String, List<String>>(); for (String adapter : adapters) { final String simpleName = simpleName(adapter); List<String> list = mInstanceAdapters.get(simpleName); if (list == null) { - list = new ArrayList<>(); + list = new ArrayList<String>(); mInstanceAdapters.put(simpleName, list); } list.add(adapter); diff --git a/compiler/src/main/java/android/databinding/tool/util/GenerationalClassUtil.java b/compiler/src/main/java/android/databinding/tool/util/GenerationalClassUtil.java index 6a06b75a..18e4b964 100644 --- a/compiler/src/main/java/android/databinding/tool/util/GenerationalClassUtil.java +++ b/compiler/src/main/java/android/databinding/tool/util/GenerationalClassUtil.java @@ -80,7 +80,9 @@ public class GenerationalClassUtil { // assume it is a zip file loadFomZipFile(file); } - } catch (IOException | URISyntaxException e) { + } catch (IOException e) { + L.d("cannot open zip file from %s", url); + } catch (URISyntaxException e) { L.d("cannot open zip file from %s", url); } } diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt index 9e41c2d6..edf89c27 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt @@ -16,11 +16,12 @@ package android.databinding.tool.writer +import org.apache.commons.lang3.SystemUtils import kotlin.properties.Delegates class BRWriter(properties: Set<String>, val useFinal : Boolean) { val indexedProps = properties.sort().withIndex() - public fun write(pkg : String): String = "package $pkg;${System.lineSeparator()}$klass" + public fun write(pkg : String): String = "package $pkg;${SystemUtils.LINE_SEPARATOR}$klass" val klass: String by Delegates.lazy { kcode("") { val prefix = if (useFinal) "final " else ""; diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt index fbba6554..6a583a6a 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt @@ -13,13 +13,14 @@ package android.databinding.tool.writer +import org.apache.commons.lang3.SystemUtils import java.util.BitSet class KCode (private val s : String? = null){ private var sameLine = false - private val lineSeparator = System.getProperty("line.separator") + private val lineSeparator = SystemUtils.LINE_SEPARATOR class Appendix(val glue : String, val code : KCode) diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt index b351a2f2..cad7db10 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt @@ -30,6 +30,9 @@ import android.databinding.tool.ext.versionedLazy import android.databinding.tool.processing.ErrorMessages import android.databinding.tool.reflection.ModelAnalyzer import android.databinding.tool.util.L +import org.apache.commons.lang3.JavaVersion +import org.apache.commons.lang3.SystemUtils +import java.lang import java.util.ArrayList import java.util.Arrays import java.util.BitSet @@ -237,8 +240,7 @@ fun FlagSet.localValue(bucketIndex : Int) = fun FlagSet.binaryCode(bucketIndex : Int) = longToBinary(buckets[bucketIndex]) -fun longToBinary(l : Long) = - "0b${java.lang.Long.toBinaryString(l)}L" +fun longToBinary(l : Long) = "0x${lang.Long.toHexString(l)}L" fun <T> FlagSet.mapOr(other : FlagSet, cb : (suffix : String, index : Int) -> T) : List<T> { val min = Math.min(buckets.size(), other.buckets.size()) diff --git a/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java b/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java index 41d2e981..198cc03e 100644 --- a/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java +++ b/compiler/src/test/java/android/databinding/tool/expr/ExprModelTest.java @@ -175,7 +175,7 @@ public class ExprModelTest { assertExactMatch(shouldRead, a, b, ternaryExpr); first = getReadFirst(shouldRead); assertExactMatch(first, a, b); - List<Expr> justRead = new ArrayList<>(); + List<Expr> justRead = new ArrayList<Expr>(); justRead.add(a); justRead.add(b); first = filterOut(getReadFirst(shouldRead, justRead), justRead); diff --git a/compilerCommon/build.gradle b/compilerCommon/build.gradle index f2d1e2cc..0c82f83a 100644 --- a/compilerCommon/build.gradle +++ b/compilerCommon/build.gradle @@ -17,8 +17,8 @@ apply plugin: 'java' apply plugin: 'com.android.databinding.bintray' -sourceCompatibility = config.javaTargetCompatibility -targetCompatibility = config.javaSourceCompatibility +sourceCompatibility = dataBindingConfig.javaSourceCompatibility +targetCompatibility = dataBindingConfig.javaTargetCompatibility sourceSets { main { @@ -37,8 +37,8 @@ sourceSets { } dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' - compile project(':baseLibrary') + testCompile 'junit:junit:4.12' + compile project(':dataBinding:baseLibrary') compile 'org.apache.commons:commons-lang3:3.3.2' compile 'com.tunnelvisionlabs:antlr4:4.5' compile 'commons-io:commons-io:2.4' @@ -58,3 +58,22 @@ project.tasks.create(name : "generateGrammar", type : JavaExec) { args "BindingExpression.g4", "-visitor", "-o", "src/main/grammar-gen/android/databinding/parser", "-package", "android.databinding.parser" } +tasks.create(name : 'exportBuildVersions') << { + def props = new Properties(); + def buildVersionFile = new File(sourceSets.main.output.resourcesDir,"data_binding_version_info.properties") + buildVersionFile.delete() + props.put("compilerCommon", project.version) + props.put("compiler", rootProject.findProject("dataBinding:compiler").version) + props.put("baseLibrary", rootProject.findProject("dataBinding:baseLibrary").version) + props.put("extensions", dataBindingConfig.extensionsVersion) + buildVersionFile.getParentFile().mkdirs() + def outStream = new FileOutputStream(buildVersionFile) + try { + props.store(outStream, "") + } finally { + outStream.close() + } +} + +tasks['jar'].dependsOn('exportBuildVersions') +tasks['exportBuildVersions'].dependsOn('processResources')
\ No newline at end of file diff --git a/compilerCommon/src/main/java/android/databinding/tool/DataBindingBuilder.java b/compilerCommon/src/main/java/android/databinding/tool/DataBindingBuilder.java new file mode 100644 index 00000000..0e5d757b --- /dev/null +++ b/compilerCommon/src/main/java/android/databinding/tool/DataBindingBuilder.java @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * 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. + */ + +package android.databinding.tool; + +import org.apache.commons.io.IOUtils; + +import android.databinding.tool.processing.Scope; +import android.databinding.tool.processing.ScopedException; +import android.databinding.tool.util.L; +import android.databinding.tool.util.Preconditions; +import android.databinding.tool.writer.JavaFileWriter; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + + +/** + * This class is used by Android Gradle plugin. + */ +@SuppressWarnings("unused") +public class DataBindingBuilder { + Versions mVersions; + private final static String EXCLUDE_PATTERN = "android/databinding/layouts/*.*"; + public String getCompilerVersion() { + return getVersions().compiler; + } + + public String getBaseLibraryVersion(String compilerVersion) { + return getVersions().baseLibrary; + } + + public String getLibraryVersion(String compilerVersion) { + return getVersions().extensions; + } + + public String getBaseAdaptersVersion(String compilerVersion) { + return getVersions().extensions; + } + + public void setPrintMachineReadableOutput(boolean machineReadableOutput) { + ScopedException.encodeOutput(machineReadableOutput); + } + + public boolean getPrintMachineReadableOutput() { + return ScopedException.issEncodeOutput(); + } + + public void setDebugLogEnabled(boolean enableDebugLogs) { + L.setDebugLog(enableDebugLogs); + } + + public boolean isDebugLogEnabled() { + return L.isDebugEnabled(); + } + + private Versions getVersions() { + if (mVersions != null) { + return mVersions; + } + try { + Properties props = new Properties(); + InputStream stream = getClass().getResourceAsStream("/data_binding_version_info.properties"); + try { + props.load(stream); + mVersions = new Versions(props); + } finally { + IOUtils.closeQuietly(stream); + } + } catch (IOException exception) { + L.e(exception, "Cannot read data binding version"); + } + return mVersions; + } + + /** + * Returns the list of classes that should be excluded from package task + * + * @param layoutXmlProcessor The LayoutXmlProcessor for this variant + * @param generatedClassListFile The location of the File into which data binding compiler wrote + * list of generated classes + * + * @return The list of classes to exclude. They are already in JNI format. + */ + public List<String> getJarExcludeList(LayoutXmlProcessor layoutXmlProcessor, + File generatedClassListFile) { + List<String> excludes = new ArrayList<String>(); + String appPkgAsClass = layoutXmlProcessor.getPackage().replace('.', '/'); + String infoClassAsClass = layoutXmlProcessor.getInfoClassFullName().replace('.', '/'); + + excludes.add(infoClassAsClass + ".class"); + excludes.add(EXCLUDE_PATTERN); + excludes.add(appPkgAsClass + "/BR.*"); + excludes.add("android/databinding/DynamicUtil.class"); + if (generatedClassListFile != null) { + List<String> generatedClasses = readGeneratedClasses(generatedClassListFile); + for (String klass : generatedClasses) { + excludes.add(klass.replace('.', '/') + ".class"); + } + } + Scope.assertNoError(); + return excludes; + } + + private List<String> readGeneratedClasses(File generatedClassListFile) { + Preconditions.checkNotNull(generatedClassListFile, "Data binding exclude generated task" + + " is not configured properly"); + Preconditions.check(generatedClassListFile.exists(), + "Generated class list does not exist %s", generatedClassListFile.getAbsolutePath()); + FileInputStream fis = null; + try { + fis = new FileInputStream(generatedClassListFile); + return IOUtils.readLines(fis); + } catch (FileNotFoundException e) { + L.e(e, "Unable to read generated class list from %s", + generatedClassListFile.getAbsoluteFile()); + } catch (IOException e) { + L.e(e, "Unexpected exception while reading %s", + generatedClassListFile.getAbsoluteFile()); + } finally { + IOUtils.closeQuietly(fis); + } + L.e("Could not read data binding generated class list"); + return null; + } + + public JavaFileWriter createJavaFileWriter(File outFolder) { + return new GradleFileWriter(outFolder.getAbsolutePath()); + } + + static class GradleFileWriter extends JavaFileWriter { + + private final String outputBase; + + public GradleFileWriter(String outputBase) { + this.outputBase = outputBase; + } + + @Override + public void writeToFile(String canonicalName, String contents) { + String asPath = canonicalName.replace('.', '/'); + File f = new File(outputBase + "/" + asPath + ".java"); + //noinspection ResultOfMethodCallIgnored + f.getParentFile().mkdirs(); + FileOutputStream fos = null; + try { + fos = new FileOutputStream(f); + IOUtils.write(contents, fos); + } catch (IOException e) { + L.e(e, "cannot write file " + f.getAbsolutePath()); + } finally { + IOUtils.closeQuietly(fos); + } + } + } + + private static class Versions { + final String compilerCommon; + final String compiler; + final String baseLibrary; + final String extensions; + + public Versions(Properties properties) { + compilerCommon = properties.getProperty("compilerCommon"); + compiler = properties.getProperty("compiler"); + baseLibrary = properties.getProperty("baseLibrary"); + extensions = properties.getProperty("extensions"); + Preconditions.checkNotNull(compilerCommon, "cannot read compiler common version"); + Preconditions.checkNotNull(compiler, "cannot read compiler version"); + Preconditions.checkNotNull(baseLibrary, "cannot read baseLibrary version"); + Preconditions.checkNotNull(extensions, "cannot read extensions version"); + } + } +}
\ No newline at end of file diff --git a/compilerCommon/src/main/java/android/databinding/tool/LayoutXmlProcessor.java b/compilerCommon/src/main/java/android/databinding/tool/LayoutXmlProcessor.java index 49d003be..22835f1a 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/LayoutXmlProcessor.java +++ b/compilerCommon/src/main/java/android/databinding/tool/LayoutXmlProcessor.java @@ -13,18 +13,22 @@ package android.databinding.tool; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.xml.sax.SAXException; import android.databinding.BindingBuildInfo; import android.databinding.tool.store.LayoutFileParser; import android.databinding.tool.store.ResourceBundle; +import android.databinding.tool.util.Preconditions; import android.databinding.tool.writer.JavaFileWriter; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.io.StringWriter; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -52,41 +56,82 @@ public class LayoutXmlProcessor { private boolean mWritten; private final boolean mIsLibrary; private final String mBuildId = UUID.randomUUID().toString(); - // can be a list of xml files or folders that contain XML files - private final List<File> mResources; - private OriginalFileLookup mOriginalFileLookup; + private final OriginalFileLookup mOriginalFileLookup; - public LayoutXmlProcessor(String applicationPackage, List<File> resources, - JavaFileWriter fileWriter, int minSdk, boolean isLibrary) { + public LayoutXmlProcessor(String applicationPackage, + JavaFileWriter fileWriter, int minSdk, boolean isLibrary, + OriginalFileLookup originalFileLookup) { mFileWriter = fileWriter; mResourceBundle = new ResourceBundle(applicationPackage); - mResources = resources; mMinSdk = minSdk; mIsLibrary = isLibrary; + mOriginalFileLookup = originalFileLookup; } - public void setOriginalFileLookup(OriginalFileLookup originalFileLookup) { - mOriginalFileLookup = originalFileLookup; + private static void processIncrementalInputFiles(ResourceInput input, + ProcessFileCallback callback) + throws IOException, ParserConfigurationException, XPathExpressionException, + SAXException { + processExistingIncrementalFiles(input.getRootInputFolder(), input.getAdded(), callback); + processExistingIncrementalFiles(input.getRootInputFolder(), input.getChanged(), callback); + processRemovedIncrementalFiles(input.getRootInputFolder(), input.getRemoved(), callback); } - public static List<File> getLayoutFiles(List<File> resources) { - List<File> result = new ArrayList<File>(); - for (File resource : resources) { - if (!resource.exists() || !resource.canRead()) { - continue; + private static void processExistingIncrementalFiles(File inputRoot, List<File> files, + ProcessFileCallback callback) + throws IOException, XPathExpressionException, SAXException, + ParserConfigurationException { + for (File file : files) { + File parent = file.getParentFile(); + if (inputRoot.equals(parent)) { + callback.processOtherRootFile(file); + } else if (layoutFolderFilter.accept(parent, parent.getName())) { + callback.processLayoutFile(file); + } else { + callback.processOtherFile(parent, file); } - if (resource.isDirectory()) { - for (File layoutFolder : resource.listFiles(layoutFolderFilter)) { - for (File xmlFile : layoutFolder.listFiles(xmlFileFilter)) { - result.add(xmlFile); - } + } + } + + private static void processRemovedIncrementalFiles(File inputRoot, List<File> files, + ProcessFileCallback callback) + throws IOException { + for (File file : files) { + File parent = file.getParentFile(); + if (inputRoot.equals(parent)) { + callback.processRemovedOtherRootFile(file); + } else if (layoutFolderFilter.accept(parent, parent.getName())) { + callback.processRemovedLayoutFile(file); + } else { + callback.processRemovedOtherFile(parent, file); + } + } + } + private static void processAllInputFiles(ResourceInput input, ProcessFileCallback callback) + throws IOException, XPathExpressionException, SAXException, + ParserConfigurationException { + FileUtils.deleteDirectory(input.getRootOutputFolder()); + Preconditions.check(input.getRootOutputFolder().mkdirs(), "out dir should be re-created"); + Preconditions.check(input.getRootInputFolder().isDirectory(), "it must be a directory"); + for (File firstLevel : input.getRootInputFolder().listFiles()) { + if (firstLevel.isDirectory()) { + if (layoutFolderFilter.accept(firstLevel, firstLevel.getName())) { + callback.processLayoutFolder(firstLevel); + for (File xmlFile : firstLevel.listFiles(xmlFileFilter)) { + callback.processLayoutFile(xmlFile); + } + } else { + callback.processOtherFolder(firstLevel); + for (File file : firstLevel.listFiles()) { + callback.processOtherFile(firstLevel, file); + } } - } else if (xmlFileFilter.accept(resource.getParentFile(), resource.getName())) { - result.add(resource); + } else { + callback.processOtherRootFile(firstLevel); } + } - return result; } /** @@ -96,24 +141,97 @@ public class LayoutXmlProcessor { return mResourceBundle; } - public boolean processResources(int minSdk) + public boolean processResources(final ResourceInput input) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { if (mProcessingComplete) { return false; } - LayoutFileParser layoutFileParser = new LayoutFileParser(); - for (File xmlFile : getLayoutFiles(mResources)) { - final ResourceBundle.LayoutFileBundle bindingLayout = layoutFileParser - .parseXml(xmlFile, mResourceBundle.getAppPackage(), mOriginalFileLookup); - if (bindingLayout != null && !bindingLayout.isEmpty()) { - mResourceBundle.addLayoutBundle(bindingLayout); + final LayoutFileParser layoutFileParser = new LayoutFileParser(); + final URI inputRootUri = input.getRootInputFolder().toURI(); + ProcessFileCallback callback = new ProcessFileCallback() { + private File convertToOutFile(File file) { + final String subPath = toSystemDependentPath(inputRootUri + .relativize(file.toURI()).getPath()); + return new File(input.getRootOutputFolder(), subPath); + } + @Override + public void processLayoutFile(File file) + throws ParserConfigurationException, SAXException, XPathExpressionException, + IOException { + File output = convertToOutFile(file); + final ResourceBundle.LayoutFileBundle bindingLayout = layoutFileParser + .parseXml(file, output, mResourceBundle.getAppPackage(), mOriginalFileLookup); + if (bindingLayout != null && !bindingLayout.isEmpty()) { + mResourceBundle.addLayoutBundle(bindingLayout); + } + } + + @Override + public void processOtherFile(File parentFolder, File file) throws IOException { + File outParent = convertToOutFile(parentFolder); + FileUtils.copyFile(file, new File(outParent, file.getName())); + } + + @Override + public void processRemovedLayoutFile(File file) { + mResourceBundle.addRemovedFile(file); } + + @Override + public void processRemovedOtherFile(File parentFolder, File file) throws IOException { + File outParent = convertToOutFile(parentFolder); + FileUtils.forceDelete(new File(outParent, file.getName())); + } + + @Override + public void processOtherFolder(File folder) { + //noinspection ResultOfMethodCallIgnored + convertToOutFile(folder).mkdirs(); + } + + @Override + public void processLayoutFolder(File folder) { + //noinspection ResultOfMethodCallIgnored + convertToOutFile(folder).mkdirs(); + } + + @Override + public void processOtherRootFile(File file) throws IOException { + File outFile = convertToOutFile(file); + if (file.isDirectory()) { + FileUtils.copyDirectory(file, outFile); + } else { + FileUtils.copyFile(file, outFile); + } + } + + @Override + public void processRemovedOtherRootFile(File file) throws IOException { + final File outFile = convertToOutFile(file); + if (file.isDirectory()) { + FileUtils.deleteDirectory(outFile); + } else { + FileUtils.deleteQuietly(outFile); + } + } + }; + if (input.isIncremental()) { + processIncrementalInputFiles(input, callback); + } else { + processAllInputFiles(input, callback); } mProcessingComplete = true; return true; } + public static String toSystemDependentPath(String path) { + if (File.separatorChar != '/') { + path = path.replace('/', File.separatorChar); + } + return path; + } + public void writeLayoutInfoFiles(File xmlOutDir) throws JAXBException { if (mWritten) { return; @@ -127,12 +245,16 @@ public class LayoutXmlProcessor { writeXmlFile(xmlOutDir, layout, marshaller); } } + for (File file : mResourceBundle.getRemovedFiles()) { + String exportFileName = generateExportFileName(file); + FileUtils.deleteQuietly(new File(xmlOutDir, exportFileName)); + } mWritten = true; } private void writeXmlFile(File xmlOutDir, ResourceBundle.LayoutFileBundle layout, Marshaller marshaller) throws JAXBException { - String filename = generateExportFileName(layout) + ".xml"; + String filename = generateExportFileName(layout); String xml = toXML(layout, marshaller); mFileWriter.writeToFile(new File(xmlOutDir, filename), xml); } @@ -152,9 +274,19 @@ public class LayoutXmlProcessor { * Generates a string identifier that can uniquely identify the given layout bundle. * This identifier can be used when we need to export data about this layout bundle. */ - public String generateExportFileName(ResourceBundle.LayoutFileBundle layout) { - StringBuilder name = new StringBuilder(layout.getFileName()); - name.append('-').append(layout.getDirectory()); + private static String generateExportFileName(ResourceBundle.LayoutFileBundle layout) { + return generateExportFileName(layout.getFileName(), layout.getDirectory()); + } + + private static String generateExportFileName(File file) { + final String fileName = file.getName(); + return generateExportFileName(fileName.substring(0, fileName.lastIndexOf('.')), + file.getParentFile().getName()); + } + + public static String generateExportFileName(String fileName, String dirName) { + StringBuilder name = new StringBuilder(fileName); + name.append('-').append(dirName); for (int i = name.length() - 1; i >= 0; i--) { char c = name.charAt(i); if (c == '-') { @@ -163,6 +295,7 @@ public class LayoutXmlProcessor { name.setCharAt(i, c); } } + name.append(".xml"); return name.toString(); } @@ -171,6 +304,10 @@ public class LayoutXmlProcessor { writeInfoClass(sdkDir, xmlOutDir, exportClassListTo, false, false); } + public String getPackage() { + return mResourceBundle.getAppPackage(); + } + public void writeInfoClass(/*Nullable*/ File sdkDir, File xmlOutDir, File exportClassListTo, boolean enableDebugLogs, boolean printEncodedErrorLogs) { final String sdkPath = sdkDir == null ? null : StringEscapeUtils.escapeJava(sdkDir.getAbsolutePath()); @@ -218,4 +355,78 @@ public class LayoutXmlProcessor { */ File getOriginalFileFor(File file); } + + /** + * API agnostic class to get resource changes incrementally. + */ + public static class ResourceInput { + private final boolean mIncremental; + private final File mRootInputFolder; + private final File mRootOutputFolder; + + private List<File> mAdded = new ArrayList<File>(); + private List<File> mRemoved = new ArrayList<File>(); + private List<File> mChanged = new ArrayList<File>(); + + public ResourceInput(boolean incremental, File rootInputFolder, File rootOutputFolder) { + mIncremental = incremental; + mRootInputFolder = rootInputFolder; + mRootOutputFolder = rootOutputFolder; + } + + public void added(File file) { + mAdded.add(file); + } + public void removed(File file) { + mRemoved.add(file); + } + public void changed(File file) { + mChanged.add(file); + } + + public boolean shouldCopy() { + return !mRootInputFolder.equals(mRootOutputFolder); + } + + List<File> getAdded() { + return mAdded; + } + + List<File> getRemoved() { + return mRemoved; + } + + List<File> getChanged() { + return mChanged; + } + + File getRootInputFolder() { + return mRootInputFolder; + } + + File getRootOutputFolder() { + return mRootOutputFolder; + } + + public boolean isIncremental() { + return mIncremental; + } + } + + private interface ProcessFileCallback { + void processLayoutFile(File file) + throws ParserConfigurationException, SAXException, XPathExpressionException, + IOException; + void processOtherFile(File parentFolder, File file) throws IOException; + void processRemovedLayoutFile(File file); + void processRemovedOtherFile(File parentFolder, File file) throws IOException; + + void processOtherFolder(File folder); + + void processLayoutFolder(File folder); + + void processOtherRootFile(File file) throws IOException; + + void processRemovedOtherRootFile(File file) throws IOException; + } } diff --git a/compilerCommon/src/main/java/android/databinding/tool/processing/Scope.java b/compilerCommon/src/main/java/android/databinding/tool/processing/Scope.java index c723c809..9e0a6924 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/processing/Scope.java +++ b/compilerCommon/src/main/java/android/databinding/tool/processing/Scope.java @@ -34,7 +34,7 @@ import java.util.List; public class Scope { private static ThreadLocal<ScopeEntry> sScopeItems = new ThreadLocal<ScopeEntry>(); - static List<ScopedException> sDeferredExceptions = new ArrayList<>(); + static List<ScopedException> sDeferredExceptions = new ArrayList<ScopedException>(); public static void enter(final Location location) { enter(new LocationScopeProvider() { @@ -165,7 +165,7 @@ public class Scope { return Arrays.asList(locations.get(0).toAbsoluteLocation()); } // We have more than 1 location. Depending on the scope, we may or may not want all of them - List<Location> chosen = new ArrayList<>(); + List<Location> chosen = new ArrayList<Location>(); for (Location location : locations) { Location absLocation = location.toAbsoluteLocation(); if (validatedContained(entry.mParent, absLocation)) { diff --git a/compilerCommon/src/main/java/android/databinding/tool/processing/ScopedException.java b/compilerCommon/src/main/java/android/databinding/tool/processing/ScopedException.java index d60c2d5f..f2ce2334 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/processing/ScopedException.java +++ b/compilerCommon/src/main/java/android/databinding/tool/processing/ScopedException.java @@ -17,6 +17,7 @@ package android.databinding.tool.processing; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.SystemUtils; import android.databinding.tool.store.Location; import android.databinding.tool.util.L; @@ -85,7 +86,7 @@ public class ScopedException extends RuntimeException { } } sb.append(ERROR_LOG_SUFFIX); - return StringUtils.join(StringUtils.split(sb.toString(), System.lineSeparator()), " "); + return StringUtils.join(StringUtils.split(sb.toString(), SystemUtils.LINE_SEPARATOR), " "); } public ScopedErrorReport getScopedErrorReport() { @@ -99,7 +100,7 @@ public class ScopedException extends RuntimeException { public static ScopedException createFromOutput(String output) { String message = ""; String file = ""; - List<Location> locations = new ArrayList<>(); + List<Location> locations = new ArrayList<Location>(); int msgStart = output.indexOf(MSG_KEY); if (msgStart < 0) { message = output; @@ -138,7 +139,7 @@ public class ScopedException extends RuntimeException { } public static List<ScopedException> extractErrors(String output) { - List<ScopedException> errors = new ArrayList<>(); + List<ScopedException> errors = new ArrayList<ScopedException>(); int index = output.indexOf(ERROR_LOG_PREFIX); final int limit = output.length(); while (index >= 0 && index < limit) { @@ -158,4 +159,8 @@ public class ScopedException extends RuntimeException { public static void encodeOutput(boolean encodeOutput) { sEncodeOutput = encodeOutput; } + + public static boolean issEncodeOutput() { + return sEncodeOutput; + } } diff --git a/compilerCommon/src/main/java/android/databinding/tool/store/LayoutFileParser.java b/compilerCommon/src/main/java/android/databinding/tool/store/LayoutFileParser.java index cadc9823..03d55d8e 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/store/LayoutFileParser.java +++ b/compilerCommon/src/main/java/android/databinding/tool/store/LayoutFileParser.java @@ -40,12 +40,8 @@ import android.databinding.tool.util.XmlEditor; import java.io.File; import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -71,24 +67,22 @@ public class LayoutFileParser { private static final String LAYOUT_PREFIX = "@layout/"; - public ResourceBundle.LayoutFileBundle parseXml(final File xml, String pkg, - LayoutXmlProcessor.OriginalFileLookup originalFileLookup) + public ResourceBundle.LayoutFileBundle parseXml(final File inputFile, final File outputFile, + String pkg, final LayoutXmlProcessor.OriginalFileLookup originalFileLookup) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException { + File originalFileFor = originalFileLookup.getOriginalFileFor(inputFile); + final String originalFilePath = originalFileFor.getAbsolutePath(); try { Scope.enter(new FileScopeProvider() { @Override public String provideScopeFilePath() { - return xml.getAbsolutePath(); + return originalFilePath; } }); - final String encoding = findEncoding(xml); - File original = stripFileAndGetOriginal(xml, originalFileLookup, encoding); - if (original == null) { - L.d("assuming the file is the original for %s", xml.getAbsoluteFile()); - original = xml; - } - return parseOriginalXml(original, pkg, encoding); + final String encoding = findEncoding(inputFile); + stripFile(inputFile, outputFile, encoding, originalFileLookup); + return parseOriginalXml(originalFileFor, pkg, encoding); } finally { Scope.exit(); } @@ -137,8 +131,10 @@ public class LayoutFileParser { private void parseExpressions(String newTag, final XMLParser.ElementContext rootView, final boolean isMerge, ResourceBundle.LayoutFileBundle bundle) { - final List<XMLParser.ElementContext> bindingElements = new ArrayList<>(); - final List<XMLParser.ElementContext> otherElementsWithIds = new ArrayList<>(); + final List<XMLParser.ElementContext> bindingElements + = new ArrayList<XMLParser.ElementContext>(); + final List<XMLParser.ElementContext> otherElementsWithIds + = new ArrayList<XMLParser.ElementContext>(); rootView.accept(new XMLParserBaseVisitor<Void>() { @Override public Void visitElement(@NotNull XMLParser.ElementContext ctx) { @@ -202,8 +198,7 @@ public class LayoutFileParser { } // if user is binding something there, there MUST be a layout file to be // generated. - String layoutName = includeValue.substring(LAYOUT_PREFIX.length()); - includedLayoutName = layoutName; + includedLayoutName = includeValue.substring(LAYOUT_PREFIX.length()); final ParserRuleContext myParentContent = parent.getParent(); Preconditions.check(myParentContent instanceof XMLParser.ContentContext, "parent of an include tag must be a content context but it is %s", @@ -336,7 +331,7 @@ public class LayoutFileParser { private List<XMLParser.ElementContext> filter(XMLParser.ElementContext root, String name) { - List<XMLParser.ElementContext> result = new ArrayList<>(); + List<XMLParser.ElementContext> result = new ArrayList<XMLParser.ElementContext>(); if (root == null) { return result; } @@ -354,7 +349,7 @@ public class LayoutFileParser { private List<XMLParser.ElementContext> filterNot(XMLParser.ElementContext root, String name) { - List<XMLParser.ElementContext> result = new ArrayList<>(); + List<XMLParser.ElementContext> result = new ArrayList<XMLParser.ElementContext>(); if (root == null) { return result; } @@ -374,11 +369,10 @@ public class LayoutFileParser { return "merge".equals(rootView.elmName.getText()) && filter(rootView, "include").size() > 0; } - private File stripFileAndGetOriginal(File xml, - LayoutXmlProcessor.OriginalFileLookup originalFileLookup, String encoding) + private void stripFile(File xml, File out, String encoding, + LayoutXmlProcessor.OriginalFileLookup originalFileLookup) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException { - L.d("parsing resource file %s", xml.getAbsolutePath()); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(xml); @@ -386,11 +380,9 @@ public class LayoutFileParser { XPath xPath = xPathFactory.newXPath(); File actualFile = originalFileLookup == null ? null : originalFileLookup.getOriginalFileFor(xml); - if (actualFile == null || !actualFile.exists()) { - actualFile = findOriginalFileFromComments(doc, xPath); - } + // TODO get rid of original file lookup if (actualFile == null) { - return null; + actualFile = xml; } // always create id from actual file when available. Gradle may duplicate files. String noExt = ParserHelper.stripExtension(actualFile.getName()); @@ -398,31 +390,10 @@ public class LayoutFileParser { // now if file has any binding expressions, find and delete them boolean changed = isBindingLayout(doc, xPath); if (changed) { - stripBindingTags(xml, binderId, encoding); + stripBindingTags(xml, out, binderId, encoding); + } else if (!xml.equals(out)){ + FileUtils.copyFile(xml, out); } - return actualFile; - } - - private File findOriginalFileFromComments(Document doc, XPath xPath) - throws XPathExpressionException, MalformedURLException { - final XPathExpression commentElementExpr = xPath - .compile("//comment()[starts-with(., \" From: file:\")][last()]"); - final NodeList commentElementNodes = (NodeList) commentElementExpr - .evaluate(doc, XPathConstants.NODESET); - L.d("comment element nodes count %s", commentElementNodes.getLength()); - if (commentElementNodes.getLength() == 0) { - L.d("cannot find comment element to find the actual file"); - return null; - } - final Node first = commentElementNodes.item(0); - String actualFilePath = first.getNodeValue().substring(" From:".length()).trim(); - L.d("actual file to parse: %s", actualFilePath); - File actualFile = urlToFile(new URL(actualFilePath)); - if (!actualFile.canRead()) { - L.d("cannot find original, skipping. %s", actualFile.getAbsolutePath()); - return null; - } - return actualFile; } private boolean isBindingLayout(Document doc, XPath xPath) throws XPathExpressionException { @@ -443,11 +414,12 @@ public class LayoutFileParser { return result; } - private void stripBindingTags(File xml, String newTag, String encoding) throws IOException { + private void stripBindingTags(File xml, File output, String newTag, String encoding) throws IOException { String res = XmlEditor.strip(xml, newTag, encoding); + Preconditions.checkNotNull(res, "layout file should've changed %s", xml.getAbsolutePath()); if (res != null) { L.d("file %s has changed, overwriting %s", xml.getName(), xml.getAbsolutePath()); - FileUtils.writeStringToFile(xml, res, encoding); + FileUtils.writeStringToFile(output, res, encoding); } } @@ -474,20 +446,8 @@ public class LayoutFileParser { } } - public static File urlToFile(URL url) throws MalformedURLException { - try { - return new File(url.toURI()); - } catch (IllegalArgumentException e) { - MalformedURLException ex = new MalformedURLException(e.getLocalizedMessage()); - ex.initCause(e); - throw ex; - } catch (URISyntaxException e) { - return new File(url.getPath()); - } - } - private static Map<String, String> attributeMap(XMLParser.ElementContext root) { - final Map<String, String> result = new HashMap<>(); + final Map<String, String> result = new HashMap<String, String>(); for (XMLParser.AttributeContext attr : XmlEditor.attributes(root)) { result.put(escapeQuotes(attr.attrName.getText(), false), escapeQuotes(attr.attrValue.getText(), true)); diff --git a/compilerCommon/src/main/java/android/databinding/tool/store/Location.java b/compilerCommon/src/main/java/android/databinding/tool/store/Location.java index d88f0de7..8c6d22c6 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/store/Location.java +++ b/compilerCommon/src/main/java/android/databinding/tool/store/Location.java @@ -18,6 +18,7 @@ package android.databinding.tool.store; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.Token; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.SystemUtils; import android.databinding.tool.processing.scopes.LocationScopeProvider; @@ -74,7 +75,7 @@ public class Location { } else { endLine = end.getLine() - 1; // token lines start from 1 String endText = end.getText(); - int lastLineStart = endText.lastIndexOf(System.lineSeparator()); + int lastLineStart = endText.lastIndexOf(SystemUtils.LINE_SEPARATOR); String lastLine = lastLineStart < 0 ? endText : endText.substring(lastLineStart + 1); endOffset = end.getCharPositionInLine() + lastLine.length() - 1;//end is inclusive } diff --git a/compilerCommon/src/main/java/android/databinding/tool/store/ResourceBundle.java b/compilerCommon/src/main/java/android/databinding/tool/store/ResourceBundle.java index e9879edf..072eea3a 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/store/ResourceBundle.java +++ b/compilerCommon/src/main/java/android/databinding/tool/store/ResourceBundle.java @@ -52,6 +52,8 @@ public class ResourceBundle implements Serializable { private HashMap<String, List<LayoutFileBundle>> mLayoutBundles = new HashMap<String, List<LayoutFileBundle>>(); + private List<File> mRemovedFiles = new ArrayList<File>(); + public ResourceBundle(String appPackage) { mAppPackage = appPackage; } @@ -86,7 +88,7 @@ public class ResourceBundle implements Serializable { public void validateMultiResLayouts() { for (List<LayoutFileBundle> layoutFileBundles : mLayoutBundles.values()) { for (LayoutFileBundle layoutFileBundle : layoutFileBundles) { - List<BindingTargetBundle> unboundIncludes = new ArrayList<>(); + List<BindingTargetBundle> unboundIncludes = new ArrayList<BindingTargetBundle>(); for (BindingTargetBundle target : layoutFileBundle.getBindingTargetBundles()) { if (target.isBinder()) { List<LayoutFileBundle> boundTo = @@ -166,7 +168,7 @@ public class ResourceBundle implements Serializable { Map<String, String> viewTypes = new HashMap<String, String>(); Map<String, String> includes = new HashMap<String, String>(); L.d("validating ids for %s", bundles.getKey()); - Set<String> conflictingIds = new HashSet<>(); + Set<String> conflictingIds = new HashSet<String>(); for (LayoutFileBundle bundle : bundles.getValue()) { try { Scope.enter(bundle); @@ -295,8 +297,8 @@ public class ResourceBundle implements Serializable { private Map<String, NameTypeLocation> validateAndMergeNameTypeLocations( List<LayoutFileBundle> bundles, String errorMessage, ValidateAndFilterCallback callback) { - Map<String, NameTypeLocation> result = new HashMap<>(); - Set<String> mismatched = new HashSet<>(); + Map<String, NameTypeLocation> result = new HashMap<String, NameTypeLocation>(); + Set<String> mismatched = new HashSet<String>(); for (LayoutFileBundle bundle : bundles) { for (NameTypeLocation item : callback.get(bundle)) { NameTypeLocation existing = result.get(item.name); @@ -365,6 +367,14 @@ public class ResourceBundle implements Serializable { return sharedClassName; } + public void addRemovedFile(File file) { + mRemovedFiles.add(file); + } + + public List<File> getRemovedFiles() { + return mRemovedFiles; + } + @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name="Layout") public static class LayoutFileBundle implements Serializable, FileScopeProvider { @@ -397,10 +407,10 @@ public class ResourceBundle implements Serializable { public boolean mHasVariations; @XmlElement(name="Variables") - public List<VariableDeclaration> mVariables = new ArrayList<>(); + public List<VariableDeclaration> mVariables = new ArrayList<VariableDeclaration>(); @XmlElement(name="Imports") - public List<NameTypeLocation> mImports = new ArrayList<>(); + public List<NameTypeLocation> mImports = new ArrayList<NameTypeLocation>(); @XmlElementWrapper(name="Targets") @XmlElement(name="Target") diff --git a/compilerCommon/src/main/java/android/databinding/tool/util/XmlEditor.java b/compilerCommon/src/main/java/android/databinding/tool/util/XmlEditor.java index 168a022c..f40a639f 100644 --- a/compilerCommon/src/main/java/android/databinding/tool/util/XmlEditor.java +++ b/compilerCommon/src/main/java/android/databinding/tool/util/XmlEditor.java @@ -20,13 +20,12 @@ import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.tree.TerminalNode; -import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.SystemUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.mozilla.universalchardet.UniversalDetector; import android.databinding.parser.BindingExpressionLexer; import android.databinding.parser.BindingExpressionParser; @@ -37,7 +36,6 @@ import android.databinding.parser.XMLParser.ElementContext; import java.io.File; import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; @@ -73,7 +71,7 @@ public class XmlEditor { f.getAbsolutePath()); } - ArrayList<String> lines = new ArrayList<>(); + ArrayList<String> lines = new ArrayList<String>(); lines.addAll(FileUtils.readLines(f, "utf-8")); for (android.databinding.parser.XMLParser.ElementContext it : dataNodes) { @@ -89,7 +87,7 @@ public class XmlEditor { final XMLParser.ElementContext layoutNode = layoutNodes.get(0); ArrayList<Pair<String, android.databinding.parser.XMLParser.ElementContext>> noTag = - new ArrayList<>(); + new ArrayList<Pair<String, ElementContext>>(); recurseReplace(layoutNode, lines, noTag, newTag, 0); @@ -115,13 +113,13 @@ public class XmlEditor { } if (noTagRoot != null) { ImmutablePair<String, XMLParser.ElementContext> - newRootTag = new ImmutablePair<>( + newRootTag = new ImmutablePair<String, ElementContext>( noTagRoot.getLeft() + rootAttributes.toString(), layoutNode); int index = noTag.indexOf(noTagRoot); noTag.set(index, newRootTag); } else { ImmutablePair<String, XMLParser.ElementContext> newRootTag = - new ImmutablePair<>(rootAttributes.toString(), layoutNode); + new ImmutablePair<String, ElementContext>(rootAttributes.toString(), layoutNode); noTag.add(newRootTag); } //noinspection NullableProblems @@ -131,11 +129,11 @@ public class XmlEditor { Pair<String, XMLParser.ElementContext> o2) { Position start1 = toPosition(o1.getRight().getStart()); Position start2 = toPosition(o2.getRight().getStart()); - int lineCmp = Integer.compare(start2.line, start1.line); + int lineCmp = start2.line - start1.line; if (lineCmp != 0) { return lineCmp; } - return Integer.compare(start2.charIndex, start1.charIndex); + return start2.charIndex - start1.charIndex; } }); for (Pair<String, android.databinding.parser.XMLParser.ElementContext> it : noTag) { @@ -148,12 +146,12 @@ public class XmlEditor { line.substring(endTagPosition.charIndex); lines.set(endTagPosition.line, newLine); } - return StringUtils.join(lines, System.getProperty("line.separator")); + return StringUtils.join(lines, SystemUtils.LINE_SEPARATOR); } private static <T extends XMLParser.ElementContext> List<T> filterNodesByName(String name, Iterable<T> items) { - List<T> result = new ArrayList<>(); + List<T> result = new ArrayList<T>(); for (T item : items) { if (name.equals(nodeName(item))) { result.add(item); @@ -164,7 +162,7 @@ public class XmlEditor { private static <T extends XMLParser.ElementContext> List<T> excludeNodesByName(String name, Iterable<T> items) { - List<T> result = new ArrayList<>(); + List<T> result = new ArrayList<T>(); for (T item : items) { if (!name.equals(nodeName(item))) { result.add(item); @@ -187,16 +185,16 @@ public class XmlEditor { } public static List<? extends AttributeContext> attributes(XMLParser.ElementContext elementContext) { - if (elementContext.attribute() == null) { - return new ArrayList<>(); - } else { + if (elementContext.attribute() == null) + return new ArrayList<AttributeContext>(); + else { return elementContext.attribute(); } } public static List<? extends AttributeContext> expressionAttributes ( XMLParser.ElementContext elementContext) { - List<AttributeContext> result = new ArrayList<>(); + List<AttributeContext> result = new ArrayList<AttributeContext>(); for (AttributeContext input : attributes(elementContext)) { String attrName = input.attrName.getText(); String value = input.attrValue.getText(); @@ -233,7 +231,7 @@ public class XmlEditor { if (context.content() != null && context.content().element() != null) { return context.content().element(); } - return new ArrayList<>(); + return new ArrayList<ElementContext>(); } private static boolean replace(ArrayList<String> lines, Position start, Position end, @@ -312,7 +310,7 @@ public class XmlEditor { } } if (tag.length() != 0) { - noTag.add(new ImmutablePair<>(tag, node)); + noTag.add(new ImmutablePair<String, ElementContext>(tag, node)); } } @@ -380,7 +378,7 @@ public class XmlEditor { startPosition.line++; startPosition.charIndex = index; //noinspection unchecked - return new ImmutablePair<>(startPosition, endPosition); + return new ImmutablePair<Position, Position>(startPosition, endPosition); } private static String replaceWithSpaces(String line, int start, int end) { diff --git a/databinding.properties b/databinding.properties index 25d36cf1..f4b63f47 100644 --- a/databinding.properties +++ b/databinding.properties @@ -1,10 +1,12 @@ # global settings for projects kotlinVersion = 0.13.1514 -version = 1.0-rc4-SNAPSHOT -releaseVersion = 1.0-rc4 -androidPluginVersion = 1.4.0-beta6 -javaTargetCompatibility = 1.7 -javaSourceCompatibility = 1.7 +version = 1.0-rc5 +releaseVersion = 1.0-rc5 +extensionsVersion = 1.0-rc3 +# we use a public plugin so that it does not need data binding while compiling library +androidPublicPluginVersion= 1.4.0-beta2 +javaTargetCompatibility = 1.6 +javaSourceCompatibility = 1.6 buildToolsVersion = 22.0.1 compileSdkVersionStr = 23 prebuildFolderName=prebuilds @@ -20,5 +22,6 @@ licenseDistribution=repo # mavenRepoAbsolutePath is /Volumes/ssd/src and mavenRepoName is maven-repo mavenRepoAbsolutePath=. mavenRepoName=maven-repo -extraPluginsRepoName=plugins-repo +internalPrebuiltsRepoName=internal-prebuilts extraPluginsVersion=1.1 +androidGradlePluginOutRepo=out/repo diff --git a/developmentPlugins/bintrayPlugin/build.gradle b/developmentPlugins/bintrayPlugin/build.gradle index 364a5bb2..ebc1f4be 100644 --- a/developmentPlugins/bintrayPlugin/build.gradle +++ b/developmentPlugins/bintrayPlugin/build.gradle @@ -28,7 +28,6 @@ uploadArchives { repositories { mavenDeployer { pom.artifactId = 'bintray' - repository(url: "file://${config.extraPluginsRepoDir}") } } }
\ No newline at end of file diff --git a/developmentPlugins/bintrayPlugin/src/main/groovy/android/databinding/UploadToBintrayTask.groovy b/developmentPlugins/bintrayPlugin/src/main/groovy/android/databinding/UploadToBintrayTask.groovy index 0515c4e0..0f1cc9a9 100644 --- a/developmentPlugins/bintrayPlugin/src/main/groovy/android/databinding/UploadToBintrayTask.groovy +++ b/developmentPlugins/bintrayPlugin/src/main/groovy/android/databinding/UploadToBintrayTask.groovy @@ -74,9 +74,9 @@ public class UploadToBintrayTask extends DefaultTask { } def responseText = execute.text def json = new JsonSlurper().parseText(responseText) - if (json.getAt("message") != "success" && json.getAt("message") != null) { + if (json.getAt("message") != "success") { throw new RuntimeException("Cannot upload artifact. Error response: " + - "${json.getAt("message")} ${responseText}") + "${json.getAt("message")}") } println("uploaded $localFile") } diff --git a/developmentPlugins/build.gradle b/developmentPlugins/build.gradle index a99d2151..d83764b2 100644 --- a/developmentPlugins/build.gradle +++ b/developmentPlugins/build.gradle @@ -7,7 +7,7 @@ subprojects { uploadArchives { repositories { mavenDeployer { - repository(url: "file://${config.extraPluginsRepoDir}") + repository(url: "file://${dataBindingConfig.internalPrebuiltsRepoDir}") } } } diff --git a/developmentPlugins/localizeMavenPlugin/build.gradle b/developmentPlugins/localizeMavenPlugin/build.gradle index 02d9b16f..6b4c989a 100644 --- a/developmentPlugins/localizeMavenPlugin/build.gradle +++ b/developmentPlugins/localizeMavenPlugin/build.gradle @@ -36,7 +36,6 @@ uploadArchives { repositories { mavenDeployer { pom.artifactId = 'localizemaven' - repository(url: "file://${config.extraPluginsRepoDir}") } } }
\ No newline at end of file diff --git a/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/ExportLicensesTask.groovy b/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/ExportLicensesTask.groovy index 131d13ce..cf3ef59c 100644 --- a/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/ExportLicensesTask.groovy +++ b/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/ExportLicensesTask.groovy @@ -24,8 +24,7 @@ class ExportLicensesTask extends DefaultTask { static def knownLicenses = [ [ - libraries: ["kotlin-stdlib", "kotlin-runtime", "kotlin-annotation-processing", "kotlin-gradle-plugin", "kotlin-gradle-plugin-api", - "kdoc", "kotlin-gradle-plugin-core", "kotlin-jdk-annotations", "kotlin-compiler", "kotlin-compiler-embeddable"], + libraries: ["kotlin-stdlib", "kotlin-runtime", "kotlin-annotation-processing", "kotlin-gradle-plugin", "kotlin-gradle-plugin-api"], licenses : ["https://raw.githubusercontent.com/JetBrains/kotlin/master/license/LICENSE.txt", "http://www.apache.org/licenses/LICENSE-2.0.txt"], notices : ["https://raw.githubusercontent.com/JetBrains/kotlin/master/license/NOTICE.txt"] @@ -97,12 +96,9 @@ class ExportLicensesTask extends DefaultTask { ], [ libraries: ["logkit"], - licenseText: ["unknown. see: http://commons.apache.org/proper/commons-logging/dependencies.html"] - ], - [ - libraries: ["juniversalchardet"], - licenses: ["https://mozorg.cdn.mozilla.net/media/MPL/2.0/index.815ca599c9df.txt"] - ], + licenses: ["unknown. see: http://commons.apache.org/proper/commons-logging/dependencies.html"] + ] + ] Map<String, Object> usedLicenses = new HashMap<>(); @@ -125,15 +121,12 @@ class ExportLicensesTask extends DefaultTask { @TaskAction public void exportNotice() { - project.configurations.compile.getResolvedConfiguration() - .getFirstLevelModuleDependencies().each { - if (!it.getModuleGroup().equals("com.android.tools.build")) { - it.getAllModuleArtifacts().each { add(it) } - } + project.configurations.compile.getResolvedConfiguration().getResolvedArtifacts().each { + add(it) } resolveLicenses() def notice = buildNotice(usedLicenses) - def noticeFile = new File("${project.projectDir}/src/main/resources",'NOTICE.txt') + def noticeFile = new File(project.buildDir,'NOTICE.txt') noticeFile.delete() println ("writing notice file to: ${noticeFile.getAbsolutePath()}") noticeFile << notice @@ -156,7 +149,8 @@ class ExportLicensesTask extends DefaultTask { } public static String urlToText(String url) { - return new URL(url).getText() + //return new URL(url).getText() + return url } public boolean shouldSkip(ResolvedArtifact artifact) { @@ -180,9 +174,6 @@ class ExportLicensesTask extends DefaultTask { license.licenses.each { notice.append("\n ****** LICENSE:\n${urlToText(it)}") } - license.licenseText.each { - notice.append("\n ****** LICENSE:\n${it}") - } notice.append("\n\n\n") } return notice.toString() diff --git a/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/LocalizeDependenciesTask.groovy b/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/LocalizeDependenciesTask.groovy index 816dc35d..a9e8d058 100644 --- a/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/LocalizeDependenciesTask.groovy +++ b/developmentPlugins/localizeMavenPlugin/src/main/groovy/android/databinding/LocalizeDependenciesTask.groovy @@ -44,12 +44,6 @@ class LocalizeDependenciesTask extends DefaultTask { private Set<String> ids = new HashSet<>(); - // force download these if they are seen as a dependency - private Set<String> wildCard = new HashSet<>(); - { - wildCard.add("kotlin-gradle-plugin-core") - } - private Set<String> fetchTestDependencies = new HashSet<>(); List<Artifact> artifactsToResolve = new LinkedList<>(); @@ -211,10 +205,10 @@ class LocalizeDependenciesTask extends DefaultTask { continue } if ("test".equals(dependency.scope)) { - if (wildCard.contains(dependency.artifact.getArtifactId()) || fetchTestDependencies.contains(key)) { + if (fetchTestDependencies.contains(key)) { println("${dependency} is test scope but including because $key is in direct dependencies") } else { - println("skipping $dependency because test and $key is not first level dependency. artifact id: ${dependency.artifact.getArtifactId()}") + println("skipping $dependency because test and not first level dependency") continue } } diff --git a/extensions/baseAdapters/build.gradle b/extensions/baseAdapters/build.gradle index 56ea871b..4dfb2e1b 100644 --- a/extensions/baseAdapters/build.gradle +++ b/extensions/baseAdapters/build.gradle @@ -13,15 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +buildscript { + dependencies { + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} apply plugin: 'com.android.library' -project.ext.addDataBindingAdapters = false -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion - + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion + dataBinding { + enabled = true + addDefaultAdapters = false + } defaultConfig { minSdkVersion 7 targetSdkVersion 21 @@ -43,6 +50,7 @@ android { } dependencies { + project(':library') provided 'com.android.support:support-v4:+' provided 'com.android.support:cardview-v7:+' provided 'com.android.support:appcompat-v7:+' @@ -81,14 +89,14 @@ android.libraryVariants.all { variant -> uploadArchives { repositories { mavenDeployer { - repository(url: "file://${config.inReleaseBuild ? config.sharedSupportRepoDir : config.mavenRepoDir}") + repository(url: "file://${(!dataBindingConfig.forGradlePlugin && dataBindingConfig.inReleaseBuild) ? dataBindingConfig.sharedSupportRepoDir : dataBindingConfig.mavenRepoDir}") pom.artifactId = "adapters" pom.project { licenses { license { - name config.licenseName - url config.licenseUrl - distribution config.licenseDistribution + name dataBindingConfig.licenseName + url dataBindingConfig.licenseUrl + distribution dataBindingConfig.licenseDistribution } } } @@ -100,7 +108,7 @@ uploadArchives { task prebuild(type : Copy) { dependsOn uploadArchives from "$buildDir/outputs/aar/baseAdapters-release.aar" - into config.prebuildFolder + into dataBindingConfig.prebuildFolder rename { String fileName -> "databinding-adapters.aar" } diff --git a/extensions/baseAdapters/src/main/java/android/databinding/adapters/ListenerUtil.java b/extensions/baseAdapters/src/main/java/android/databinding/adapters/ListenerUtil.java index 9643be2c..67ae1727 100644 --- a/extensions/baseAdapters/src/main/java/android/databinding/adapters/ListenerUtil.java +++ b/extensions/baseAdapters/src/main/java/android/databinding/adapters/ListenerUtil.java @@ -25,7 +25,7 @@ import java.util.WeakHashMap; public class ListenerUtil { private static SparseArray<WeakHashMap<View, WeakReference<?>>> sListeners = - new SparseArray<>(); + new SparseArray<WeakHashMap<View, WeakReference<?>>>(); /** * This method tracks listeners for a View. Only one listener per listenerResourceId @@ -61,7 +61,7 @@ public class ListenerUtil { synchronized (sListeners) { WeakHashMap<View, WeakReference<?>> listeners = sListeners.get(listenerResourceId); if (listeners == null) { - listeners = new WeakHashMap<>(); + listeners = new WeakHashMap<View, WeakReference<?>>(); sListeners.put(listenerResourceId, listeners); } final WeakReference<T> oldValue; diff --git a/extensions/build.gradle b/extensions/build.gradle index 51aad326..b67cd3c6 100644 --- a/extensions/build.gradle +++ b/extensions/build.gradle @@ -13,20 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -ext.rootFolder = new File(project.projectDir, "..") +ext.dataBindingRootFolder = new File(project.projectDir, "..") buildscript { - ext.rootFolder = new File(project.projectDir, "..") + ext.dataBindingRootFolder = new File(project.projectDir, "..") apply from: "${project.projectDir}/../propLoader.gradle" ext.addRepos(repositories) - dependencies { - classpath "com.android.databinding:dataBinder:${config.version}" - } } subprojects { apply plugin: 'maven' - group = config.group - version = config.version + group = dataBindingConfig.group + version = dataBindingConfig.extensionsVersion + uploadArchives { + repositories { + mavenDeployer { + repository(url: "file://${dataBindingConfig.internalPrebuiltsRepoDir}") + } + } + } } task preparePrebuilds() { diff --git a/library/build.gradle b/extensions/library/build.gradle index 43d214f0..0b5afe4e 100644 --- a/library/build.gradle +++ b/extensions/library/build.gradle @@ -14,11 +14,11 @@ * limitations under the License. */ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +// Top-level build file where you can add dataBindingConfiguration options common to all sub-projects/modules. buildscript { dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPublicPluginVersion}" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -27,8 +27,8 @@ buildscript { apply plugin: 'com.android.library' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { minSdkVersion 7 @@ -37,8 +37,8 @@ android { versionName "1.0" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_6 + targetCompatibility JavaVersion.VERSION_1_6 } buildTypes { release { @@ -60,7 +60,7 @@ configurations { dependencies { compile 'com.android.support:support-v4:21.0.3' - compile project(':baseLibrary') + compile "com.android.databinding:baseLibrary:${dataBindingConfig.version}" } //create jar tasks @@ -73,7 +73,6 @@ android.libraryVariants.all { variant -> def suffix = name.capitalize() def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) { - source variant.javaCompile.source + project(":baseLibrary").tasks['compileJava'].source classpath = files(variant.javaCompile.classpath.files) + files( "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") } @@ -86,7 +85,6 @@ android.libraryVariants.all { variant -> def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { classifier = 'sources' - from android.sourceSets.main.java.srcDirs + project(":baseLibrary").sourceSets.main.java.srcDirs } artifacts.add('archives', javadocJarTask); @@ -99,9 +97,9 @@ uploadArchives { pom.project { licenses { license { - name config.licenseName - url config.licenseUrl - distribution config.licenseDistribution + name dataBindingConfig.licenseName + url dataBindingConfig.licenseUrl + distribution dataBindingConfig.licenseDistribution } } } @@ -111,17 +109,23 @@ uploadArchives { afterEvaluate { - tasks['packageReleaseClassesJar'].exclude('android/databinding/DataBinderMapper.*') - tasks['packageReleaseClassesJar'].exclude('android/databinding/DataBindingComponent.*') - tasks['packageDebugClassesJar'].exclude('android/databinding/DataBinderMapper.*') - tasks['packageDebugClassesJar'].exclude('android/databinding/DataBindingComponent.*') + ["", "Classes"].each { + def task = tasks.findByName("packageRelease${it}Jar") + if (task != null) { + task.exclude('android/databinding/DataBinderMapper.*') + tasks["packageRelease${it}Jar"].exclude('android/databinding/DataBindingComponent.*') + tasks["packageDebug${it}Jar"].exclude('android/databinding/DataBinderMapper.*') + tasks["packageDebug${it}Jar"].exclude('android/databinding/DataBindingComponent.*') + } + + } } task prebuildAar(type : Copy) { dependsOn uploadArchives from "$buildDir/outputs/aar/library-release.aar" - into config.prebuildFolder + into dataBindingConfig.prebuildFolder rename { String fileName -> "databinding-library.aar" } -}
\ No newline at end of file +} diff --git a/library/src/androidTest/java/android/databinding/ObservableParcelTest.java b/extensions/library/src/androidTest/java/android/databinding/ObservableParcelTest.java index 8982598f..8982598f 100644 --- a/library/src/androidTest/java/android/databinding/ObservableParcelTest.java +++ b/extensions/library/src/androidTest/java/android/databinding/ObservableParcelTest.java diff --git a/library/src/doc/java/com/android/databinding/library/R.java b/extensions/library/src/doc/java/com/android/databinding/library/R.java index 668a20cd..668a20cd 100644 --- a/library/src/doc/java/com/android/databinding/library/R.java +++ b/extensions/library/src/doc/java/com/android/databinding/library/R.java diff --git a/library/src/main/AndroidManifest.xml b/extensions/library/src/main/AndroidManifest.xml index 8596caf8..8596caf8 100644 --- a/library/src/main/AndroidManifest.xml +++ b/extensions/library/src/main/AndroidManifest.xml diff --git a/library/src/main/java/android/databinding/BaseObservable.java b/extensions/library/src/main/java/android/databinding/BaseObservable.java index f3be2c64..f3be2c64 100644 --- a/library/src/main/java/android/databinding/BaseObservable.java +++ b/extensions/library/src/main/java/android/databinding/BaseObservable.java diff --git a/library/src/main/java/android/databinding/DataBinderMapper.java b/extensions/library/src/main/java/android/databinding/DataBinderMapper.java index 683615af..683615af 100644 --- a/library/src/main/java/android/databinding/DataBinderMapper.java +++ b/extensions/library/src/main/java/android/databinding/DataBinderMapper.java diff --git a/library/src/main/java/android/databinding/DataBindingComponent.java b/extensions/library/src/main/java/android/databinding/DataBindingComponent.java index a8fb2feb..a8fb2feb 100644 --- a/library/src/main/java/android/databinding/DataBindingComponent.java +++ b/extensions/library/src/main/java/android/databinding/DataBindingComponent.java diff --git a/library/src/main/java/android/databinding/DataBindingUtil.java b/extensions/library/src/main/java/android/databinding/DataBindingUtil.java index 55a6b4e6..55a6b4e6 100644 --- a/library/src/main/java/android/databinding/DataBindingUtil.java +++ b/extensions/library/src/main/java/android/databinding/DataBindingUtil.java diff --git a/library/src/main/java/android/databinding/ListChangeRegistry.java b/extensions/library/src/main/java/android/databinding/ListChangeRegistry.java index e13f867c..3b88fe5f 100644 --- a/library/src/main/java/android/databinding/ListChangeRegistry.java +++ b/extensions/library/src/main/java/android/databinding/ListChangeRegistry.java @@ -25,7 +25,7 @@ public class ListChangeRegistry CallbackRegistry<ObservableList.OnListChangedCallback, ObservableList, ListChangeRegistry.ListChanges> { private static final Pools.SynchronizedPool<ListChanges> sListChanges = - new Pools.SynchronizedPool<>(10); + new Pools.SynchronizedPool<ListChanges>(10); private static final int ALL = 0; private static final int CHANGED = 1; diff --git a/library/src/main/java/android/databinding/MapChangeRegistry.java b/extensions/library/src/main/java/android/databinding/MapChangeRegistry.java index 9c453b6b..9c453b6b 100644 --- a/library/src/main/java/android/databinding/MapChangeRegistry.java +++ b/extensions/library/src/main/java/android/databinding/MapChangeRegistry.java diff --git a/library/src/main/java/android/databinding/ObservableArrayList.java b/extensions/library/src/main/java/android/databinding/ObservableArrayList.java index 864e09ec..864e09ec 100644 --- a/library/src/main/java/android/databinding/ObservableArrayList.java +++ b/extensions/library/src/main/java/android/databinding/ObservableArrayList.java diff --git a/library/src/main/java/android/databinding/ObservableArrayMap.java b/extensions/library/src/main/java/android/databinding/ObservableArrayMap.java index 50c60a27..50c60a27 100644 --- a/library/src/main/java/android/databinding/ObservableArrayMap.java +++ b/extensions/library/src/main/java/android/databinding/ObservableArrayMap.java diff --git a/library/src/main/java/android/databinding/ObservableBoolean.java b/extensions/library/src/main/java/android/databinding/ObservableBoolean.java index 73c65aad..73c65aad 100644 --- a/library/src/main/java/android/databinding/ObservableBoolean.java +++ b/extensions/library/src/main/java/android/databinding/ObservableBoolean.java diff --git a/library/src/main/java/android/databinding/ObservableByte.java b/extensions/library/src/main/java/android/databinding/ObservableByte.java index bba7ec12..bba7ec12 100644 --- a/library/src/main/java/android/databinding/ObservableByte.java +++ b/extensions/library/src/main/java/android/databinding/ObservableByte.java diff --git a/library/src/main/java/android/databinding/ObservableChar.java b/extensions/library/src/main/java/android/databinding/ObservableChar.java index 883cb908..883cb908 100644 --- a/library/src/main/java/android/databinding/ObservableChar.java +++ b/extensions/library/src/main/java/android/databinding/ObservableChar.java diff --git a/library/src/main/java/android/databinding/ObservableDouble.java b/extensions/library/src/main/java/android/databinding/ObservableDouble.java index 78f6a48d..78f6a48d 100644 --- a/library/src/main/java/android/databinding/ObservableDouble.java +++ b/extensions/library/src/main/java/android/databinding/ObservableDouble.java diff --git a/library/src/main/java/android/databinding/ObservableField.java b/extensions/library/src/main/java/android/databinding/ObservableField.java index 6de798b4..6de798b4 100644 --- a/library/src/main/java/android/databinding/ObservableField.java +++ b/extensions/library/src/main/java/android/databinding/ObservableField.java diff --git a/library/src/main/java/android/databinding/ObservableFloat.java b/extensions/library/src/main/java/android/databinding/ObservableFloat.java index 0eb89690..0eb89690 100644 --- a/library/src/main/java/android/databinding/ObservableFloat.java +++ b/extensions/library/src/main/java/android/databinding/ObservableFloat.java diff --git a/library/src/main/java/android/databinding/ObservableInt.java b/extensions/library/src/main/java/android/databinding/ObservableInt.java index cb25c563..cb25c563 100644 --- a/library/src/main/java/android/databinding/ObservableInt.java +++ b/extensions/library/src/main/java/android/databinding/ObservableInt.java diff --git a/library/src/main/java/android/databinding/ObservableLong.java b/extensions/library/src/main/java/android/databinding/ObservableLong.java index 954e3264..954e3264 100644 --- a/library/src/main/java/android/databinding/ObservableLong.java +++ b/extensions/library/src/main/java/android/databinding/ObservableLong.java diff --git a/library/src/main/java/android/databinding/ObservableParcelable.java b/extensions/library/src/main/java/android/databinding/ObservableParcelable.java index 96eec274..96eec274 100644 --- a/library/src/main/java/android/databinding/ObservableParcelable.java +++ b/extensions/library/src/main/java/android/databinding/ObservableParcelable.java diff --git a/library/src/main/java/android/databinding/ObservableShort.java b/extensions/library/src/main/java/android/databinding/ObservableShort.java index 57e428da..57e428da 100644 --- a/library/src/main/java/android/databinding/ObservableShort.java +++ b/extensions/library/src/main/java/android/databinding/ObservableShort.java diff --git a/library/src/main/java/android/databinding/OnRebindCallback.java b/extensions/library/src/main/java/android/databinding/OnRebindCallback.java index 51f3eb1e..51f3eb1e 100644 --- a/library/src/main/java/android/databinding/OnRebindCallback.java +++ b/extensions/library/src/main/java/android/databinding/OnRebindCallback.java diff --git a/library/src/main/java/android/databinding/PropertyChangeRegistry.java b/extensions/library/src/main/java/android/databinding/PropertyChangeRegistry.java index 5e1858c3..5e1858c3 100644 --- a/library/src/main/java/android/databinding/PropertyChangeRegistry.java +++ b/extensions/library/src/main/java/android/databinding/PropertyChangeRegistry.java diff --git a/library/src/main/java/android/databinding/ViewDataBinding.java b/extensions/library/src/main/java/android/databinding/ViewDataBinding.java index 2dacd1e9..2dacd1e9 100644 --- a/library/src/main/java/android/databinding/ViewDataBinding.java +++ b/extensions/library/src/main/java/android/databinding/ViewDataBinding.java diff --git a/library/src/main/java/android/databinding/ViewStubProxy.java b/extensions/library/src/main/java/android/databinding/ViewStubProxy.java index 69799287..69799287 100644 --- a/library/src/main/java/android/databinding/ViewStubProxy.java +++ b/extensions/library/src/main/java/android/databinding/ViewStubProxy.java diff --git a/library/src/main/res/values/ids.xml b/extensions/library/src/main/res/values/ids.xml index a7b89d3e..a7b89d3e 100644 --- a/library/src/main/res/values/ids.xml +++ b/extensions/library/src/main/res/values/ids.xml diff --git a/extensions/settings.gradle b/extensions/settings.gradle index 80ebcc8c..da0d959a 100644 --- a/extensions/settings.gradle +++ b/extensions/settings.gradle @@ -17,4 +17,5 @@ /** * These are projects that requires a compiled version of data binding. */ +include ':library' include ':baseAdapters' diff --git a/gradlePlugin/build.gradle b/gradlePlugin/build.gradle deleted file mode 100644 index 5469597e..00000000 --- a/gradlePlugin/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * 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: 'java' -apply plugin: 'com.android.databinding.bintray' -sourceCompatibility = config.javaTargetCompatibility -targetCompatibility = config.javaSourceCompatibility - - -tasks.create(name : 'copyBuildVersion') << { - def props = new Properties(); - def buildVersionFile = new File(sourceSets.main.output.resourcesDir,"data_binding_build_info.properties") - buildVersionFile.delete() - println "writing build version file" - props.put("myVersion", project.version) - // in case of emergency, uncomment and modify but never commit! - // props.put("library", "1.0-rc3") - // props.put("adapters", "1.0-rc3") - - def outStream = new FileOutputStream(buildVersionFile) - try { - props.store(outStream, "") - } finally { - outStream.close() - } -} - -tasks['uploadArchives'].dependsOn('copyBuildVersion') -tasks['copyBuildVersion'].dependsOn('processResources') - -dependencies { - compile "com.android.tools.build:gradle:${config.androidPluginVersion}" - compile gradleApi() - compile project(":baseLibrary") - compile project(":compilerCommon") - compile 'org.apache.commons:commons-lang3:3.3.2' - compile 'commons-io:commons-io:2.4' -} - -compileJava { - options.compilerArgs = ["-proc:none"] -} - -uploadArchives { - repositories { - mavenDeployer { - pom.artifactId = 'dataBinder' - pom.project { - licenses { - license { - name config.licenseName - url config.licenseUrl - distribution config.licenseDistribution - } - } - } - } - } -} - -fullJar(project) diff --git a/gradlePlugin/gradle/wrapper/gradle-wrapper.jar b/gradlePlugin/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 3d0dee6e..00000000 --- a/gradlePlugin/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/gradlePlugin/gradle/wrapper/gradle-wrapper.properties b/gradlePlugin/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 8b80a060..00000000 --- a/gradlePlugin/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Dec 11 16:01:54 PST 2014 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip diff --git a/gradlePlugin/gradlew b/gradlePlugin/gradlew deleted file mode 100755 index 91a7e269..00000000 --- a/gradlePlugin/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((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" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlePlugin/gradlew.bat b/gradlePlugin/gradlew.bat deleted file mode 100644 index aec99730..00000000 --- a/gradlePlugin/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@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=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/gradlePlugin/src/main/java/android/databinding/tool/DataBinderPlugin.java b/gradlePlugin/src/main/java/android/databinding/tool/DataBinderPlugin.java deleted file mode 100644 index 238e360b..00000000 --- a/gradlePlugin/src/main/java/android/databinding/tool/DataBinderPlugin.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ -package android.databinding.tool; - -import com.google.common.base.Preconditions; - -import com.android.build.gradle.AppExtension; -import com.android.build.gradle.BaseExtension; -import com.android.build.gradle.LibraryExtension; -import com.android.build.gradle.api.ApplicationVariant; -import com.android.build.gradle.api.LibraryVariant; -import com.android.build.gradle.api.TestVariant; -import com.android.build.gradle.internal.api.ApplicationVariantImpl; -import com.android.build.gradle.internal.api.LibraryVariantImpl; -import com.android.build.gradle.internal.api.TestVariantImpl; -import com.android.build.gradle.internal.core.GradleVariantConfiguration; -import com.android.build.gradle.internal.variant.ApplicationVariantData; -import com.android.build.gradle.internal.variant.BaseVariantData; -import com.android.build.gradle.internal.variant.LibraryVariantData; -import com.android.build.gradle.internal.variant.TestVariantData; -import com.android.build.gradle.tasks.ProcessAndroidResources; -import com.android.builder.model.ApiVersion; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.gradle.api.Action; -import org.gradle.api.Plugin; -import org.gradle.api.Project; -import org.gradle.api.Task; -import org.gradle.api.logging.LogLevel; -import org.gradle.api.logging.Logger; -import org.gradle.api.plugins.ExtraPropertiesExtension; -import org.gradle.api.tasks.bundling.Jar; -import org.gradle.api.tasks.compile.AbstractCompile; - -import android.databinding.tool.processing.ScopedException; -import android.databinding.tool.util.L; -import android.databinding.tool.writer.JavaFileWriter; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import javax.tools.Diagnostic; -import javax.xml.bind.JAXBException; - -public class DataBinderPlugin implements Plugin<Project> { - - private static final String INVOKED_FROM_IDE_PROPERTY = "android.injected.invoked.from.ide"; - private static final String PRINT_ENCODED_ERRORS_PROPERTY - = "android.databinding.injected.print.encoded.errors"; - private Logger logger; - private boolean printEncodedErrors = false; - - class GradleFileWriter extends JavaFileWriter { - - private final String outputBase; - - public GradleFileWriter(String outputBase) { - this.outputBase = outputBase; - } - - @Override - public void writeToFile(String canonicalName, String contents) { - String asPath = canonicalName.replace('.', '/'); - File f = new File(outputBase + "/" + asPath + ".java"); - logD("Asked to write to " + canonicalName + ". outputting to:" + - f.getAbsolutePath()); - //noinspection ResultOfMethodCallIgnored - f.getParentFile().mkdirs(); - FileOutputStream fos = null; - try { - fos = new FileOutputStream(f); - IOUtils.write(contents, fos); - } catch (IOException e) { - logE(e, "cannot write file " + f.getAbsolutePath()); - } finally { - IOUtils.closeQuietly(fos); - } - } - } - - private boolean safeGetBooleanProperty(Project project, String property) { - boolean hasProperty = project.hasProperty(property); - if (!hasProperty) { - return false; - } - try { - if (Boolean.parseBoolean(String.valueOf(project.getProperties().get(property)))) { - return true; - } - } catch (Throwable t) { - L.w("unable to read property %s", project); - } - return false; - } - - private boolean resolvePrintEncodedErrors(Project project) { - return safeGetBooleanProperty(project, INVOKED_FROM_IDE_PROPERTY) || - safeGetBooleanProperty(project, PRINT_ENCODED_ERRORS_PROPERTY); - } - - @Override - public void apply(Project project) { - if (project == null) { - return; - } - setupLogger(project); - - Versions versions = readMyVersion(); - logD("data binding plugin versions are: %s", versions); - printEncodedErrors = resolvePrintEncodedErrors(project); - ScopedException.encodeOutput(printEncodedErrors); - project.getDependencies() - .add("compile", "com.android.databinding:library:" + versions.getLibraryVersion()); - boolean addAdapters = true; - if (project.hasProperty("ext")) { - Object ext = project.getProperties().get("ext"); - if (ext instanceof ExtraPropertiesExtension) { - ExtraPropertiesExtension propExt = (ExtraPropertiesExtension) ext; - if (propExt.has("addDataBindingAdapters")) { - addAdapters = Boolean.valueOf( - String.valueOf(propExt.get("addDataBindingAdapters"))); - } - } - } - if (addAdapters) { - project.getDependencies().add("compile", - "com.android.databinding:adapters:" + versions.getAdaptersVersion()); - } - project.getDependencies().add("provided", - "com.android.databinding:compiler:" + versions.getCompilerVersion()); - project.afterEvaluate(new Action<Project>() { - @Override - public void execute(Project project) { - try { - createXmlProcessor(project); - } catch (Throwable t) { - logE(t, "failed to setup data binding"); - } - } - }); - } - - private void setupLogger(Project project) { - logger = project.getLogger(); - L.setClient(new L.Client() { - @Override - public void printMessage(Diagnostic.Kind kind, String message) { - if (kind == Diagnostic.Kind.ERROR) { - logE(null, message); - } else { - logD(message); - } - } - }); - } - - Versions readMyVersion() { - try { - Properties props = new Properties(); - InputStream stream = getClass().getResourceAsStream("/data_binding_build_info.properties"); - try { - props.load(stream); - return new Versions(props); - } finally { - IOUtils.closeQuietly(stream); - } - } catch (IOException exception) { - logE(exception, "Cannot read data binding version"); - } - return null; - } - - private void createXmlProcessor(Project project) - throws NoSuchFieldException, IllegalAccessException { - L.d("creating xml processor for " + project); - Object androidExt = project.getExtensions().getByName("android"); - if (!(androidExt instanceof BaseExtension)) { - return; - } - if (androidExt instanceof AppExtension) { - createXmlProcessorForApp(project, (AppExtension) androidExt); - } else if (androidExt instanceof LibraryExtension) { - createXmlProcessorForLibrary(project, (LibraryExtension) androidExt); - } else { - logE(new UnsupportedOperationException("cannot understand android ext"), - "unsupported android extension. What is it? %s", androidExt); - } - } - - private void createXmlProcessorForLibrary(Project project, LibraryExtension lib) - throws NoSuchFieldException, IllegalAccessException { - File sdkDir = lib.getSdkDirectory(); - L.d("create xml processor for " + lib); - for (TestVariant variant : lib.getTestVariants()) { - logD("test variant %s. dir name %s", variant, variant.getDirName()); - BaseVariantData variantData = getVariantData(variant); - attachXmlProcessor(project, variantData, sdkDir, false);//tests extend apk variant - } - for (LibraryVariant variant : lib.getLibraryVariants()) { - logD("library variant %s. dir name %s", variant, variant.getDirName()); - BaseVariantData variantData = getVariantData(variant); - attachXmlProcessor(project, variantData, sdkDir, true); - } - } - - private void createXmlProcessorForApp(Project project, AppExtension appExt) - throws NoSuchFieldException, IllegalAccessException { - L.d("create xml processor for " + appExt); - File sdkDir = appExt.getSdkDirectory(); - for (TestVariant testVariant : appExt.getTestVariants()) { - TestVariantData variantData = getVariantData(testVariant); - attachXmlProcessor(project, variantData, sdkDir, false); - } - for (ApplicationVariant appVariant : appExt.getApplicationVariants()) { - ApplicationVariantData variantData = getVariantData(appVariant); - attachXmlProcessor(project, variantData, sdkDir, false); - } - } - - private LibraryVariantData getVariantData(LibraryVariant variant) - throws NoSuchFieldException, IllegalAccessException { - Field field = LibraryVariantImpl.class.getDeclaredField("variantData"); - field.setAccessible(true); - return (LibraryVariantData) field.get(variant); - } - - private TestVariantData getVariantData(TestVariant variant) - throws IllegalAccessException, NoSuchFieldException { - Field field = TestVariantImpl.class.getDeclaredField("variantData"); - field.setAccessible(true); - return (TestVariantData) field.get(variant); - } - - private ApplicationVariantData getVariantData(ApplicationVariant variant) - throws IllegalAccessException, NoSuchFieldException { - Field field = ApplicationVariantImpl.class.getDeclaredField("variantData"); - field.setAccessible(true); - return (ApplicationVariantData) field.get(variant); - } - - private void attachXmlProcessor(Project project, final BaseVariantData variantData, - final File sdkDir, - final Boolean isLibrary) { - final GradleVariantConfiguration configuration = variantData.getVariantConfiguration(); - final ApiVersion minSdkVersion = configuration.getMinSdkVersion(); - ProcessAndroidResources generateRTask = variantData.generateRClassTask; - final String packageName = generateRTask.getPackageForR(); - String fullName = configuration.getFullName(); - List<File> resourceFolders = Arrays.asList(variantData.mergeResourcesTask.getOutputDir()); - - final File codeGenTargetFolder = new File(project.getBuildDir() + "/data-binding-info/" + - configuration.getDirName()); - String writerOutBase = codeGenTargetFolder.getAbsolutePath(); - JavaFileWriter fileWriter = new GradleFileWriter(writerOutBase); - final LayoutXmlProcessor xmlProcessor = new LayoutXmlProcessor(packageName, resourceFolders, - fileWriter, minSdkVersion.getApiLevel(), isLibrary); - final ProcessAndroidResources processResTask = generateRTask; - final File xmlOutDir = new File(project.getBuildDir() + "/layout-info/" + - configuration.getDirName()); - final File generatedClassListOut = isLibrary ? new File(xmlOutDir, "_generated.txt") : null; - logD("xml output for %s is %s", variantData, xmlOutDir); - String layoutTaskName = "dataBindingLayouts" + StringUtils - .capitalize(processResTask.getName()); - String infoClassTaskName = "dataBindingInfoClass" + StringUtils - .capitalize(processResTask.getName()); - - final DataBindingProcessLayoutsTask[] processLayoutsTasks - = new DataBindingProcessLayoutsTask[1]; - project.getTasks().create(layoutTaskName, - DataBindingProcessLayoutsTask.class, - new Action<DataBindingProcessLayoutsTask>() { - @Override - public void execute(final DataBindingProcessLayoutsTask task) { - processLayoutsTasks[0] = task; - task.setXmlProcessor(xmlProcessor); - task.setSdkDir(sdkDir); - task.setXmlOutFolder(xmlOutDir); - task.setMinSdk(minSdkVersion.getApiLevel()); - task.setBlameLogDir(variantData.getScope().getResourceBlameLogDir()); - - logD("TASK adding dependency on %s for %s", task, processResTask); - processResTask.dependsOn(task); - processResTask.getInputs().dir(xmlOutDir); - for (Object dep : processResTask.getDependsOn()) { - if (dep == task) { - continue; - } - logD("adding dependency on %s for %s", dep, task); - task.dependsOn(dep); - } - processResTask.doLast(new Action<Task>() { - @Override - public void execute(Task unused) { - try { - task.writeLayoutXmls(); - } catch (JAXBException e) { - // gradle sometimes fails to resolve JAXBException. - // We get stack trace manually to ensure we have the log - logE(e, "cannot write layout xmls %s", - ExceptionUtils.getStackTrace(e)); - } - } - }); - } - }); - final DataBindingProcessLayoutsTask processLayoutsTask = processLayoutsTasks[0]; - project.getTasks().create(infoClassTaskName, - DataBindingExportInfoTask.class, - new Action<DataBindingExportInfoTask>() { - - @Override - public void execute(DataBindingExportInfoTask task) { - task.dependsOn(processLayoutsTask); - task.dependsOn(processResTask); - task.setXmlProcessor(xmlProcessor); - task.setSdkDir(sdkDir); - task.setXmlOutFolder(xmlOutDir); - task.setExportClassListTo(generatedClassListOut); - task.setPrintEncodedErrors(printEncodedErrors); - task.setEnableDebugLogs(logger.isEnabled(LogLevel.DEBUG)); - - variantData.registerJavaGeneratingTask(task, codeGenTargetFolder); - } - }); - String packageJarTaskName = "package" + StringUtils.capitalize(fullName) + "ClassesJar"; - final Task packageTask = project.getTasks().findByName(packageJarTaskName); - if (packageTask instanceof Jar) { - String removeGeneratedTaskName = "dataBindingExcludeGeneratedFrom" + - StringUtils.capitalize(packageTask.getName()); - if (project.getTasks().findByName(removeGeneratedTaskName) == null) { - final AbstractCompile javaCompileTask = variantData.javacTask; - Preconditions.checkNotNull(javaCompileTask); - - project.getTasks().create(removeGeneratedTaskName, - DataBindingExcludeGeneratedTask.class, - new Action<DataBindingExcludeGeneratedTask>() { - @Override - public void execute(DataBindingExcludeGeneratedTask task) { - packageTask.dependsOn(task); - task.dependsOn(javaCompileTask); - task.setAppPackage(packageName); - task.setInfoClassQualifiedName(xmlProcessor.getInfoClassFullName()); - task.setPackageTask((Jar) packageTask); - task.setLibrary(isLibrary); - task.setGeneratedClassListFile(generatedClassListOut); - } - }); - } - } - } - - private void logD(String s, Object... args) { - logger.info(formatLog(s, args)); - } - - private void logE(Throwable t, String s, Object... args) { - logger.error(formatLog(s, args), t); - } - - private String formatLog(String s, Object... args) { - return "[data binding plugin]: " + String.format(s, args); - } - - private class Versions { - - Properties properties; - String myVersion; - - public Versions(Properties properties) { - this.properties = properties; - myVersion = properties.getProperty("myVersion"); - if (myVersion == null) { - throw new IllegalStateException("cannot read data binding plugin version"); - } - } - - public String getCompilerVersion() { - return properties.getProperty("compiler", myVersion); - } - - public String getAdaptersVersion() { - return properties.getProperty("adapters", myVersion); - } - - public String getLibraryVersion() { - return properties.getProperty("library", myVersion); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("[Data Binding Versions:"); - sb.append(" plugin:").append(myVersion); - sb.append(" compiler:").append(getCompilerVersion()); - sb.append(" adapters:").append(getAdaptersVersion()); - sb.append(" library:").append(getLibraryVersion()); - return sb.append("]").toString(); - } - } -} diff --git a/gradlePlugin/src/main/java/android/databinding/tool/DataBindingExportInfoTask.java b/gradlePlugin/src/main/java/android/databinding/tool/DataBindingExportInfoTask.java deleted file mode 100644 index 768fe68a..00000000 --- a/gradlePlugin/src/main/java/android/databinding/tool/DataBindingExportInfoTask.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ -package android.databinding.tool; - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; - -import android.databinding.tool.processing.Scope; - -import java.io.File; - -/** - * Task to pass environment info to javac - */ -public class DataBindingExportInfoTask extends DefaultTask { - private LayoutXmlProcessor xmlProcessor; - private File sdkDir; - private File xmlOutFolder; - private File exportClassListTo; - private boolean printEncodedErrors; - private boolean enableDebugLogs = false; - @TaskAction - public void exportInfo() { - xmlProcessor.writeInfoClass(sdkDir, xmlOutFolder, exportClassListTo, enableDebugLogs, - printEncodedErrors); - Scope.assertNoError(); - } - - public LayoutXmlProcessor getXmlProcessor() { - return xmlProcessor; - } - - public void setXmlProcessor(LayoutXmlProcessor xmlProcessor) { - this.xmlProcessor = xmlProcessor; - } - - public File getSdkDir() { - return sdkDir; - } - - public void setSdkDir(File sdkDir) { - this.sdkDir = sdkDir; - } - - public File getXmlOutFolder() { - return xmlOutFolder; - } - - public void setXmlOutFolder(File xmlOutFolder) { - this.xmlOutFolder = xmlOutFolder; - } - - public File getExportClassListTo() { - return exportClassListTo; - } - - public void setExportClassListTo(File exportClassListTo) { - this.exportClassListTo = exportClassListTo; - } - - public boolean isPrintEncodedErrors() { - return printEncodedErrors; - } - - public void setPrintEncodedErrors(boolean printEncodedErrors) { - this.printEncodedErrors = printEncodedErrors; - } - - public boolean isEnableDebugLogs() { - return enableDebugLogs; - } - - public void setEnableDebugLogs(boolean enableDebugLogs) { - this.enableDebugLogs = enableDebugLogs; - } -}
\ No newline at end of file diff --git a/gradlePlugin/src/main/java/android/databinding/tool/DataBindingProcessLayoutsTask.java b/gradlePlugin/src/main/java/android/databinding/tool/DataBindingProcessLayoutsTask.java deleted file mode 100644 index 1e6906bc..00000000 --- a/gradlePlugin/src/main/java/android/databinding/tool/DataBindingProcessLayoutsTask.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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. - */ -package android.databinding.tool; - -import com.android.ide.common.blame.MergingLog; -import com.android.ide.common.blame.SourceFile; - -import android.databinding.tool.processing.Scope; -import android.databinding.tool.util.L; - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; -import org.xml.sax.SAXException; -import java.io.File; -import java.io.IOException; - -import javax.xml.bind.JAXBException; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -/** - * Task that parses xml files and generated metadata. - * Will be removed when aapt supports binding tags. - */ -public class DataBindingProcessLayoutsTask extends DefaultTask { - - private LayoutXmlProcessor xmlProcessor; - - private File sdkDir; - - private File xmlOutFolder; - - private int minSdk; - private File mBlameLogDir; - - @TaskAction - public void processResources() - throws ParserConfigurationException, SAXException, XPathExpressionException, - IOException { - L.d("running process layouts task %s", getName()); - if (mBlameLogDir != null) { - final MergingLog mergingLog = new MergingLog(mBlameLogDir); - xmlProcessor.setOriginalFileLookup(new LayoutXmlProcessor.OriginalFileLookup() { - @Override - public File getOriginalFileFor(File file) { - SourceFile input = new SourceFile(file); - SourceFile original = mergingLog.find(input); - // merged log api returns the file back if original cannot be found. - // it is not what we want so we alter the response. - return original == input ? null : original.getSourceFile(); - } - }); - } - xmlProcessor.processResources(minSdk); - Scope.assertNoError(); - } - - public void writeLayoutXmls() throws JAXBException { - xmlProcessor.writeLayoutInfoFiles(xmlOutFolder); - } - - public LayoutXmlProcessor getXmlProcessor() { - return xmlProcessor; - } - - public void setXmlProcessor(LayoutXmlProcessor xmlProcessor) { - this.xmlProcessor = xmlProcessor; - } - - public File getSdkDir() { - return sdkDir; - } - - public void setSdkDir(File sdkDir) { - this.sdkDir = sdkDir; - } - - public File getXmlOutFolder() { - return xmlOutFolder; - } - - public void setXmlOutFolder(File xmlOutFolder) { - this.xmlOutFolder = xmlOutFolder; - } - - public int getMinSdk() { - return minSdk; - } - - public void setMinSdk(int minSdk) { - this.minSdk = minSdk; - } - - public void setBlameLogDir(File blameLogDir) { - mBlameLogDir = blameLogDir; - } -} diff --git a/gradlePlugin/src/main/resources/META-INF/gradle-plugins/com.android.databinding.properties b/gradlePlugin/src/main/resources/META-INF/gradle-plugins/com.android.databinding.properties deleted file mode 100644 index 2e04d006..00000000 --- a/gradlePlugin/src/main/resources/META-INF/gradle-plugins/com.android.databinding.properties +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2014 The Android Open Source Project -# -# 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. -# - -implementation-class=android.databinding.tool.DataBinderPlugin
\ No newline at end of file diff --git a/gradlePlugin/src/main/resources/NOTICE.txt b/gradlePlugin/src/main/resources/NOTICE.txt deleted file mode 100644 index 2017f5cb..00000000 --- a/gradlePlugin/src/main/resources/NOTICE.txt +++ /dev/null @@ -1,1024 +0,0 @@ -List of 3rd party licenses: ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@292d3e75 name:antlr4 classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2015 Terence Parr, Sam Harwell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@421abfc8 name:commons-io classifier:null extension:jar type:jar] - - ****** NOTICE: -Apache Commons IO -Copyright 2002-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - - ****** LICENSE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@2406709c name:antlr4-annotations classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2015 Terence Parr, Sam Harwell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@394e7513 name:antlr-runtime classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2015 Terence Parr, Sam Harwell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@129e202 name:juniversalchardet classifier:null extension:jar type:jar] - - ****** LICENSE: -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@76d21d27 name:org.abego.treelayout.core classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -3. Neither the name of the abego Software GmbH nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@5ef461f2 name:antlr4-runtime classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2015 Terence Parr, Sam Harwell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@42b2f909 name:ST4 classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2011-2013 Terence Parr -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@3355a6ad name:commons-lang3 classifier:null extension:jar type:jar] - - ****** NOTICE: -Apache Commons Lang -Copyright 2001-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product includes software from the Spring Framework, -under the Apache License 2.0 (see: StringUtils.containsWhitespace()) - - ****** LICENSE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - diff --git a/integration-tests/App With Spaces/app/build.gradle b/integration-tests/App With Spaces/app/build.gradle index 88a44e83..15d5165b 100644 --- a/integration-tests/App With Spaces/app/build.gradle +++ b/integration-tests/App With Spaces/app/build.gradle @@ -15,11 +15,10 @@ */ apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { applicationId "com.android.databinding.appwithspaces" @@ -28,6 +27,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } buildTypes { release { minifyEnabled false diff --git a/integration-tests/App With Spaces/build.gradle b/integration-tests/App With Spaces/build.gradle index b13840ab..53e677e9 100644 --- a/integration-tests/App With Spaces/build.gradle +++ b/integration-tests/App With Spaces/build.gradle @@ -14,11 +14,10 @@ * limitations under the License. */ buildscript { - ext.rootFolder = new File(project.projectDir, "../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../..") apply from: "${project.projectDir}/../../propLoader.gradle" ext.addRepos(repositories) dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" - classpath "com.android.databinding:dataBinder:${config.version}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } } diff --git a/integration-tests/IndependentLibrary/app/build.gradle b/integration-tests/IndependentLibrary/app/build.gradle index ab2b979f..90d7328c 100644 --- a/integration-tests/IndependentLibrary/app/build.gradle +++ b/integration-tests/IndependentLibrary/app/build.gradle @@ -14,11 +14,10 @@ */ apply plugin: 'maven' apply plugin: 'com.android.library' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { minSdkVersion 7 @@ -26,6 +25,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } buildTypes { release { minifyEnabled false @@ -47,10 +49,10 @@ dependencies { uploadArchives { repositories { mavenDeployer { - repository(url: "file://${config.mavenRepoDir}") + repository(url: "file://${dataBindingConfig.mavenRepoDir}") pom.artifactId = 'independent-library' - pom.version = config.version - pom.groupId = config.testGroup + pom.version = dataBindingConfig.version + pom.groupId = dataBindingConfig.testGroup } } } diff --git a/integration-tests/IndependentLibrary/build.gradle b/integration-tests/IndependentLibrary/build.gradle index db36a5bc..ca2e97c5 100644 --- a/integration-tests/IndependentLibrary/build.gradle +++ b/integration-tests/IndependentLibrary/build.gradle @@ -14,11 +14,10 @@ */ buildscript { - ext.rootFolder = new File(project.projectDir, "../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../..") apply from: "${project.projectDir}/../../propLoader.gradle" ext.addRepos(repositories) dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" - classpath "com.android.databinding:dataBinder:${config.version}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } }
\ No newline at end of file diff --git a/integration-tests/MultiModuleTestApp/app/build.gradle b/integration-tests/MultiModuleTestApp/app/build.gradle index 4ecc1ff9..261a902b 100644 --- a/integration-tests/MultiModuleTestApp/app/build.gradle +++ b/integration-tests/MultiModuleTestApp/app/build.gradle @@ -15,11 +15,10 @@ */ apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { applicationId "com.android.databinding.multimoduletestapp" @@ -28,6 +27,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } buildTypes { release { minifyEnabled false @@ -42,10 +44,10 @@ android { } } -println "combined ${config.testGroup}.independent-library:${config.version}" +println "combined ${dataBindingConfig.testGroup}.independent-library:${dataBindingConfig.version}" dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':testlibrary') compile "com.android.support:support-v4:+" - compile "${config.testGroup}:independent-library:${config.version}" + compile "${dataBindingConfig.testGroup}:independent-library:${dataBindingConfig.version}" } diff --git a/integration-tests/MultiModuleTestApp/build.gradle b/integration-tests/MultiModuleTestApp/build.gradle index 5e5a3e23..7dc5032a 100644 --- a/integration-tests/MultiModuleTestApp/build.gradle +++ b/integration-tests/MultiModuleTestApp/build.gradle @@ -14,11 +14,10 @@ * limitations under the License. */ buildscript { - ext.rootFolder = new File(project.projectDir, "../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../..") apply from: "${project.projectDir}/../../propLoader.gradle" ext.addRepos(repositories) dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" - classpath "com.android.databinding:dataBinder:${config.version}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } }
\ No newline at end of file diff --git a/integration-tests/MultiModuleTestApp/testlibrary/build.gradle b/integration-tests/MultiModuleTestApp/testlibrary/build.gradle index 71ff29f1..d1bde4db 100644 --- a/integration-tests/MultiModuleTestApp/testlibrary/build.gradle +++ b/integration-tests/MultiModuleTestApp/testlibrary/build.gradle @@ -15,11 +15,10 @@ */ apply plugin: 'com.android.library' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { minSdkVersion 7 @@ -27,6 +26,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } buildTypes { release { minifyEnabled false diff --git a/integration-tests/TestApp/app/build.gradle b/integration-tests/TestApp/app/build.gradle index b96ba2ad..0981966f 100644 --- a/integration-tests/TestApp/app/build.gradle +++ b/integration-tests/TestApp/app/build.gradle @@ -1,9 +1,8 @@ apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { applicationId "com.android.databinding.testapp" @@ -12,6 +11,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } buildTypes { release { minifyEnabled false diff --git a/integration-tests/TestApp/build.gradle b/integration-tests/TestApp/build.gradle index c15f7f59..35f8e950 100644 --- a/integration-tests/TestApp/build.gradle +++ b/integration-tests/TestApp/build.gradle @@ -1,9 +1,8 @@ buildscript { - ext.rootFolder = new File(project.projectDir, "../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../..") apply from: "${project.projectDir}/../../propLoader.gradle" ext.addRepos(repositories) dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" - classpath "com.android.databinding:dataBinder:${config.version}" + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } } diff --git a/internal-prebuilts/README.md b/internal-prebuilts/README.md new file mode 100644 index 00000000..92116c7e --- /dev/null +++ b/internal-prebuilts/README.md @@ -0,0 +1,6 @@ +This maven repository includes prebuilts of data binding libs that +a) depend on android gradle plugin +b) used druing development of data binding itself. + +This repository is designed to only be referenced by the Android Gradle Plugin (platform/tools). +To access data binding prebuilds for your own app, use /platform/prebuilt/ projects.
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-javadoc.jar b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-javadoc.jar Binary files differnew file mode 100644 index 00000000..c2188385 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-javadoc.jar diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar Binary files differnew file mode 100644 index 00000000..402b6f3e --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar.md5 b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar.md5 new file mode 100644 index 00000000..fd611e09 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3-sources.jar.md5 @@ -0,0 +1 @@ +06eaa31170fbda8df4bfabbd9e597dbb
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar Binary files differnew file mode 100644 index 00000000..f2ba5235 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar.md5 b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar.md5 new file mode 100644 index 00000000..8cfaa398 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.jar.md5 @@ -0,0 +1 @@ +e4d9cb379ec08bd5605f50ae46f4931a
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom new file mode 100644 index 00000000..a7cb4c71 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.android.databinding</groupId> + <artifactId>baseLibrary</artifactId> + <version>1.0-rc3</version> + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom.md5 b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom.md5 new file mode 100644 index 00000000..0865ba5e --- /dev/null +++ b/internal-prebuilts/com/android/databinding/baseLibrary/1.0-rc3/baseLibrary-1.0-rc3.pom.md5 @@ -0,0 +1 @@ +b27ce565d94a8fa1510cf091bd392cea
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar Binary files differnew file mode 100644 index 00000000..aea6553a --- /dev/null +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar diff --git a/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 new file mode 100644 index 00000000..d2ae019f --- /dev/null +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 @@ -0,0 +1 @@ +b558368c3aca95cae892ca6a3b501cf0
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 new file mode 100644 index 00000000..6854cafe --- /dev/null +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 @@ -0,0 +1 @@ +226e8d2d8e1c982ae8ce9575ab6a18d483184736
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom index e5bd0a91..e5bd0a91 100644 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom.md5 b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom.md5 index f6f07602..f6f07602 100644 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom.md5 +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom.md5 diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom.sha1 b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom.sha1 index 7be4a275..7be4a275 100644 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.pom.sha1 +++ b/internal-prebuilts/com/android/databinding/bintray/1.1/bintray-1.1.pom.sha1 diff --git a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml index d3a910b7..571e11b4 100644 --- a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml +++ b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml @@ -7,6 +7,6 @@ <versions> <version>1.1</version> </versions> - <lastUpdated>20151006171725</lastUpdated> + <lastUpdated>20151023175359</lastUpdated> </versioning> </metadata> diff --git a/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.md5 b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.md5 new file mode 100644 index 00000000..78df8195 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.md5 @@ -0,0 +1 @@ +9599016e1336248cb485f868c98e33f3
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.sha1 b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.sha1 new file mode 100644 index 00000000..df109e8c --- /dev/null +++ b/internal-prebuilts/com/android/databinding/bintray/maven-metadata.xml.sha1 @@ -0,0 +1 @@ +60576e5f6a5512d6d15b1cfbec65586e0eb9c26a
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar Binary files differnew file mode 100644 index 00000000..d0f5a15a --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.md5 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.md5 new file mode 100644 index 00000000..ffb8c1eb --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.md5 @@ -0,0 +1 @@ +7d27a72c2bf4572aa7cbb16f1fa27f2a
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.sha1 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.sha1 new file mode 100644 index 00000000..eb98972d --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-javadoc.jar.sha1 @@ -0,0 +1 @@ +87410ab0c2d367b3f60937e68282031015437e65
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar Binary files differnew file mode 100644 index 00000000..d0f5a15a --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.md5 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.md5 new file mode 100644 index 00000000..ffb8c1eb --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.md5 @@ -0,0 +1 @@ +7d27a72c2bf4572aa7cbb16f1fa27f2a
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.sha1 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.sha1 new file mode 100644 index 00000000..eb98972d --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3-sources.jar.sha1 @@ -0,0 +1 @@ +87410ab0c2d367b3f60937e68282031015437e65
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar Binary files differnew file mode 100644 index 00000000..32d2ca61 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.md5 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.md5 new file mode 100644 index 00000000..1c3fb0b9 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.md5 @@ -0,0 +1 @@ +a37f1e84070d11251a7724e2d8d8c5a2
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.sha1 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.sha1 new file mode 100644 index 00000000..2066a0a7 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.aar.sha1 @@ -0,0 +1 @@ +115c443258c5a58e39f26a48134cf2dd0286733c
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom new file mode 100644 index 00000000..6a047180 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.android.databinding</groupId> + <artifactId>library</artifactId> + <version>1.0-rc3</version> + <packaging>aar</packaging> + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> + <dependency> + <groupId>com.android.support</groupId> + <artifactId>support-v4</artifactId> + <version>21.0.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.android.databinding</groupId> + <artifactId>baseLibrary</artifactId> + <version>1.0-rc5</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.md5 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.md5 new file mode 100644 index 00000000..5106fc5f --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.md5 @@ -0,0 +1 @@ +c43aa2a1326935ac1912c3e55727b7f7
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.sha1 b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.sha1 new file mode 100644 index 00000000..15c7d3fa --- /dev/null +++ b/internal-prebuilts/com/android/databinding/library/1.0-rc3/library-1.0-rc3.pom.sha1 @@ -0,0 +1 @@ +f5a74dac492db06fe8139ba8eb5d790c0900237b
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar Binary files differnew file mode 100644 index 00000000..4532834a --- /dev/null +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar diff --git a/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 new file mode 100644 index 00000000..99310bb6 --- /dev/null +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 @@ -0,0 +1 @@ +fc850037266f9ab95b717b92e70d7ab1
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 new file mode 100644 index 00000000..5d63bb4d --- /dev/null +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 @@ -0,0 +1 @@ +c87a8b0a5def76961e1f588e3a6c1484a275641d
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom index 08a876c6..08a876c6 100644 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.md5 b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.md5 index 20a49828..20a49828 100644 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.md5 +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.md5 diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.sha1 b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.sha1 index 6705f120..6705f120 100644 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.sha1 +++ b/internal-prebuilts/com/android/databinding/localizemaven/1.1/localizemaven-1.1.pom.sha1 diff --git a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml index 567fc41f..9a4e8313 100644 --- a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml +++ b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml @@ -7,6 +7,6 @@ <versions> <version>1.1</version> </versions> - <lastUpdated>20151006171726</lastUpdated> + <lastUpdated>20151023175400</lastUpdated> </versioning> </metadata> diff --git a/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.md5 b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.md5 new file mode 100644 index 00000000..0ca2ec3f --- /dev/null +++ b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.md5 @@ -0,0 +1 @@ +a5e33106175505446aa6da3779e85b46
\ No newline at end of file diff --git a/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.sha1 b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.sha1 new file mode 100644 index 00000000..44ba2e9c --- /dev/null +++ b/internal-prebuilts/com/android/databinding/localizemaven/maven-metadata.xml.sha1 @@ -0,0 +1 @@ +aea2b813a70b09fad7a5fcc9e3866ee20fee6b26
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar b/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar Binary files differdeleted file mode 100644 index c524df9a..00000000 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar +++ /dev/null diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 b/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 deleted file mode 100644 index c74f9bc5..00000000 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.md5 +++ /dev/null @@ -1 +0,0 @@ -4cca1d399d71d0e54920c1560e8dc886
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 b/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 deleted file mode 100644 index 9b063e0f..00000000 --- a/plugins-repo/com/android/databinding/bintray/1.1/bintray-1.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -aecc14217e5bee78f4945569cdf330aa3ee17965
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.md5 b/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.md5 deleted file mode 100644 index 905e8647..00000000 --- a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.md5 +++ /dev/null @@ -1 +0,0 @@ -72382fbf95261fe2877b094ca05ec788
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.sha1 b/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.sha1 deleted file mode 100644 index eff19e4f..00000000 --- a/plugins-repo/com/android/databinding/bintray/maven-metadata.xml.sha1 +++ /dev/null @@ -1 +0,0 @@ -4cee6c779b330de4e3dcb5e5d364b46acc32a45f
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar b/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar Binary files differdeleted file mode 100644 index 27733d22..00000000 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar +++ /dev/null diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 b/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 deleted file mode 100644 index f784bed5..00000000 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.md5 +++ /dev/null @@ -1 +0,0 @@ -15bf0b4bb82bfae17ad6277a558b4a06
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 b/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 deleted file mode 100644 index 5300b597..00000000 --- a/plugins-repo/com/android/databinding/localizemaven/1.1/localizemaven-1.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9c3904cfd89d10c5193fdab040089d3fee348167
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.md5 b/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.md5 deleted file mode 100644 index 4ddf1e60..00000000 --- a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.md5 +++ /dev/null @@ -1 +0,0 @@ -9597d1283be36a298371317060453939
\ No newline at end of file diff --git a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.sha1 b/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.sha1 deleted file mode 100644 index 3d0d71a0..00000000 --- a/plugins-repo/com/android/databinding/localizemaven/maven-metadata.xml.sha1 +++ /dev/null @@ -1 +0,0 @@ -2660a4f652bb6b1b861ff4fd522f4ad81d4858f2
\ No newline at end of file diff --git a/propLoader.gradle b/propLoader.gradle index be9c2c45..a91942bf 100644 --- a/propLoader.gradle +++ b/propLoader.gradle @@ -2,7 +2,7 @@ * Helper build script that reads data binding variables and sets up the projects. */ def forceReleaseVersion = project.hasProperty('useReleaseVersion') && project.getProperty('useReleaseVersion').equals("true") -def root = ext.rootFolder +def root = ext.dataBindingRootFolder Properties databindingProperties = new Properties() databindingProperties.load(new FileInputStream("${root}/databinding.properties")) if (forceReleaseVersion) { @@ -11,43 +11,51 @@ if (forceReleaseVersion) { databindingProperties.compileSdkVersion = Integer.parseInt(databindingProperties.compileSdkVersionStr) def repoBase = databindingProperties.mavenRepoAbsolutePath == "." ? root : databindingProperties.mavenRepoAbsolutePath databindingProperties.mavenRepoDir = "${repoBase}/${databindingProperties.mavenRepoName}" -databindingProperties.extraPluginsRepoDir = "${root}/${databindingProperties.extraPluginsRepoName}" +databindingProperties.internalPrebuiltsRepoDir = "${root}/${databindingProperties.internalPrebuiltsRepoName}" +databindingProperties.runProguard = project.hasProperty('runProguard') && project.getProperty('runProguard').equals("true") + +// load version from gradle build file +apply from: "$root/../buildSrc/base/version.gradle" +databindingProperties.androidPluginVersion=ext.buildVersion databindingProperties.eapOutDir = "${root}/${databindingProperties.eapOutFolderName}" databindingProperties.prebuildFolder = "${root}/${databindingProperties.prebuildFolderName}" + "/${databindingProperties.releaseVersion}" -ext.config = databindingProperties -ext.config.externalPrebuiltsBase = "${root}/../../prebuilts" +ext.dataBindingConfig = databindingProperties +ext.dataBindingConfig.externalPrebuiltsBase = "${root}/../../prebuilts" databindingProperties.megaRepoDir = "${databindingProperties.externalPrebuiltsBase}/tools/common/m2/repository" +databindingProperties.androidGradlePluginRepoDir = "${root}/../../${databindingProperties.androidGradlePluginOutRepo}" -println "local maven repo is ${ext.config.mavenRepoDir}." -println "local pre-build folder is ${ext.config.prebuildFolder}." -println "mega-repo folder is ${ext.config.megaRepoDir}." +println "local maven repo is ${ext.dataBindingConfig.mavenRepoDir}." +println "local pre-build folder is ${ext.dataBindingConfig.prebuildFolder}." +println "mega-repo folder is ${ext.dataBindingConfig.megaRepoDir}." -new File(ext.config.mavenRepoDir).mkdir() -new File(ext.config.prebuildFolder).mkdir() +new File(ext.dataBindingConfig.mavenRepoDir).mkdir() +new File(ext.dataBindingConfig.prebuildFolder).mkdir() def addRemoteRepos = project.hasProperty('addRemoteRepos') && project.getProperty('addRemoteRepos').equals("true") -ext.config.addRemoteRepos = addRemoteRepos -ext.config.sharedSupportRepoDir = "${ext.config.externalPrebuiltsBase}/maven_repo/android" -ext.config.inReleaseBuild = !databindingProperties.version.endsWith("SNAPSHOT") -def config = ext.config -def localRepositories = ["${config.extraPluginsRepoDir}", - "${config.megaRepoDir}", - "${config.mavenRepoDir}", - "${config.externalPrebuiltsBase}/tools/common/offline-m2", - config.sharedSupportRepoDir, - "${config.externalPrebuiltsBase}/gradle-plugin", - "${config.externalPrebuiltsBase}/tools/common/m2/repository"] -ext.config.localRepositories = localRepositories +ext.dataBindingConfig.addRemoteRepos = addRemoteRepos +ext.dataBindingConfig.sharedSupportRepoDir = "${ext.dataBindingConfig.externalPrebuiltsBase}/maven_repo/android" +ext.dataBindingConfig.inReleaseBuild = !databindingProperties.version.endsWith("SNAPSHOT") +ext.dataBindingConfig.forGradlePlugin = project.hasProperty('forGradlePlugin') && project.getProperty('forGradlePlugin').equals("true") +def dataBindingConfig = ext.dataBindingConfig +def localRepositories = ["${dataBindingConfig.internalPrebuiltsRepoDir}", + "${dataBindingConfig.megaRepoDir}", + "${dataBindingConfig.mavenRepoDir}", + "${dataBindingConfig.externalPrebuiltsBase}/tools/common/offline-m2", + dataBindingConfig.sharedSupportRepoDir, + "${dataBindingConfig.externalPrebuiltsBase}/gradle-plugin", + "${dataBindingConfig.externalPrebuiltsBase}/tools/common/m2/repository", + "${databindingProperties.androidGradlePluginRepoDir}"] +ext.dataBindingConfig.localRepositories = localRepositories def addRepos(RepositoryHandler handler) { - config.localRepositories.each { repo -> + dataBindingConfig.localRepositories.each { repo -> handler.maven { url repo } } - if (config.addRemoteRepos) { + if (dataBindingConfig.addRemoteRepos) { handler.jcenter() handler.mavenCentral() } diff --git a/samples/BindingDemo/app/build.gradle b/samples/BindingDemo/app/build.gradle index e242c567..651e33e4 100644 --- a/samples/BindingDemo/app/build.gradle +++ b/samples/BindingDemo/app/build.gradle @@ -15,11 +15,10 @@ */ apply plugin: 'com.android.application' -apply plugin: 'com.android.databinding' android { - compileSdkVersion config.compileSdkVersion - buildToolsVersion config.buildToolsVersion + compileSdkVersion dataBindingConfig.compileSdkVersion + buildToolsVersion dataBindingConfig.buildToolsVersion defaultConfig { applicationId "com.android.bindingdemo" @@ -28,6 +27,9 @@ android { versionCode 1 versionName "1.0" } + dataBinding { + enabled = true + } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 diff --git a/samples/BindingDemo/build.gradle b/samples/BindingDemo/build.gradle index 0211e124..46aa2757 100644 --- a/samples/BindingDemo/build.gradle +++ b/samples/BindingDemo/build.gradle @@ -14,30 +14,12 @@ * limitations under the License. */ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +// Top-level build file where you can add dataBindingConfiguration options common to all sub-projects/modules. buildscript { - ext.rootFolder = new File(project.projectDir, "../..") + ext.dataBindingRootFolder = new File(project.projectDir, "../..") apply from: "${project.projectDir}/../../propLoader.gradle" - - repositories { - jcenter() - maven { - url "$projectDir/../../maven-repo" - } - mavenCentral() - } + ext.addRepos(repositories) dependencies { - classpath "com.android.tools.build:gradle:${config.androidPluginVersion}" - classpath "com.android.databinding:dataBinder:${config.version}" - } -} - -allprojects { - repositories { - jcenter() - maven { - url "$projectDir/../../../maven-repo" - } - mavenCentral() + classpath "com.android.tools.build:gradle:${dataBindingConfig.androidPluginVersion}" } } diff --git a/settings.gradle b/settings.gradle index 0d4e57cd..24b44d3a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,9 @@ -include ':baseLibrary' -include ':library' -include ':compiler' -include ':gradlePlugin' -include 'compilationTests' -include 'compilerCommon' +include ':dataBinding:baseLibrary' +project(':dataBinding:baseLibrary').projectDir = new File("baseLibrary") +include ':dataBinding:compiler' +project(':dataBinding:compiler').projectDir = new File("compiler") +include ':dataBinding:compilationTests' +project(':dataBinding:compilationTests').projectDir = new File("compilationTests") +include ':dataBinding:compilerCommon' +project(':dataBinding:compilerCommon').projectDir = new File("compilerCommon") |