Last active
October 3, 2025 15:42
-
-
Save jprinet/c838afbc5a6565e168914282ad92d7ca to your computer and use it in GitHub Desktop.
Make gwt-maven-plugin cacheable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log.debug('Evaluating custom Develocity logic') | |
| buildCache.registerMojoMetadataProvider(context -> { | |
| context.withPlugin("gwt-maven-plugin", () -> { | |
| if ("compile".equals(context.getMojoExecution().getGoal())) { | |
| log.debug('Configuring GWT caching') | |
| context.inputs(inputs -> { | |
| try { | |
| List<String> compileClasspathElements = context.getProject().getCompileClasspathElements(); | |
| log.debug("GWT compile classpath elements:") | |
| log.debug(compileClasspathElements.toString()) | |
| inputs.fileSet("gwtCompileClasspath", compileClasspathElements, fileSet -> fileSet.normalizationStrategy(com.gradle.develocity.agent.maven.adapters.MojoMetadataProviderAdapter.Context.FileSet.NormalizationStrategy.CLASSPATH)); | |
| } catch (Exception e) { | |
| throw new IllegalStateException("Classpath can't be resolved"); | |
| } | |
| inputs | |
| .fileSet("warSourceDirectory", fileSet -> fileSet.normalizationStrategy(com.gradle.develocity.agent.maven.adapters.MojoMetadataProviderAdapter.Context.FileSet.NormalizationStrategy.RELATIVE_PATH)) | |
| .properties("skip", "force", "checkAssertions", "disableClassMetadata", "disableCastChecking", "disableRunAsync", "validateOnly", "draftCompile", "extraParam", "compileReport", "optimizationLevel", "detailedSoyc", "failOnError", "closureCompiler", "closureFormattedOutput", "compilerMetrics", "fragmentCount", "clusterFunctions", "inlineLiteralParameters", "optimizeDataflow", "generateJsInteropExports", "ordinalizeEnums", "removeDuplicateFunctions", "saveSource", "sourceLevel", "namespace", "overlappingSourceWarnings", "enableJsonSoyc", "incremental", "methodNameDisplayMode", "compilerArgs", "genParam", "logLevel", "style", "deploy", "extraJvmArgs", "jvm", "compileSourcesArtifacts", "persistentunitcache", "persistentunitcachedir", "modules", "module", "modulePathPrefix", "inplace", "gwtSdkFirstInClasspath", "disableAggressiveOptimization", "enableAssertions", "enableClosureCompiler", "soycDetailed", "strict", "treeLogger", "version") | |
| .ignore("localWorkers", "workdir", "printJavaCommandOnError", "coverage", "timeOut", "pluginArtifactMap", "localRepository", "remoteRepositories", "project", "session", "pluginArtifacts", "workDir") | |
| }); | |
| context.outputs(outputs -> { | |
| outputs.cacheable("this plugin has CPU-bound goals with well-defined inputs and outputs"); | |
| outputs.directory("extra"); | |
| outputs.directory("gen"); | |
| outputs.directory("saveSourceOutput") | |
| outputs.directory("generateDirectory") | |
| outputs.directory("webappDirectory") | |
| }); | |
| } | |
| }); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment