feat(ir): add typed builder for JavaToolInstaller@0#1125
Merged
Conversation
Adds a typed source-dispatch builder struct for `JavaToolInstaller@0`. The JDK source is modeled as a `JdkSource` enum with three variants (`PreInstalled`, `LocalDirectory`, `AzureStorage`) so required per-source inputs are positional and inapplicable inputs are unrepresentable. `JdkArchitecture` (X64, X86, Arm64) encodes the architecture token. Convenience constructors (`pre_installed`, `local_directory`, `azure_storage`) mirror the command-dispatch pattern established by `Docker` (the canonical template). Includes 8 unit tests covering all three sources, optional-input absence, architecture tokens, and display name override. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a typed source-dispatch builder struct for
JavaToolInstaller@0to the ado-aw IR.Motivation
Previously, any code needing to emit a
JavaToolInstaller@0step had to hand-craftTaskStep::new(...)with raw string input keys. This PR introduces a typed builder that models the three JDK source modes (PreInstalled,LocalDirectory,AzureStorage) as an enum — required per-source inputs become positional parameters and inputs that don't apply to a given source are unrepresentable at compile time.This complements the existing
Gradle@3andMaven@3builders: Java-based pipelines can now install the JDK, build, and test entirely through typed IR.Changes
src/compile/ir/tasks/java_tool_installer.rs: newJavaToolInstallerbuilder struct with:JdkSourceenum (PreInstalled,LocalDirectory(LocalDirectorySpec),AzureStorage(AzureStorageSpec)) — source-dispatch pattern modelled onDocker(canonical template)JdkArchitectureenum (X64,X86,Arm64) withas_ado_str()LocalDirectorySpecandAzureStorageSpecper-source structs with required positional inputs and typed optional setterspre_installed,local_directory,azure_storage#[cfg(test)] mod testsunit tests covering all three sources, optional-input absence, architecture tokens, and display name overridesrc/compile/ir/tasks/mod.rs:pub mod java_tool_installer;declaration (alphabetical order)ADO Task Reference
JavaToolInstaller@0versionSpec,jdkArchitectureOption,jdkSourceOptionLocalDirectory:jdkFile,jdkDestinationDirectoryAzureStorage:azureStorageAccountName,azureContainerName,azureCommonVirtualFile,jdkDestinationDirectorycleanDestinationDirectory,createExtractDirectory(both sources),azureResourceGroupName(AzureStorage only)Validation
cargo build --all-targetscargo testcargo clippy --all-targets --all-features --workspace -- -D warningsCreated by the ado-task-ir-contributor workflow.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.