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

gradle 中配置javaCompileOptions的建议 #874

Closed
xiaoxincoder opened this issue Nov 22, 2020 · 1 comment
Closed

gradle 中配置javaCompileOptions的建议 #874

xiaoxincoder opened this issue Nov 22, 2020 · 1 comment

Comments

@xiaoxincoder
Copy link

每次创建一个module时都要在gradle中配置javaCompileOptions, 有的时候忘记了就有需要编译一次, 建议将这个配置去掉, 在 arouter-compiler 中 自动获取 moduleName:

private String obtainModuleName() {
        String moduleName = "";
        try {
            FileObject resource = filer.createResource(StandardLocation.CLASS_OUTPUT,
                    "", "tempFile.txt");
            String tempFilePath = resource.toUri().toString();

            File tempFile = new File(tempFilePath);
            String tempFileSimpleName = "";
            do {
                tempFile = tempFile.getParentFile();
                tempFileSimpleName = tempFile.getName();
            } while (!ProcessorUtils.equals(tempFileSimpleName, "build"));
            moduleName = tempFile.getParentFile().getName();
            resource.delete();
        } catch (IOException e) {
            e.printStackTrace();
            warning("动态获取module名称失败!!");
        }
        return moduleName;
    }

希望能够采纳这个建议!!

@zhi1ong
Copy link
Member

zhi1ong commented Dec 4, 2020

当然不行,这么搞太不稳定了。

@zhi1ong zhi1ong closed this as completed Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants