Skip to content

Commit 8b7ef45

Browse files
authoredApr 4, 2024··
Update to Android tools v30.3.0 (#988)
* Update to Android Tools v30.0.3 * Update to Kotlin v1.5 * Remove kotlin android extensions * Force correct kotlinx metadata version with added dependency * Fix FileUtils method removal * Turn off Dagger lints since causing crashes
1 parent d172a0e commit 8b7ef45

File tree

10 files changed

+45
-11
lines changed

10 files changed

+45
-11
lines changed
 

‎build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ allprojects { project ->
3232
}
3333
configurations.all {
3434
exclude group:"com.android.tools.build", module: "transform-api"
35+
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
36+
if (details.requested.group == 'org.jetbrains.kotlin') {
37+
details.useVersion deps.versions.kotlin
38+
}
39+
}
3540
resolutionStrategy {
3641
force deps.build.bcprov
3742
force deps.build.commonsCompress

‎buildSrc/src/main/java/com/uber/okbuck/extension/KotlinExtension.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public class KotlinExtension {
1313
@Nullable public String compilerZipSha256;
1414

1515
KotlinExtension(Project project) {
16-
this.version = "1.4.10";
17-
this.compilerZipSha256 = "bb1a21d70e521a01ae104e99a082a6e7bb58699b86347049da521d175d0dace7";
16+
this.version = "1.5.31";
17+
this.compilerZipSha256 = "661111286f3e5ac06aaf3a9403d869d9a96a176b62b141814be626a47249fe9e";
1818
}
1919

2020
@Internal

‎dependencies.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def exclude = { dep, String... excludes ->
1818

1919
def versions = [
2020
androidPlugin : "4.2.2",
21-
androidTools : "30.0.2",
21+
androidTools : "30.3.0",
2222
autovalue : "1.7.4",
2323
avro : "1.10.1",
2424
butterKnife : "10.2.3",
2525
dagger : "2.33",
26-
kotlin : "1.4.10",
26+
kotlin : "1.5.31",
2727
leakCanary : "2.6",
2828
rocker : "1.3.0",
2929
androidx : "1.1.0",
@@ -88,6 +88,7 @@ def external = [
8888
gson : "com.google.code.gson:gson:2.8.6",
8989
kotlinExtension : "org.jetbrains.kotlin:kotlin-android-extensions:${versions.kotlin}",
9090
kotlinStdlib : "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}",
91+
kotlinMetadata : "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.3.0",
9192
leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}",
9293
sqldelight : "com.squareup.sqldelight:android-driver:${versions.sqldelight}",
9394
rxandroid : "io.reactivex.rxjava2:rxandroid:2.1.1",

‎dummy-transform/src/main/java/com/uber/okbuck/transform/DummyTransform.java

+18-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void transform(TransformInvocation transformInvocation)
8787

8888
File inputFile = changedInput.getKey();
8989
File outputFile =
90-
new File(outputDir, FileUtils.relativePossiblyNonExistingPath(inputFile, inputDir));
90+
new File(outputDir, relativePossiblyNonExistingPath(inputFile, inputDir));
9191

9292
switch (changedInput.getValue()) {
9393
case REMOVED:
@@ -107,11 +107,27 @@ public void transform(TransformInvocation transformInvocation)
107107
Iterable<File> files = FileUtils.getAllFiles(inputDir);
108108
for (File inputFile : files) {
109109

110-
File outputFile = new File(outputDir, FileUtils.relativePath(inputFile, inputDir));
110+
File outputFile = new File(outputDir, relativePath(inputFile, inputDir));
111111
FileUtils.copyFile(inputFile, outputFile);
112112
}
113113
}
114114
}
115115
}
116116
}
117+
118+
private static String relativePath(File file, File dir) {
119+
return relativePossiblyNonExistingPath(file, dir);
120+
}
121+
122+
private static String relativePossiblyNonExistingPath(File file, File dir) {
123+
String path = dir.toURI().relativize(file.toURI()).getPath();
124+
return toSystemDependentPath(path);
125+
}
126+
127+
private static String toSystemDependentPath(String path) {
128+
if (File.separatorChar != '/') {
129+
path = path.replace('/', File.separatorChar);
130+
}
131+
return path;
132+
}
117133
}

‎kotlin-app/build.gradle

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
apply plugin: "com.android.application"
44
apply plugin: "com.squareup.sqldelight"
55
apply plugin: "kotlin-android"
6-
apply plugin: "kotlin-android-extensions"
76
apply plugin: "kotlin-kapt"
87

98
android {
@@ -13,6 +12,14 @@ android {
1312
}
1413

1514
flavorDimensions "default"
15+
16+
lintOptions {
17+
// Turn off Dagger lints
18+
disable "JvmStaticProvidesInObjectDetector"
19+
disable "FieldSiteTargetOnQualifierAnnotation"
20+
disable "ModuleCompanionObjects"
21+
disable "ModuleCompanionObjectsNotInModuleParent"
22+
}
1623
}
1724

1825
tasks.withType(KotlinCompile).all {

‎kotlin-app/src/main/java/com/uber/okbuck/example/MainActivity.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ package com.uber.okbuck.example
22

33
import android.os.Bundle
44
import android.widget.Toast
5+
import androidx.appcompat.widget.Toolbar
6+
import com.google.android.material.floatingactionbutton.FloatingActionButton
57
import com.uber.okbuck.example.sqldelightmodel.GithubRepo
68
import dagger.android.support.DaggerAppCompatActivity
7-
import kotlinx.android.synthetic.main.activity_main.*
89
import javax.inject.Inject
910

1011
class MainActivity : DaggerAppCompatActivity() {
1112

1213
@Inject
1314
lateinit var analytics: Analytics
1415

16+
private val fab by lazy { findViewById<FloatingActionButton>(R.id.fab) }
17+
private val toolbar by lazy { findViewById<Toolbar>(R.id.toolbar) }
18+
1519
override fun onCreate(savedInstanceState: Bundle?) {
1620
super.onCreate(savedInstanceState)
1721
setContentView(R.layout.activity_main)

‎libraries/kotlinlibrary/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies {
88

99
implementation deps.external.kotlinStdlib
1010
implementation deps.external.dagger
11+
implementation deps.external.kotlinMetadata
1112
kapt deps.apt.daggerCompiler
1213
kaptTest deps.apt.daggerCompiler
1314
testImplementation deps.test.junit

‎manifest-merger-cli/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ evaluationDependsOn(pluginProjectPath)
44
apply plugin: "application"
55

66
group = "com.uber.okbuck.transform"
7-
version = "1.0.0"
7+
version = "1.0.1"
88

99
tasks.withType(JavaCompile) {
1010
sourceCompatibility = JavaVersion.VERSION_1_8

‎manifest-merger-cli/src/main/java/com/uber/okbuck/manifmerger/ManifestMergerCli.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static int process(String[] args) throws FileNotFoundException {
120120
"Invalid property name "
121121
+ value.substring(0, value.indexOf('='))
122122
+ ", allowed properties are : "
123-
+ Joiner.on(',').join(ManifestSystemProperty.values()));
123+
+ Joiner.on(',').join(ManifestSystemProperty.getValues()));
124124
return 1;
125125
}
126126
}
@@ -184,7 +184,7 @@ private static void usage() {
184184
System.out.println("\t--libs [path separated list of lib's manifests]");
185185
System.out.println("\t--overlays [path separated list of overlay's manifests]");
186186
System.out.println(
187-
"\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.values()) + "=value]");
187+
"\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.getValues()) + "=value]");
188188
System.out.println("\t--placeholder [name=value]");
189189
System.out.println("\t--out [path of the output file]");
190190
}

0 commit comments

Comments
 (0)
Please sign in to comment.