Skip to content

Commit

Permalink
Update to Android tools v30.3.0 (#988)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jbarr21 committed Apr 4, 2024
1 parent d172a0e commit 8b7ef45
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 11 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ allprojects { project ->
}
configurations.all {
exclude group:"com.android.tools.build", module: "transform-api"
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion deps.versions.kotlin
}
}
resolutionStrategy {
force deps.build.bcprov
force deps.build.commonsCompress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class KotlinExtension {
@Nullable public String compilerZipSha256;

KotlinExtension(Project project) {
this.version = "1.4.10";
this.compilerZipSha256 = "bb1a21d70e521a01ae104e99a082a6e7bb58699b86347049da521d175d0dace7";
this.version = "1.5.31";
this.compilerZipSha256 = "661111286f3e5ac06aaf3a9403d869d9a96a176b62b141814be626a47249fe9e";
}

@Internal
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def exclude = { dep, String... excludes ->

def versions = [
androidPlugin : "4.2.2",
androidTools : "30.0.2",
androidTools : "30.3.0",
autovalue : "1.7.4",
avro : "1.10.1",
butterKnife : "10.2.3",
dagger : "2.33",
kotlin : "1.4.10",
kotlin : "1.5.31",
leakCanary : "2.6",
rocker : "1.3.0",
androidx : "1.1.0",
Expand Down Expand Up @@ -88,6 +88,7 @@ def external = [
gson : "com.google.code.gson:gson:2.8.6",
kotlinExtension : "org.jetbrains.kotlin:kotlin-android-extensions:${versions.kotlin}",
kotlinStdlib : "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}",
kotlinMetadata : "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.3.0",
leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}",
sqldelight : "com.squareup.sqldelight:android-driver:${versions.sqldelight}",
rxandroid : "io.reactivex.rxjava2:rxandroid:2.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void transform(TransformInvocation transformInvocation)

File inputFile = changedInput.getKey();
File outputFile =
new File(outputDir, FileUtils.relativePossiblyNonExistingPath(inputFile, inputDir));
new File(outputDir, relativePossiblyNonExistingPath(inputFile, inputDir));

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

File outputFile = new File(outputDir, FileUtils.relativePath(inputFile, inputDir));
File outputFile = new File(outputDir, relativePath(inputFile, inputDir));
FileUtils.copyFile(inputFile, outputFile);
}
}
}
}
}

private static String relativePath(File file, File dir) {
return relativePossiblyNonExistingPath(file, dir);
}

private static String relativePossiblyNonExistingPath(File file, File dir) {
String path = dir.toURI().relativize(file.toURI()).getPath();
return toSystemDependentPath(path);
}

private static String toSystemDependentPath(String path) {
if (File.separatorChar != '/') {
path = path.replace('/', File.separatorChar);
}
return path;
}
}
9 changes: 8 additions & 1 deletion kotlin-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply plugin: "com.android.application"
apply plugin: "com.squareup.sqldelight"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"

android {
Expand All @@ -13,6 +12,14 @@ android {
}

flavorDimensions "default"

lintOptions {
// Turn off Dagger lints
disable "JvmStaticProvidesInObjectDetector"
disable "FieldSiteTargetOnQualifierAnnotation"
disable "ModuleCompanionObjects"
disable "ModuleCompanionObjectsNotInModuleParent"
}
}

tasks.withType(KotlinCompile).all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ package com.uber.okbuck.example

import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.widget.Toolbar
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.uber.okbuck.example.sqldelightmodel.GithubRepo
import dagger.android.support.DaggerAppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import javax.inject.Inject

class MainActivity : DaggerAppCompatActivity() {

@Inject
lateinit var analytics: Analytics

private val fab by lazy { findViewById<FloatingActionButton>(R.id.fab) }
private val toolbar by lazy { findViewById<Toolbar>(R.id.toolbar) }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Expand Down
1 change: 1 addition & 0 deletions libraries/kotlinlibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {

implementation deps.external.kotlinStdlib
implementation deps.external.dagger
implementation deps.external.kotlinMetadata
kapt deps.apt.daggerCompiler
kaptTest deps.apt.daggerCompiler
testImplementation deps.test.junit
Expand Down
2 changes: 1 addition & 1 deletion manifest-merger-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ evaluationDependsOn(pluginProjectPath)
apply plugin: "application"

group = "com.uber.okbuck.transform"
version = "1.0.0"
version = "1.0.1"

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private static int process(String[] args) throws FileNotFoundException {
"Invalid property name "
+ value.substring(0, value.indexOf('='))
+ ", allowed properties are : "
+ Joiner.on(',').join(ManifestSystemProperty.values()));
+ Joiner.on(',').join(ManifestSystemProperty.getValues()));
return 1;
}
}
Expand Down Expand Up @@ -184,7 +184,7 @@ private static void usage() {
System.out.println("\t--libs [path separated list of lib's manifests]");
System.out.println("\t--overlays [path separated list of overlay's manifests]");
System.out.println(
"\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.values()) + "=value]");
"\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.getValues()) + "=value]");
System.out.println("\t--placeholder [name=value]");
System.out.println("\t--out [path of the output file]");
}
Expand Down

0 comments on commit 8b7ef45

Please sign in to comment.