Merge "Upgrade kotlinx metadata to 0.0.3"
diff --git a/LIBRARY-LICENSE b/LIBRARY-LICENSE
index bc69c40..889b9ad 100644
--- a/LIBRARY-LICENSE
+++ b/LIBRARY-LICENSE
@@ -54,6 +54,12 @@
   license: The Apache License, Version 2.0
   licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
   url: https://kotlinlang.org/
+- artifact: org.jetbrains.kotlin:kotlin-stdlib-common:+
+  name: org.jetbrains.kotlin:kotlin-stdlib
+  copyrightHolder: JetBrains s.r.o.
+  license: The Apache License, Version 2.0
+  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
+  url: https://kotlinlang.org/
 - artifact: org.jetbrains.kotlinx:kotlinx-metadata-jvm:+
   name: org.jetbrains.kotlinx:kotlinx-metadata-jvm
   copyrightHolder: JetBrains s.r.o.
diff --git a/build.gradle b/build.gradle
index dd401d6..ac3725c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,7 +19,7 @@
     gsonVersion = '2.7'
     junitVersion = '4.12'
     kotlinVersion = '1.2.30'
-    kotlinExtMetadataJVMVersion = '0.0.2'
+    kotlinExtMetadataJVMVersion = '0.0.3'
     protobufVersion = '3.0.0'
     smaliVersion = '2.2b4'
 }
@@ -67,7 +67,7 @@
     dependencies {
         classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.1'
         classpath 'com.cookpad.android.licensetools:license-tools-plugin:0.23.0'
-        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.3'
+        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
         classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
         classpath "net.ltgt.gradle:gradle-apt-plugin:0.12"
         classpath "com.gradle:build-scan-plugin:1.14"
@@ -501,6 +501,12 @@
 }
 
 static configureRelocations(ShadowJar task) {
+    // Everything under META-INF is not included by default.
+    // Should include before 'relocate' so that the service file path and its content
+    // are properly relocated as well.
+    task.mergeServiceFiles {
+        include 'META-INF/services/*'
+    }
     task.relocate('com.google.common', 'com.android.tools.r8.com.google.common')
     task.relocate('com.google.gson', 'com.android.tools.r8.com.google.gson')
     task.relocate('com.google.thirdparty', 'com.android.tools.r8.com.google.thirdparty')
@@ -518,6 +524,7 @@
     configurations = [project.configurations.compile]
     configureRelocations(it)
     exclude { it.getRelativePath().getPathString() == "module-info.class" }
+    exclude { it.getRelativePath().getPathString().startsWith("META-INF/maven/") }
     baseName 'deps'
 }
 
@@ -529,9 +536,6 @@
 
 task R8(type: ShadowJar) {
     from consolidatedLicense.outputs.files
-    exclude { path ->
-      path.getRelativePath().getPathString().startsWith("META-INF")
-    }
     baseName 'r8'
     classifier = null
     version = null