Merge changes from topic "dp2_ffwd" into pi-preview1-androidx-dev
* changes:
DO NOT MERGE Partial revert of "Fix breakages in SDK drop"
Merge remote-tracking branch 'goog/pi-androidx-dev' into merge_for_io
diff --git a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
index a284aeb..e590862 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
@@ -92,5 +92,5 @@
/**
* Version code for Jetifier
*/
- val JETIFIER = Version("1.0.0-alpha02")
+ val JETIFIER = Version("1.0.0-alpha03")
}
diff --git a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/TypeRewriter.kt b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/TypeRewriter.kt
index 9f85d38..151cff7 100644
--- a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/TypeRewriter.kt
+++ b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/TypeRewriter.kt
@@ -58,7 +58,6 @@
return rulesResult
}
- Log.e(TAG, "No mapping for: " + type)
return null
}
diff --git a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/Log.kt b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/Log.kt
index fa558c5..2116d9e 100644
--- a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/Log.kt
+++ b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/Log.kt
@@ -26,9 +26,9 @@
currentLevel = when (level) {
"info" -> LogLevel.INFO
"error" -> LogLevel.ERROR
- "debug" -> LogLevel.DEBUG
+ "warning" -> LogLevel.WARNING
"verbose" -> LogLevel.VERBOSE
- else -> LogLevel.ERROR
+ else -> LogLevel.WARNING
}
}
@@ -38,9 +38,9 @@
}
}
- fun d(tag: String, message: String, vararg args: Any?) {
- if (currentLevel >= LogLevel.DEBUG) {
- logConsumer.debug("[$tag] $message".format(*args))
+ fun w(tag: String, message: String, vararg args: Any?) {
+ if (currentLevel >= LogLevel.WARNING) {
+ logConsumer.warning("[$tag] $message".format(*args))
}
}
diff --git a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogConsumer.kt b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogConsumer.kt
index 0489274..e56558e 100644
--- a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogConsumer.kt
+++ b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogConsumer.kt
@@ -23,10 +23,10 @@
fun error(message: String)
+ fun warning(message: String)
+
fun info(message: String)
fun verbose(message: String)
-
- fun debug(message: String)
}
diff --git a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogLevel.kt b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogLevel.kt
index 3017304..053e77a 100644
--- a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogLevel.kt
+++ b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/LogLevel.kt
@@ -18,7 +18,8 @@
enum class LogLevel(val priority: Int) {
ERROR(0),
- INFO(1),
- VERBOSE(2),
- DEBUG(3),
+ WARNING(1),
+ INFO(2),
+ VERBOSE(3),
+ DEBUG(4),
}
\ No newline at end of file
diff --git a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/StdOutLogConsumer.kt b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/StdOutLogConsumer.kt
index f63cb32..41063ee 100644
--- a/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/StdOutLogConsumer.kt
+++ b/jetifier/jetifier/core/src/main/kotlin/com/android/tools/build/jetifier/core/utils/StdOutLogConsumer.kt
@@ -25,6 +25,10 @@
println("ERROR: $message")
}
+ override fun warning(message: String) {
+ println("WARNING: $message")
+ }
+
override fun info(message: String) {
println("INFO: $message")
}
@@ -32,8 +36,4 @@
override fun verbose(message: String) {
println("VERBOSE: $message")
}
-
- override fun debug(message: String) {
- println("DEBUG: $message")
- }
}
\ No newline at end of file
diff --git a/jetifier/jetifier/core/src/main/resources/default.config b/jetifier/jetifier/core/src/main/resources/default.config
index e723ec9..f8dc220 100644
--- a/jetifier/jetifier/core/src/main/resources/default.config
+++ b/jetifier/jetifier/core/src/main/resources/default.config
@@ -38,6 +38,10 @@
"to": "ignore"
},
{
+ "from": "android/support/wearable/(.*)", # To ignore warnings
+ "to": "ignore"
+ },
+ {
"from": "android/support/exifinterface/test/R(.*)",
"to": "ignore"
},
@@ -1282,70 +1286,70 @@
"from": { "groupId": "com.android.support.constraint", "artifactId": "constraint-layout-solver", "version": "1.1.0" },
"to": [{ "groupId": "androidx.constraintlayout", "artifactId": "constraintlayout-solver", "version": "1.1.0" }]
},
- {
- "from": { "groupId": "com.android.support.test", "artifactId": "exposed-instrumentation-api-publish", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test-exposed-instrumentation-api-publish", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test", "artifactId": "orchestrator", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test-orchestrator", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test", "artifactId": "rules", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test-rules", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test", "artifactId": "runner", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test-runner", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test", "artifactId": "testing-support-lib", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-accessibility", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-accessibility", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-contrib", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-contrib", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-core", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-core", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-idling-resource", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-idling-resource", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-intents", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-intents", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-web", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-web", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso.idling", "artifactId": "idling-concurrent", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso.idling", "artifactId": "idling-concurrent", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.espresso.idling", "artifactId": "idling-net", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.espresso.idling", "artifactId": "idling-net", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.janktesthelper", "artifactId": "janktesthelper-v23", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.jank", "artifactId": "jank", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.services", "artifactId": "test-services", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test", "artifactId": "test-services", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support.test.uiautomator", "artifactId": "uiautomator-v18", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.test.uiautomator", "artifactId": "uiautomator", "version": "{slVersion}" }]
- },
+ #{
+ # "from": { "groupId": "com.android.support.test", "artifactId": "exposed-instrumentation-api-publish", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test-exposed-instrumentation-api-publish", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test", "artifactId": "orchestrator", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test-orchestrator", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test", "artifactId": "rules", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test-rules", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test", "artifactId": "runner", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test-runner", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test", "artifactId": "testing-support-lib", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-accessibility", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-accessibility", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-contrib", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-contrib", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-core", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-core", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-idling-resource", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-idling-resource", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-intents", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-intents", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso", "artifactId": "espresso-web", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso", "artifactId": "espresso-web", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso.idling", "artifactId": "idling-concurrent", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso.idling", "artifactId": "idling-concurrent", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.espresso.idling", "artifactId": "idling-net", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.espresso.idling", "artifactId": "idling-net", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.janktesthelper", "artifactId": "janktesthelper-v23", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.jank", "artifactId": "jank", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.services", "artifactId": "test-services", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test", "artifactId": "test-services", "version": "{slVersion}" }]
+ #},
+ #{
+ # "from": { "groupId": "com.android.support.test.uiautomator", "artifactId": "uiautomator-v18", "version": "28.0.0" },
+ # "to": [{ "groupId": "androidx.test.uiautomator", "artifactId": "uiautomator", "version": "{slVersion}" }]
+ #},
{
"from": { "groupId": "com.android.support", "artifactId": "car", "version": "28.0.0" },
"to": [{ "groupId": "androidx.car", "artifactId": "car", "version": "{slVersion}" }]
@@ -1373,22 +1377,6 @@
{
"from": { "groupId": "com.android.support", "artifactId": "webkit", "version": "28.0.0" },
"to": [{ "groupId": "androidx.webkit", "artifactId": "webkit", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support", "artifactId": "palette-ktx", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.palette", "artifactId": "palette-ktx", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support", "artifactId": "fragment-ktx", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.fragment", "artifactId": "fragment-ktx", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support", "artifactId": "core-ktx", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.core", "artifactId": "core-ktx", "version": "{slVersion}" }]
- },
- {
- "from": { "groupId": "com.android.support", "artifactId": "collection-ktx", "version": "28.0.0" },
- "to": [{ "groupId": "androidx.collection", "artifactId": "collection-ktx", "version": "{slVersion}" }]
}
],
"map": {
diff --git a/jetifier/jetifier/core/src/main/resources/default.generated.config b/jetifier/jetifier/core/src/main/resources/default.generated.config
index 8eb2e8b..925d5d4 100644
--- a/jetifier/jetifier/core/src/main/resources/default.generated.config
+++ b/jetifier/jetifier/core/src/main/resources/default.generated.config
@@ -40,6 +40,10 @@
"to": "ignore"
},
{
+ "from": "android/support/wearable/(.*)",
+ "to": "ignore"
+ },
+ {
"from": "android/support/exifinterface/test/R(.*)",
"to": "ignore"
},
@@ -2047,230 +2051,6 @@
},
{
"from": {
- "groupId": "com.android.support.test",
- "artifactId": "exposed-instrumentation-api-publish",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test-exposed-instrumentation-api-publish",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test",
- "artifactId": "orchestrator",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test-orchestrator",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test",
- "artifactId": "rules",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test-rules",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test",
- "artifactId": "runner",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test-runner",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test",
- "artifactId": "testing-support-lib",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-accessibility",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-accessibility",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-contrib",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-contrib",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-core",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-core",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-idling-resource",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-idling-resource",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-intents",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-intents",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso",
- "artifactId": "espresso-web",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso",
- "artifactId": "espresso-web",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso.idling",
- "artifactId": "idling-concurrent",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso.idling",
- "artifactId": "idling-concurrent",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.espresso.idling",
- "artifactId": "idling-net",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.espresso.idling",
- "artifactId": "idling-net",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.janktesthelper",
- "artifactId": "janktesthelper-v23",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.jank",
- "artifactId": "jank",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.services",
- "artifactId": "test-services",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test",
- "artifactId": "test-services",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support.test.uiautomator",
- "artifactId": "uiautomator-v18",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.test.uiautomator",
- "artifactId": "uiautomator",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
"groupId": "com.android.support",
"artifactId": "car",
"version": "28.0.0"
@@ -2366,62 +2146,6 @@
"version": "{slVersion}"
}
]
- },
- {
- "from": {
- "groupId": "com.android.support",
- "artifactId": "palette-ktx",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.palette",
- "artifactId": "palette-ktx",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support",
- "artifactId": "fragment-ktx",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.fragment",
- "artifactId": "fragment-ktx",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support",
- "artifactId": "core-ktx",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.core",
- "artifactId": "core-ktx",
- "version": "{slVersion}"
- }
- ]
- },
- {
- "from": {
- "groupId": "com.android.support",
- "artifactId": "collection-ktx",
- "version": "28.0.0"
- },
- "to": [
- {
- "groupId": "androidx.collection",
- "artifactId": "collection-ktx",
- "version": "{slVersion}"
- }
- ]
}
],
"map": {
diff --git a/jetifier/jetifier/gradle-plugin/src/main/kotlin/com/android/tools/build/jetifier/plugin/gradle/JetifierLoggerAdapter.kt b/jetifier/jetifier/gradle-plugin/src/main/kotlin/com/android/tools/build/jetifier/plugin/gradle/JetifierLoggerAdapter.kt
index a3ee44b..d1be8e5 100644
--- a/jetifier/jetifier/gradle-plugin/src/main/kotlin/com/android/tools/build/jetifier/plugin/gradle/JetifierLoggerAdapter.kt
+++ b/jetifier/jetifier/gradle-plugin/src/main/kotlin/com/android/tools/build/jetifier/plugin/gradle/JetifierLoggerAdapter.kt
@@ -28,6 +28,10 @@
gradleLogger.error(message)
}
+ override fun warning(message: String) {
+ gradleLogger.warn(message)
+ }
+
override fun info(message: String) {
gradleLogger.info(message)
}
@@ -35,8 +39,4 @@
override fun verbose(message: String) {
gradleLogger.info(message)
}
-
- override fun debug(message: String) {
- gradleLogger.debug(message)
- }
}
\ No newline at end of file
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/Processor.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/Processor.kt
index fb146a2..be60497 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/Processor.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/Processor.kt
@@ -153,6 +153,13 @@
libraries.forEach { transformLibrary(it) }
if (context.errorsTotal() > 0) {
+ if (context.isInReversedMode && context.rewritingSupportLib) {
+ throw IllegalArgumentException("There were ${context.errorsTotal()} errors found " +
+ "during the de-jetification. You have probably added new types into " +
+ "support library and dejetifier doesn't know where to move them. Please " +
+ "update default.config and regenerate default.generated.config")
+ }
+
throw IllegalArgumentException("There were ${context.errorsTotal()}" +
" errors found during the remapping. Check the logs for more details.")
}
@@ -261,11 +268,11 @@
val transformer = transformers.firstOrNull { it.canTransform(archiveFile) }
if (transformer == null) {
- Log.d(TAG, "[Skipped] %s", archiveFile.relativePath)
+ Log.v(TAG, "[Skipped] %s", archiveFile.relativePath)
return
}
- Log.d(TAG, "[Applied: %s] %s", transformer.javaClass.simpleName, archiveFile.relativePath)
+ Log.v(TAG, "[Applied: %s] %s", transformer.javaClass.simpleName, archiveFile.relativePath)
transformer.runTransform(archiveFile)
}
}
\ No newline at end of file
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/archive/Archive.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/archive/Archive.kt
index 448eb4d..97ee038 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/archive/Archive.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/archive/Archive.kt
@@ -99,7 +99,7 @@
val out = ZipOutputStream(outputStream)
for (file in files) {
- Log.d(TAG, "Writing file: %s", file.relativePath)
+ Log.v(TAG, "Writing file: %s", file.relativePath)
val entry = ZipEntry(file.relativePath.toString())
out.putNextEntry(entry)
@@ -156,7 +156,7 @@
@Throws(IOException::class)
private fun extractFile(zipIn: ZipInputStream, relativePath: Path): ArchiveFile {
- Log.d(TAG, "Extracting archive: %s", relativePath)
+ Log.v(TAG, "Extracting archive: %s", relativePath)
val data = zipIn.readBytes()
return ArchiveFile(relativePath, data)
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/TransformationContext.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/TransformationContext.kt
index 07ffaa6..70e0356 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/TransformationContext.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/TransformationContext.kt
@@ -19,6 +19,8 @@
import com.android.tools.build.jetifier.core.TypeRewriter
import com.android.tools.build.jetifier.core.config.Config
import com.android.tools.build.jetifier.core.pom.DependencyVersionsMap
+import com.android.tools.build.jetifier.core.type.JavaType
+import com.android.tools.build.jetifier.core.utils.Log
import java.util.regex.Pattern
/**
@@ -67,16 +69,26 @@
* Reports that there was a reference found that satisfies [isEligibleForRewrite] but no
* mapping was found to rewrite it.
*/
- fun reportNoMappingFoundFailure() {
- mappingNotFoundFailuresCount++
+ fun reportNoMappingFoundFailure(tag: String, type: JavaType) {
+ if (!useFallbackIfTypeIsMissing || (rewritingSupportLib && isInReversedMode)) {
+ mappingNotFoundFailuresCount++
+ Log.e(tag, "No mapping for: " + type)
+ } else {
+ Log.w(tag, "No mapping for: " + type)
+ }
}
/**
* Reports that there was a reference found in a ProGuard file that satisfies
* [isEligibleForRewrite] but no mapping was found to rewrite it.
*/
- fun reportNoProGuardMappingFoundFailure() {
- proGuardMappingNotFoundFailuresCount++
+ fun reportNoProGuardMappingFoundFailure(tag: String, type: String) {
+ if (!useFallbackIfTypeIsMissing || (rewritingSupportLib && isInReversedMode)) {
+ proGuardMappingNotFoundFailuresCount++
+ Log.e(tag, "No mapping for: " + type)
+ } else {
+ Log.w(tag, "No mapping for: " + type)
+ }
}
/**
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/bytecode/CoreRemapperImpl.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/bytecode/CoreRemapperImpl.kt
index 37a22da..e3766b6 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/bytecode/CoreRemapperImpl.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/bytecode/CoreRemapperImpl.kt
@@ -51,9 +51,7 @@
return result
}
- if (!context.useFallbackIfTypeIsMissing) {
- context.reportNoMappingFoundFailure()
- }
+ context.reportNoMappingFoundFailure(TAG, type)
return type
}
@@ -107,16 +105,18 @@
val owner = path.toFile().path.replace('\\', '/').removeSuffix(".class")
val type = JavaType(owner)
- val result = rewriteType(type)
+
+ val result = context.typeRewriter.rewriteType(type)
+ if (result == null) {
+ context.reportNoMappingFoundFailure("PathRewrite", type)
+ return path
+ }
+
if (result != type) {
changesDone = true
return path.fileSystem.getPath(result.fullName + ".class")
}
- if (!context.useFallbackIfTypeIsMissing) {
- context.reportNoMappingFoundFailure()
- }
-
return path
}
}
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/pom/PomDocument.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/pom/PomDocument.kt
index 50ba59f..e7e7846 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/pom/PomDocument.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/pom/PomDocument.kt
@@ -189,7 +189,7 @@
fun logDocumentDetails() {
Log.i(TAG, "POM file at: '%s'", file.relativePath)
for ((groupId, artifactId, version) in dependencies) {
- Log.d(TAG, "- Dep: %s:%s:%s", groupId, artifactId, version)
+ Log.v(TAG, "- Dep: %s:%s:%s", groupId, artifactId, version)
}
}
}
\ No newline at end of file
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/proguard/ProGuardTypesMapper.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/proguard/ProGuardTypesMapper.kt
index 9cc261b..b77b168 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/proguard/ProGuardTypesMapper.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/proguard/ProGuardTypesMapper.kt
@@ -48,8 +48,7 @@
return result.toDotNotation()
}
- context.reportNoProGuardMappingFoundFailure()
- Log.e(TAG, "No mapping for: %s", type)
+ context.reportNoProGuardMappingFoundFailure(TAG, javaType.toString())
return typeToReplace
}
@@ -62,8 +61,7 @@
// Report error only when we are sure
if (context.typeRewriter.isEligibleForRewrite(type)) {
- context.reportNoProGuardMappingFoundFailure()
- Log.e(TAG, "No mapping for: " + type)
+ context.reportNoProGuardMappingFoundFailure(TAG, type.toString())
}
return typeToReplace
}
diff --git a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/resource/XmlResourcesTransformer.kt b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/resource/XmlResourcesTransformer.kt
index e6885ca..0f40032 100644
--- a/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/resource/XmlResourcesTransformer.kt
+++ b/jetifier/jetifier/processor/src/main/kotlin/com/android/tools/build/jetifier/processor/transform/resource/XmlResourcesTransformer.kt
@@ -161,10 +161,7 @@
return result.toDotNotation()
}
- if (!context.useFallbackIfTypeIsMissing) {
- context.reportNoMappingFoundFailure()
- }
-
+ context.reportNoMappingFoundFailure(TAG, type)
return typeName
}