修复gradle 5.0 apt 失效的问题
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
apply plugin: 'com.novoda.bintray-release'
|
||||
publish {
|
||||
artifactId = 'aria-core'
|
||||
// artifactId = 'aria-core'
|
||||
// uploadName = 'AriaApi'
|
||||
artifactId = 'core'
|
||||
uploadName = 'Core'
|
||||
userOrg = rootProject.ext.userOrg
|
||||
groupId = rootProject.ext.groupId
|
||||
// uploadName = rootProject.uploadName
|
||||
uploadName = 'AriaApi'
|
||||
publishVersion = rootProject.ext.publishVersion
|
||||
desc = rootProject.ext.desc
|
||||
website = rootProject.ext.website
|
||||
|
||||
@@ -20,19 +20,13 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
|
||||
api project(':AriaAnnotations')
|
||||
api project(path: ':PublicComponent')
|
||||
|
||||
// api 'com.arialyy.aria:aria-ftp-plug:1.0.4'
|
||||
implementation project(path: ':HttpComponent') // 打包时用这个
|
||||
|
||||
// compile project(':AriaFtpPlug')
|
||||
// implementation project(path: ':AriaFtpComponent')
|
||||
|
||||
api project(path: ':HttpComponent')
|
||||
}
|
||||
apply from: 'bintray-release.gradle'
|
||||
|
||||
apply from: 'bintray-release.gradle'
|
||||
@@ -18,7 +18,9 @@ package com.arialyy.aria.core.common;
|
||||
import android.text.TextUtils;
|
||||
import com.arialyy.aria.core.FtpUrlEntity;
|
||||
import com.arialyy.aria.core.ProtocolType;
|
||||
import com.arialyy.aria.core.processor.IFtpUploadInterceptor;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CheckUtil;
|
||||
|
||||
/**
|
||||
* Created by laoyuyu on 2018/3/9.
|
||||
@@ -27,9 +29,10 @@ public class FtpOption extends BaseOption {
|
||||
|
||||
private String charSet, userName, password, account;
|
||||
private boolean isNeedLogin = false;
|
||||
private FtpUrlEntity ftpUrlEntity;
|
||||
private FtpUrlEntity urlEntity;
|
||||
private String protocol, keyAlias, storePass, storePath;
|
||||
private boolean isImplicit = true;
|
||||
private IFtpUploadInterceptor uploadInterceptor;
|
||||
|
||||
public FtpOption() {
|
||||
super();
|
||||
@@ -128,19 +131,31 @@ public class FtpOption extends BaseOption {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setFtpUrlEntity(FtpUrlEntity ftpUrlEntity) {
|
||||
this.ftpUrlEntity = ftpUrlEntity;
|
||||
ftpUrlEntity.needLogin = isNeedLogin;
|
||||
ftpUrlEntity.user = userName;
|
||||
ftpUrlEntity.password = password;
|
||||
ftpUrlEntity.account = account;
|
||||
/**
|
||||
* FTP文件上传拦截器,如果远端已有同名文件,可使用该拦截器控制覆盖文件或修改该文件上传到服务器端端文件名
|
||||
*/
|
||||
public FtpOption setUploadInterceptor(IFtpUploadInterceptor uploadInterceptor) {
|
||||
if (uploadInterceptor == null) {
|
||||
throw new NullPointerException("ftp拦截器为空");
|
||||
}
|
||||
CheckUtil.checkMemberClass(uploadInterceptor.getClass());
|
||||
this.uploadInterceptor = uploadInterceptor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setUrlEntity(FtpUrlEntity urlEntity) {
|
||||
this.urlEntity = urlEntity;
|
||||
urlEntity.needLogin = isNeedLogin;
|
||||
urlEntity.user = userName;
|
||||
urlEntity.password = password;
|
||||
urlEntity.account = account;
|
||||
if (!TextUtils.isEmpty(storePath)) {
|
||||
ftpUrlEntity.isFtps = true;
|
||||
ftpUrlEntity.protocol = protocol;
|
||||
ftpUrlEntity.keyAlias = keyAlias;
|
||||
ftpUrlEntity.storePass = storePass;
|
||||
ftpUrlEntity.storePath = storePath;
|
||||
ftpUrlEntity.isImplicit = isImplicit;
|
||||
urlEntity.isFtps = true;
|
||||
urlEntity.protocol = protocol;
|
||||
urlEntity.keyAlias = keyAlias;
|
||||
urlEntity.storePass = storePass;
|
||||
urlEntity.storePath = storePath;
|
||||
urlEntity.isImplicit = isImplicit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,12 @@ package com.arialyy.aria.core.common;
|
||||
import android.text.TextUtils;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.arialyy.aria.core.download.target.HttpBuilderTarget;
|
||||
import com.arialyy.aria.core.inf.IOptionConstant;
|
||||
import com.arialyy.aria.core.inf.Suggest;
|
||||
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CheckUtil;
|
||||
import java.net.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +38,8 @@ public class HttpOption extends BaseOption {
|
||||
private RequestEnum requestEnum = RequestEnum.GET;
|
||||
private Map<String, String> formFields;
|
||||
private Proxy proxy;
|
||||
private boolean useServerFileName = false;
|
||||
private IHttpFileLenAdapter fileLenAdapter;
|
||||
|
||||
public HttpOption() {
|
||||
super();
|
||||
@@ -131,4 +137,27 @@ public class HttpOption extends BaseOption {
|
||||
this.proxy = proxy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用服务器通过content-disposition传递的文件名,内容格式{@code attachment;filename=***}
|
||||
* 如果获取不到服务器文件名,则使用用户设置的文件名
|
||||
*
|
||||
* @param use {@code true} 使用
|
||||
*/
|
||||
public HttpOption useServerFileName(boolean use) {
|
||||
this.useServerFileName = use;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果你需要使用header中特定的key来设置文件长度,或有定制文件长度的需要,那么你可以通过该方法自行处理文件长度
|
||||
*/
|
||||
public HttpOption setFileLenAdapter(IHttpFileLenAdapter fileLenAdapter) {
|
||||
if (fileLenAdapter == null) {
|
||||
throw new IllegalArgumentException("adapter为空");
|
||||
}
|
||||
CheckUtil.checkMemberClass(fileLenAdapter.getClass());
|
||||
this.fileLenAdapter = fileLenAdapter;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.arialyy.aria.core.AriaManager;
|
||||
import com.arialyy.aria.core.command.CancelAllCmd;
|
||||
import com.arialyy.aria.core.command.NormalCmdFactory;
|
||||
import com.arialyy.aria.core.common.AbsBuilderTarget;
|
||||
import com.arialyy.aria.core.common.ErrorCode;
|
||||
import com.arialyy.aria.core.common.ProxyHelper;
|
||||
import com.arialyy.aria.core.download.target.DTargetFactory;
|
||||
import com.arialyy.aria.core.download.target.FtpBuilderTarget;
|
||||
@@ -193,7 +194,7 @@ public class DownloadReceiver extends AbsReceiver {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ALog.w(TAG, "没有Aria的注解方法");
|
||||
ALog.e(TAG, "没有Aria的注解方法");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(mConfigHandler.getUrl()));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(mConfigHandler.getUrl()));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(url));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(url));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class FtpDirNormalTarget extends AbsNormalTarget<FtpDirNormalTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getKey()));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getKey()));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getUrl()));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getUrl()));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,10 @@ import androidx.annotation.CheckResult;
|
||||
import com.arialyy.aria.core.common.AbsBuilderTarget;
|
||||
import com.arialyy.aria.core.common.HttpOption;
|
||||
import com.arialyy.aria.core.download.DGTaskWrapper;
|
||||
import com.arialyy.aria.core.inf.IOptionConstant;
|
||||
import com.arialyy.aria.core.inf.Suggest;
|
||||
import com.arialyy.aria.core.manager.SubTaskManager;
|
||||
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CheckUtil;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -146,18 +143,4 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
|
||||
public GroupBuilderTarget setSubFileName(List<String> subTaskFileName) {
|
||||
return mConfigHandler.setSubFileName(subTaskFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果你需要使用header中特定的key来设置文件长度,或有定制文件长度的需要,那么你可以通过该方法自行处理文件长度
|
||||
*/
|
||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||
public GroupBuilderTarget setFileLenAdapter(IHttpFileLenAdapter adapter) {
|
||||
|
||||
if (adapter == null) {
|
||||
throw new IllegalArgumentException("adapter为空");
|
||||
}
|
||||
CheckUtil.checkMemberClass(adapter.getClass());
|
||||
getTaskWrapper().getOptionParams().setObjs(IOptionConstant.fileLenAdapter, adapter);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,18 +72,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用服务器通过content-disposition传递的文件名,内容格式{@code attachment;filename=***}
|
||||
* 如果获取不到服务器文件名,则使用用户设置的文件名
|
||||
*
|
||||
* @param use {@code true} 使用
|
||||
*/
|
||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||
public HttpBuilderTarget useServerFileName(boolean use) {
|
||||
getTaskWrapper().getOptionParams().setParams(IOptionConstant.useServerFileName, use);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文件存储路径,如果需要修改新的文件名,修改路径便可。
|
||||
* 如:原文件路径 /mnt/sdcard/test.zip
|
||||
@@ -111,17 +99,4 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
||||
mConfigHandler.setForceDownload(forceDownload);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果你需要使用header中特定的key来设置文件长度,或有定制文件长度的需要,那么你可以通过该方法自行处理文件长度
|
||||
*/
|
||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||
public HttpBuilderTarget setFileLenAdapter(IHttpFileLenAdapter adapter) {
|
||||
if (adapter == null) {
|
||||
throw new IllegalArgumentException("adapter为空");
|
||||
}
|
||||
CheckUtil.checkMemberClass(adapter.getClass());
|
||||
getTaskWrapper().getOptionParams().setObjs(IOptionConstant.fileLenAdapter, adapter);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class UploadReceiver extends AbsReceiver {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ALog.i(TAG, "没有Aria的注解方法");
|
||||
ALog.e(TAG, "没有Aria的注解方法");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,10 @@
|
||||
package com.arialyy.aria.core.upload.target;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.arialyy.aria.core.common.AbsBuilderTarget;
|
||||
import com.arialyy.aria.core.common.FtpOption;
|
||||
import com.arialyy.aria.core.inf.Suggest;
|
||||
import com.arialyy.aria.core.processor.IFtpUploadInterceptor;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.util.CheckUtil;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
|
||||
/**
|
||||
@@ -51,15 +48,6 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* FTP文件上传拦截器,如果远端已有同名文件,可使用该拦截器控制覆盖文件或修改该文件上传到服务器端端的文件名
|
||||
*/
|
||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||
public FtpBuilderTarget setUploadInterceptor(@NonNull IFtpUploadInterceptor uploadInterceptor) {
|
||||
CheckUtil.checkMemberClass(uploadInterceptor.getClass());
|
||||
return mConfigHandler.setUploadInterceptor(uploadInterceptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置登陆、字符串编码、ftps等参数
|
||||
*/
|
||||
@@ -68,7 +56,7 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(url));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(url));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
|
||||
if (option == null) {
|
||||
throw new NullPointerException("ftp 任务配置为空");
|
||||
}
|
||||
option.setFtpUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getUrl()));
|
||||
option.setUrlEntity(CommonUtil.getFtpUrlInfo(getEntity().getUrl()));
|
||||
getTaskWrapper().getOptionParams().setParams(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -62,15 +62,6 @@ class UNormalConfigHandler<TARGET extends AbsTarget> implements IConfigHandler {
|
||||
mEntity.setFileSize(file.length());
|
||||
}
|
||||
|
||||
TARGET setUploadInterceptor(IFtpUploadInterceptor uploadInterceptor) {
|
||||
if (uploadInterceptor == null) {
|
||||
throw new NullPointerException("ftp拦截器为空");
|
||||
}
|
||||
getTaskWrapper().getOptionParams()
|
||||
.setObjs(IOptionConstant.uploadInterceptor, uploadInterceptor);
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
@Override public AbsEntity getEntity() {
|
||||
return mEntity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user