Skip to content

Commit

Permalink
Update kotlin, gradle and buck versions (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
kageiit authored Jun 23, 2017
1 parent 48aacbb commit 78a7ee7
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .buckversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
800d5a9669417d5a8b4bc455e34a629422ed1ff1
cf0c82541709e2c6f77d7a6062097242a5ea7874
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
jcenter()
google()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://dl.bintray.com/kotlin/kotlin-dev/"}
}
dependencies {
classpath deps.build.androidPlugin
Expand All @@ -20,6 +21,7 @@ allprojects { project ->
repositories {
jcenter()
google()
maven { url "https://dl.bintray.com/kotlin/kotlin-dev/"}
}
}

Expand All @@ -40,10 +42,6 @@ subprojects { project ->
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}

def addCommonConfigurationForJavaModules(Project project) {
if (project.plugins.hasPlugin('me.tatarka.retrolambda')) {
project.sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ apply from: "../dependencies.gradle"
repositories {
jcenter()
google()
maven { url "https://dl.bintray.com/kotlin/kotlin-dev/"}
}

tasks.withType(GroovyCompile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,15 @@ abstract class AndroidTarget extends JavaLibTarget {

RuleType getRuleType() {
if (isKotlin) {
return RuleType.ANDROID_LIBRARY_WITH_KOTLIN
return RuleType.KOTLIN_ANDROID_LIBRARY
} else {
return RuleType.ANDROID_LIBRARY
}
}

RuleType getTestRuleType() {
if (isKotlin) {
return RuleType.ROBOLECTRIC_TEST_WITH_KOTLIN
return RuleType.KOTLIN_ROBOLECTRIC_TEST
} else {
return RuleType.ROBOLECTRIC_TEST
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public enum RuleType {
ANDROID_INSTRUMENTATION_APK,
ANDROID_INSTRUMENTATION_TEST,
ANDROID_LIBRARY,
ANDROID_LIBRARY_WITH_KOTLIN("java", "kt"),
ANDROID_MANIFEST,
ANDROID_RESOURCE,
GEN_AIDL,
Expand All @@ -19,11 +18,12 @@ public enum RuleType {
JAVA_BINARY,
JAVA_LIBRARY,
JAVA_TEST,
KOTLIN_LIBRARY("java", "kt"),
KOTLIN_TEST("java", "kt"),
KOTLIN_ANDROID_LIBRARY("java", "kt"),
KOTLIN_LIBRARY("kt"),
KOTLIN_ROBOLECTRIC_TEST("java", "kt"),
KOTLIN_TEST("kt"),
PREBUILT_NATIVE_LIBRARY,
ROBOLECTRIC_TEST,
ROBOLECTRIC_TEST_WITH_KOTLIN("java", "kt");
ROBOLECTRIC_TEST;

private final List<String> sourceExtensions;

Expand All @@ -42,10 +42,10 @@ public List<String> getSourceExtensions() {
public String getBuckName() {
RuleType buckType = this;
switch (this) {
case ANDROID_LIBRARY_WITH_KOTLIN:
case KOTLIN_ANDROID_LIBRARY:
buckType = ANDROID_LIBRARY;
break;
case ROBOLECTRIC_TEST_WITH_KOTLIN:
case KOTLIN_ROBOLECTRIC_TEST:
buckType = ROBOLECTRIC_TEST;
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ abstract class AndroidRule extends JavaRule {
protected final void printContent(PrintStream printer) {
super.printContent(printer)

if (mRuleType == RuleType.ANDROID_LIBRARY_WITH_KOTLIN ||
mRuleType == RuleType.ROBOLECTRIC_TEST_WITH_KOTLIN) {
if (mRuleType == RuleType.KOTLIN_ANDROID_LIBRARY ||
mRuleType == RuleType.KOTLIN_ROBOLECTRIC_TEST) {
printer.println("\tlanguage = 'kotlin',")
}

Expand Down
34 changes: 17 additions & 17 deletions buildSrc/src/main/java/com/uber/okbuck/core/util/KotlinUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class KotlinUtil {

private static final String KOTLIN_DEPS_CONFIG = "okbuck_kotlin_deps";
private static final String KOTLIN_GROUP = "org.jetbrains.kotlin";
private static final String KOTLIN_COMPILER_MODULE = "kotlin-compiler";
private static final String KOTLIN_COMPILER_MODULE = "kotlin-compiler-embeddable";

This comment has been minimized.

Copy link
@runningcode

runningcode Jun 23, 2017

Contributor

;)

This comment has been minimized.

Copy link
@kageiit

kageiit Jun 23, 2017

Author Contributor

:)

private static final String KOTLIN_GRADLE_MODULE = "kotlin-gradle-plugin";
private static final String KOTLIN_STDLIB_MODULE = "kotlin-stdlib";
public static final String KOTLIN_HOME_LOCATION = OkBuckGradlePlugin.DEFAULT_CACHE_PATH + "/kotlin_home";
Expand All @@ -42,24 +42,24 @@ public static void setupKotlinHome(Project rootProject) {
null);

removeVersions(Paths.get(KOTLIN_HOME_LOCATION),
KOTLIN_COMPILER_MODULE,
KOTLIN_STDLIB_MODULE);
KOTLIN_COMPILER_MODULE, "kotlin-compiler");
removeVersions(Paths.get(KOTLIN_HOME_LOCATION),
KOTLIN_STDLIB_MODULE, KOTLIN_STDLIB_MODULE);
}

private static void removeVersions(Path dir, String... toRename) {
for (String rename : toRename) {
try {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
String fileName = file.getFileName().toString();
if (fileName.startsWith(rename)) {
Files.move(file, file.getParent().resolve(rename + ".jar"));
}
return FileVisitResult.CONTINUE;
private static void removeVersions(Path dir, String toRename, String renamed) {
try {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws
IOException {
String fileName = file.getFileName().toString();
if (fileName.startsWith(toRename)) {
Files.move(file, file.getParent().resolve(renamed + ".jar"));
}
});
} catch (IOException ignored) {}
}
return FileVisitResult.CONTINUE;
}
});
} catch (IOException ignored) {}
}
}
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def versions = [
butterKnifeVersion : '8.4.0',
daggerVersion : '2.8',
kotlinVersion : '1.1.2',
kotlinVersion : '1.1.3',
leakCanaryVersion : '1.5',
supportVersion : '25.0.1',
androidPluginVersion : '2.3.2',
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jun 19 15:37:59 PDT 2017
#Thu Jun 22 18:59:24 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-bin.zip

0 comments on commit 78a7ee7

Please sign in to comment.