Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incrementalLint invalidate for def inputFiles = Util.getAllInputs(project) #5

Closed
pick618 opened this issue Aug 6, 2018 · 8 comments
Labels
question Further information is requested

Comments

@pick618
Copy link

pick618 commented Aug 6, 2018

def inputFiles = Util.getAllInputs(project) //where change file?

    project.task(getTaskName(flavor, buildType), type: OkLint) {
        dependsOn getOriginTaskName(flavor, buildType)
        inputs.files(inputFiles)
        outputs.file(outputFile)

        setGroup("verification")
        if (flavor.length() <= 0 && buildType.length() <= 0) {
            setDescription("Run lint incremental for all variants")
        } else {
            setDescription("Run lint incremental for $flavor$buildType build.")
        }
    }

    String originTaskName = getOriginTaskName(flavor, buildType)//lint
    Set<Task> originTasks = project.getTasksByName(originTaskName, false)
    Task originTask = null
    if (originTasks != null && originTasks.size() > 0) originTask = originTasks[0]
    if (originTask == null) {
        project.tasks.whenTaskAdded { task ->
            if (task.name == originTaskName) {
                if (incrementalLint) addIncrementalAndReport(project, task, inputFiles, outputFile)
            }
        }
    } else {
        if (incrementalLint) addIncrementalAndReport(project, originTask, inputFiles, outputFile) //where change file?
    }
@pick618 pick618 closed this as completed Aug 6, 2018
@pick618 pick618 reopened this Aug 6, 2018
@pick618
Copy link
Author

pick618 commented Aug 6, 2018

代码只是查找变化的文件对应的modulename,没有处理单独的文件呀

@Jacksgong
Copy link
Collaborator

是的,因为其中的lint以及unit-test之类的,本身就需要依赖编译结果与依赖;而checkstylepmd等代码扫描本身就很快,再大的工程基本都是10s级别,这块做差分意义不是很大;因此这边暂时只做到module级别。

@Jacksgong Jacksgong added the question Further information is requested label Aug 6, 2018
@Jacksgong
Copy link
Collaborator

如果你有什么更好的建议,欢迎PR或者issue。

@pick618
Copy link
Author

pick618 commented Aug 6, 2018

嗯,我用gradle3.1.3的,3.1.0前后的jar包内容就不一样了,去除了LintGradleClient 等文件,采用ReflectiveLintRunner 反射LintGradleExecution 生成,LintGradleExecution 反射生成lintrequest LintGradleClient 实例,但是找不到这个的源码在哪里,想通过反射修改project request subset(files) 都没办法

@Jacksgong
Copy link
Collaborator

@pick618 不明觉厉,不过说实话如果想用反射等方式做比较强的定制,兼容这块会是一个深坑。。

@pick618
Copy link
Author

pick618 commented Aug 6, 2018

是啊,gradle 和studio 一直在升级,请教下你这边有尝试过用gradle3.1.3 做增量文件升级吗,非常感谢

@Jacksgong
Copy link
Collaborator

不好意思哈,没有研究过这块。

@pick618
Copy link
Author

pick618 commented Aug 6, 2018

boolean isOnThisModule(String fileRelativePath) {//判断文件是否在module中
return fileRelativePath.startsWith(this.relativePath)
}

这个地方是否有bug,如果有android library执行:app:okcheckDebug ,库module 的相对路劲会以../ 开头..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants