1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| class ArtifactTypeTask extends DefaultTask { def artifactsTypes = [ "", "aar", "processed-aar", "apk", "jar", "aab", "bundle-apks", "zip", "processed-jar", "non-namespaced-aar", "preprocessed-aar-for-auto-namespace", "android-classes", "enumerated-runtime-classes", "android-classes-jar", "android-classes-directory", "android-shared-classes", "android-classes-fixed-frames-jar", "android-dex", "android-dex-and-keep-rules", "android-keep-rules", "android-asm-instrumented-jars", "android-java-res", "android-shared-java-res", "android-manifest", "android-manifest-metadata", "android-res", "android-res-static-library", "android-res-shared-static-library", "android-res-for-bundle", "android-assets", "android-shared-assets", "android-jni", "android-shared-jni", "android-aidl", "android-renderscript", "android-lint", "android-lint-project-global-model", "android-lint-variant-dependencies-model", "android-lint-local-aar", "android-lint-exploded-aar", "android-ext-annot", "android-public-res", "android-symbol", "android-symbol-with-package-name", "android-consumer-proguard-rules", "android-filtered-proguard-rules", "android-aapt-proguard-rules", "android-databinding", "android-databinding-class-log", "android-exploded-aar", "android-aar-or-jar", "aar-class-list-and-res-symbols", "jar-class-list", "android-compiled-dependencies-resources", "android-module-bundle", "android-lib-dependencies", "android-aar-metadata", "android-mapping", "android-metadata", "android-packaged-dependencies", "android-feature-all-metadata", "android-base-module-metadata", "android-feature-res-ap_", "android-feature-dex", "android-feature-signing-config-data", "android-feature-signing-config-versions", "android-feature-name", "android-reverse-metadata-feature-decl", "android-reverse-metadata-feature-manifest", "android-reverse-metadata-classes", "android-reverse-metadata-java-res", "android-reverse-metadata-native-debug-metadata", "android-reverse-metadata-native-symbol-tables", "android-mockable-jar", "android-platform-attr", "android-navigation-json", "android-prefab", "android-desugar-lib-merged-keep-rules" ] @TaskAction void process() { project.file(project.rootDir.path + '/artifact_path.txt').withPrintWriter { for (def artifactType in artifactsTypes) { Configuration configuration = project.getConfigurations().getByName("debugRuntimeClasspath") Action<AttributeContainer> attributes = new Action<AttributeContainer>() { @Override void execute(AttributeContainer container) { if (artifactType != '') { container.attribute(AndroidArtifacts.ARTIFACT_TYPE, artifactType) } } } ArtifactCollection artifacts = configuration.getIncoming() .artifactView(new Action<ArtifactView.ViewConfiguration>() { @Override void execute(ArtifactView.ViewConfiguration viewConfiguration) { viewConfiguration.lenient(true) viewConfiguration.attributes(attributes) } }).getArtifacts() it.write('|----------------------------------------------------------------------\n') it.write("| ${artifactType}\n") it.write('|----------------------------------------------------------------------\n') def files = artifacts.getArtifactFiles().getFiles() if (files == null || files.isEmpty()) { it.write(' | 没有路径\n') } else { for (def file in files) {
it.write(" | ${file.getAbsolutePath()}\n") } } } } } }
|