以ä¸ã®ãã©ã°ã¤ã³ã使ã£ã¦ããåæã§æ¸ãã¾ãã
ããã§ãã ããã§ã¯ãã¾ãåããªãã®ã§è¿½è¨ãåç
§
tasks.withType(JavaCompile).configureEach { options.errorprone { // error-proneã®suggested fixesãé©ç¨ãã // usage: ./gradlew compileJava compileTestJava -PerrorProneApply if (project.hasProperty("errorProneApply")) { errorproneArgs.addAll("-XepPatchLocation:IN_PLACE") } } }
2024/10/16è¿½è¨ åããªãã±ã¼ã¹ããã£ãã®ã§ç´ãã
ä¸ã ã¨ãã¾ãåããªãã±ã¼ã¹ããã£ãã®ã§ããããã ããã¡ãã£ã¨æ¥½ãªæ¹æ³ããã£ããæãã¦ä¸ããã
ext { errorProneApply = project.hasProperty("errorProneApply") } tasks.register('errorProneApply').configure { errorProneApply = true // error-proneã¯ã³ã³ãã¤ã«æã«åãã®ã§cleanã®å¾ã«å®è¡ãã dependsOn('clean', tasks.withType(JavaCompile)) } class ErrorProneApply implements CommandLineArgumentProvider { private final Project project ErrorProneApply(Project project) { this.project = project } @Override Iterable<String> asArguments() { if (!project.hasProperty("errorProneApply") || !project.property("errorProneApply")) { return [] } return ["-XepPatchLocation:IN_PLACE"] } } tasks.withType(JavaCompile).configureEach { options.errorprone { // custom taskã§propertyã®ä¸æ¸ããããããã«ãerrorproneArgumentProvidersã追å ãã errorproneArgumentProviders.add(new ErrorProneApply(project)) } }
çµããã調ã¹ã¦ãåºã¦ããã®ã§ãã¡ã¢ç¨åº¦ã«æ¸ãã¦ãããã