Skip to content

Commit

Permalink
解决密码不更新的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hss01248 committed Jun 15, 2021
1 parent c058680 commit 4767255
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public void onGranted(List<String> permissions, boolean all) {
} else {
DebugAccount debugAccount = list.get(0);
debugAccount.usedNum = debugAccount.usedNum + 1;
debugAccount.pw = pw;
debugAccount.updateTime = System.currentTimeMillis();
MyDbUtil.getDaoSession().getDebugAccountDao().update(debugAccount);
}
Expand Down
46 changes: 45 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@



plugins {
id 'com.android.application'
}
Expand Down Expand Up @@ -37,4 +40,45 @@ dependencies {
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
}

project.afterEvaluate {
project.android.applicationVariants.each {variant ->
/*project.tasks.create(name : "showAllDependencies${variant.name.capitalize()}", group : "help", description: "Print all sdk(s) infomation. author:sodino") {
doLast {
showAllDeps(project, variant)
}
}*/
//showAllDeps(project, variant)
}
}

/*
def showAllDeps(def project, def variant) {
def android = project.android
def globalScope = android.globalScope
def gradle = project.gradle
def set = ArtifactUtils.getAllArtifacts(
new VariantScopeImpl(globalScope,
new TransformManager(project,
null,
null),
variant.variantData),
AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
null,
BuildMappingUtils.computeBuildMapping(gradle)
)
println "${variant.name.capitalize()} all dependencies.size=${set.size()}"
set.eachWithIndex {artifact, idx->
def componentIdentifier = artifact.componentIdentifier
if (componentIdentifier.displayName.contains(':')) {
def modulerIdentifier = componentIdentifier.moduleIdentifier
def group = modulerIdentifier.group
def name = modulerIdentifier.name
def version = componentIdentifier.version
println "${idx} : ${componentIdentifier.displayName}"
} else {
println "${idx} -> ${artifact.artifactFile}"
}
}
}*/
83 changes: 82 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

import java.util.function.Consumer

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/master/remote2.gradle'
Expand Down Expand Up @@ -26,4 +29,82 @@ allprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}

gradle.addProjectEvaluationListener(new ProjectEvaluationListener() {
@Override
void beforeEvaluate(Project project) {

}

//https://noproxy.github.io/2019/07/01/gradle-discovery-dependencies.html
@Override
void afterEvaluate(Project project, ProjectState projectState) {
//println("modules------>"+project.dependencies.)
/* Gson gson = new GsonBuilder().serializeNulls().create();
println("modules------>"+gson.toJson(project.dependencies))*/
def configurations = project.configurations;
configurations.forEach(new Consumer<Configuration>() {
@Override
void accept(Configuration files) {
// println(files)

}
})
//println(project.configurations )


Configuration configuration = null;
try {
configuration = project.configurations.getByName("debugCompile");
}catch(Throwable throwable){
throwable.printStackTrace()
}

if(configuration == null){
return
}

/*final DependencySet dependencies = configuration.getIncoming().getDependencies();
final ArtifactCollection artifacts = configuration.getIncoming().getArtifacts();
final Set<? extends DependencyResult> allDependencies = configuration.getIncoming().getResolutionResult().getAllDependencies();
allDependencies.forEach(new Consumer<DependencyResult>() {
@Override
void accept(DependencyResult dependencyResult) {
// 这个依赖为什么被引入。可能是一个project,也可能是另一个依赖
final ResolvedComponentResult from = dependencyResult.getFrom();
// 这个依赖被引入的时候是怎么依赖。
// ModuleComponentSelector: 使用module依赖, compile "xxx:xxx:1.0"
// ProjectComponentSelector: 使用project方式依赖, compile project(':xx')
// LibraryComponentSelector:不知道了
final ComponentSelector requested = dependencyResult.getRequested();
if (requested instanceof ModuleComponentSelector) {
final ModuleComponentSelector module = (ModuleComponentSelector) requested;
module.getGroup();
module.getModule();
module.getVersion();
}
// 解析成功的依赖
if (dependencyResult instanceof ResolvedDependencyResult) {
final ResolvedComponentResult selected = ((ResolvedDependencyResult) dependencyResult).getSelected();
println(selected)
// 如果是 compile "xx:xx:1.+"这种方式依赖
// 这里就可以得到最终版本号
selected.getModuleVersion().getVersion();
} else {// 解析失败的依赖
final UnresolvedDependencyResult failed = (UnresolvedDependencyResult) dependencyResult;
// 在哪个几个maven仓库找过
final ComponentSelector attempted = failed.getAttempted();
final ComponentSelectionReason attemptedReason = failed.getAttemptedReason();
// 找不到的原因
final Throwable failure = failed.getFailure();
}
}
})*/

}
})

0 comments on commit 4767255

Please sign in to comment.