Skip to content

Commit

Permalink
Analyze workProcess incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
kissonchan committed Jun 20, 2020
1 parent 1ae855f commit de86d51
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 80 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package com.iqiyi.qigsaw.buildtool.gradle.internal.tool

import com.google.common.collect.ImmutableSet
import com.iqiyi.qigsaw.buildtool.gradle.internal.entity.ComponentInfo

class ManifestReader {

Expand Down Expand Up @@ -76,44 +75,40 @@ class ManifestReader {
return providers.build()
}

Set<ComponentInfo> readActivities() {
ImmutableSet.Builder activities = ImmutableSet.builder()
Set<String> readActivityProcesses() {
Set<String> processes = new HashSet<>()
manifest.application.activity.each {
String name = it.'@android:name'.toString()
String process = it.'@android:process'.toString()
activities.add(new ComponentInfo(name, process))
processes.add(process)
}
return activities.build()
return processes
}

Set<ComponentInfo> readServices() {
ImmutableSet.Builder services = ImmutableSet.builder()
Set<String> readServiceProcesses() {
Set<String> processes = new HashSet<>()
manifest.application.service.each {
String name = it.'@android:name'.toString()
String process = it.'@android:process'.toString()
services.add(new ComponentInfo(name, process))
processes.add(process)
}
return services.build()
return processes
}

Set<ComponentInfo> readReceivers() {
ImmutableSet.Builder receivers = ImmutableSet.builder()
Set<String> readReceiverProcesses() {
Set<String> processes = new HashSet<>()
manifest.application.receiver.each {
String name = it.'@android:name'.toString()
String process = it.'@android:process'.toString()
receivers.add(new ComponentInfo(name, process))
processes.add(process)
}
return receivers.build()
return processes
}

Set<ComponentInfo> readProviders() {
ImmutableSet.Builder providers = ImmutableSet.builder()
Set<String> readProviderProcesses() {
Set<String> processes = new HashSet<>()
manifest.application.provider.each {
String name = it.'@android:name'.toString()
String process = it.'@android:process'.toString()
providers.add(new ComponentInfo(name, process))
processes.add(process)
}
return providers.build()
return processes
}

boolean readOnDemand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ package com.iqiyi.qigsaw.buildtool.gradle.task
import com.android.SdkConstants
import com.android.tools.build.bundletool.model.Aapt2Command
import com.android.tools.build.bundletool.model.AndroidManifest
import com.iqiyi.qigsaw.buildtool.gradle.internal.entity.ComponentInfo
import com.iqiyi.qigsaw.buildtool.gradle.internal.entity.SplitInfo
import com.iqiyi.qigsaw.buildtool.gradle.internal.tool.FileUtils
import com.iqiyi.qigsaw.buildtool.gradle.internal.tool.ManifestReader
Expand Down Expand Up @@ -194,26 +193,24 @@ class ProcessSplitApkTask extends DefaultTask {
}
})
Set<String> splitWorkProcesses = new HashSet<>()
Set<ComponentInfo> activities = manifestReader.readActivities()
activities.each {
splitWorkProcesses.add(it.process)
}
Set<ComponentInfo> services = manifestReader.readServices()
services.each {
splitWorkProcesses.add(it.process)
}
Set<ComponentInfo> receivers = manifestReader.readReceivers()
receivers.each {
splitWorkProcesses.add(it.process)
}
Set<ComponentInfo> providers = manifestReader.readProviders()
providers.each {
splitWorkProcesses.add(it.process)
}
if (restrictWorkProcessesForSplits != null && !restrictWorkProcessesForSplits.empty) {
if (restrictWorkProcessesForSplits.contains(project.name)) {
splitWorkProcesses = splitWorkProcesses.isEmpty() ? null : splitWorkProcesses
Set<String> activityProcesses = manifestReader.readActivityProcesses()
splitWorkProcesses.addAll(activityProcesses)
Set<String> serviceProcesses = manifestReader.readServiceProcesses()
splitWorkProcesses.addAll(serviceProcesses)
Set<String> receiverProcesses = manifestReader.readReceiverProcesses()
splitWorkProcesses.addAll(receiverProcesses)
Set<String> providerProcesses = manifestReader.readProviderProcesses()
splitWorkProcesses.addAll(providerProcesses)

if (restrictWorkProcessesForSplits != null) {
if (!restrictWorkProcessesForSplits.contains(project.name)) {
splitWorkProcesses = null
}
} else {
splitWorkProcesses = null
}
if (splitWorkProcesses != null && splitWorkProcesses.empty) {
splitWorkProcesses = null
}
SplitInfo splitInfo = new SplitInfo()
splitInfo.splitName = project.name
Expand All @@ -224,7 +221,7 @@ class ProcessSplitApkTask extends DefaultTask {
splitInfo.version = splitVersion
splitInfo.applicationName = splitApplicationName == "" ? null : splitApplicationName
splitInfo.dependencies = dependencies.isEmpty() ? null : dependencies
splitInfo.workProcesses = splitWorkProcesses.isEmpty() ? null : splitWorkProcesses
splitInfo.workProcesses = splitWorkProcesses
splitInfo.apkData = apkDataList.isEmpty() ? null : apkDataList
splitInfo.libData = libDataList.isEmpty() ? null : libDataList
return splitInfo
Expand Down

0 comments on commit de86d51

Please sign in to comment.