Skip to content

Commit

Permalink
fix npe的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
查郁 committed Jul 5, 2019
1 parent 3709a8e commit 94a206e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion atlas-gradle-plugin/atlas-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,5 @@ jar {
}


version = '3.0.1-rc88'
version = '3.0.1-rc88-fix2'

Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ public class AtlasProguardTransform extends ProGuardTransform {
private List<File> nonConsumerProguardFiles = new ArrayList<>();

private File proguardOut;
private List configList;

private ConfigurableFileCollection oldConfigurableFileCollection;

@Override
public Set<ContentType> getOutputTypes() {
Expand Down Expand Up @@ -333,7 +334,7 @@ public boolean isCacheable() {
@Override
public void transform(TransformInvocation invocation) throws TransformException {
firstTime = true;
ConfigurableFileCollection oldConfigurableFileCollection = (ConfigurableFileCollection) ReflectUtils.getField(ProguardConfigurable.class, oldTransform,
oldConfigurableFileCollection = (ConfigurableFileCollection) ReflectUtils.getField(ProguardConfigurable.class, oldTransform,
"configurationFiles");

//原本官方支持consumerproguardFiles,但是在手淘环境下,业务方胡乱配置优化参数,会导致各种问题,所以在fastprogaurd情况下,我们认为consumerproguardfiles无效,只能在app工程下统一配置proguard
Expand Down Expand Up @@ -498,10 +499,10 @@ private void doMinification(
mkdirs(proguardOut);


for (Object configFile : configList) {
for (File file:(Collection<File>)((Supplier)configFile).get()){
applyConfigurationFile(file);
}
for (File configFile : oldConfigurableFileCollection.getFiles()) {
// for (File file:(Collection<File>)((Supplier)configFile).get()){
applyConfigurationFile(configFile);
// }
}

configuration.printMapping = printMapping;
Expand Down Expand Up @@ -721,11 +722,11 @@ private void transformInput(Input input) {
@Override
public void applyConfigurationFile(File file) throws IOException, ParseException {
//appVariantContext.getVariantConfiguration().getProguardFiles(false, new ArrayList<>());
if (buildConfig.isLibraryProguardKeepOnly() && !nonConsumerProguardFiles.contains(file)) {
appVariantContext.getProject().getLogger().info("applyConfigurationFile keep only :" + file);
applyLibConfigurationFile(file);
return;
}
// if (buildConfig.isLibraryProguardKeepOnly() && !nonConsumerProguardFiles.contains(file)) {
// appVariantContext.getProject().getLogger().info("applyConfigurationFile keep only :" + file);
// applyLibConfigurationFile(file);
// return;
// }
appVariantContext.getProject().getLogger().info("applyConfigurationFile :" + file);
super.applyConfigurationFile(file);
}
Expand Down

0 comments on commit 94a206e

Please sign in to comment.