summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-12-08 11:43:35 -0800
committerDeepanshu Gupta <deepanshu@google.com>2015-12-16 16:55:15 -0800
commit5bd6addc9cb9dda23d022a6632e90591457f613e (patch)
tree55177b0cb193148352be40ede20b7091af86755c
parent638a4e1fdc7dcbc8f472684b8c446909992db344 (diff)
downloaddata-binding-5bd6addc9cb9dda23d022a6632e90591457f613e.tar.gz
Add modules definitions.
These are referenced by the tools/idea project. Also, some minor code improvments. Change-Id: Ia1f6a80c257b9022a2efda553ccc9096e03edc00
-rw-r--r--baseLibrary/baseLibrary-base.iml1
-rw-r--r--compiler/compiler.iml41
-rw-r--r--compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt4
-rw-r--r--compilerCommon/compilerCommon.iml53
-rw-r--r--compilerCommon/src/main/java/android/databinding/tool/store/Location.java5
5 files changed, 99 insertions, 5 deletions
diff --git a/baseLibrary/baseLibrary-base.iml b/baseLibrary/baseLibrary-base.iml
index 884f425f..7cf99832 100644
--- a/baseLibrary/baseLibrary-base.iml
+++ b/baseLibrary/baseLibrary-base.iml
@@ -6,6 +6,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../../../out/build/dataBinding/baseLibrary/build" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
diff --git a/compiler/compiler.iml b/compiler/compiler.iml
new file mode 100644
index 00000000..9fbbd679
--- /dev/null
+++ b/compiler/compiler.iml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
+ <excludeFolder url="file://$MODULE_DIR$/gradle" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="baseLibrary-base" exported="" />
+ <orderEntry type="module" module-name="compilerCommon" />
+ <orderEntry type="library" name="KotlinJavaRuntime" level="project" />
+ <orderEntry type="module-library" scope="TEST">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/junit/junit/4.12/junit-4.12.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/junit/junit/4.12/junit-4.12-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library" scope="TEST">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ </component>
+</module> \ No newline at end of file
diff --git a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
index 3d23e138..70317f6a 100644
--- a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
+++ b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
@@ -31,13 +31,13 @@ public fun List<String>.joinToCamelCaseAsVar(): String = when(size) {
else -> get(0).toCamelCaseAsVar() + drop(1).joinToCamelCase()
}
-public fun Array<String>.joinToCamelCase(): String = when(size()) {
+public fun Array<String>.joinToCamelCase(): String = when(size) {
0 -> throw IllegalArgumentException("invalid section size, cannot be zero")
1 -> this.get(0).toCamelCase()
else -> this.map {it.toCamelCase()}.joinToString("")
}
-public fun Array<String>.joinToCamelCaseAsVar(): String = when(size()) {
+public fun Array<String>.joinToCamelCaseAsVar(): String = when(size) {
0 -> throw IllegalArgumentException("invalid section size, cannot be zero")
1 -> this.get(0).toCamelCaseAsVar()
else -> get(0).toCamelCaseAsVar() + drop(1).joinToCamelCase()
diff --git a/compilerCommon/compilerCommon.iml b/compilerCommon/compilerCommon.iml
new file mode 100644
index 00000000..aa80c5f3
--- /dev/null
+++ b/compilerCommon/compilerCommon.iml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/xml-gen" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/grammar-gen" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../out/build/dataBinding/compilerCommon/build" />
+ <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="baseLibrary-base" />
+ <orderEntry type="library" exported="" name="commons-lang3-3.3.2" level="project" />
+ <orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
+ <orderEntry type="module-library" exported="">
+ <library name="juniversalchardet-1.0.3">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../adt/idea/android/lib/juniversalchardet-1.0.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" />
+ <orderEntry type="library" exported="" name="antlr4-annotations-4.5" level="project" />
+ <orderEntry type="module-library" scope="TEST">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/junit/junit/4.12/junit-4.12.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/junit/junit/4.12/junit-4.12-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library" scope="TEST">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../prebuilts/tools/common/m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ </component>
+</module> \ No newline at end of file
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 8c6d22c6..e00c34a3 100644
--- a/compilerCommon/src/main/java/android/databinding/tool/store/Location.java
+++ b/compilerCommon/src/main/java/android/databinding/tool/store/Location.java
@@ -17,12 +17,11 @@
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;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -234,7 +233,7 @@ public class Location {
return new LocationScopeProvider() {
@Override
public List<Location> provideScopeLocation() {
- return Arrays.asList(Location.this);
+ return Collections.singletonList(Location.this);
}
};
}