Skip to content

feat(ir): add typed builder for JavaToolInstaller@0#1125

Merged
jamesadevine merged 1 commit into
mainfrom
feat/ir-java-tool-installer-0d6d127e3cab7ed7
Jun 21, 2026
Merged

feat(ir): add typed builder for JavaToolInstaller@0#1125
jamesadevine merged 1 commit into
mainfrom
feat/ir-java-tool-installer-0d6d127e3cab7ed7

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds a typed source-dispatch builder struct for JavaToolInstaller@0 to the ado-aw IR.

Motivation

Previously, any code needing to emit a JavaToolInstaller@0 step had to hand-craft TaskStep::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@3 and Maven@3 builders: Java-based pipelines can now install the JDK, build, and test entirely through typed IR.

Changes

  • src/compile/ir/tasks/java_tool_installer.rs: new JavaToolInstaller builder struct with:
    • JdkSource enum (PreInstalled, LocalDirectory(LocalDirectorySpec), AzureStorage(AzureStorageSpec)) — source-dispatch pattern modelled on Docker (canonical template)
    • JdkArchitecture enum (X64, X86, Arm64) with as_ado_str()
    • LocalDirectorySpec and AzureStorageSpec per-source structs with required positional inputs and typed optional setters
    • Convenience constructors pre_installed, local_directory, azure_storage
    • 8 #[cfg(test)] mod tests unit tests covering all three sources, optional-input absence, architecture tokens, and display name override
  • src/compile/ir/tasks/mod.rs: pub mod java_tool_installer; declaration (alphabetical order)

ADO Task Reference

  • Task: JavaToolInstaller@0
  • Docs: (https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/java-tool-installer-v0)
  • Required inputs: versionSpec, jdkArchitectureOption, jdkSourceOption
  • Per-source required inputs:
    • LocalDirectory: jdkFile, jdkDestinationDirectory
    • AzureStorage: azureStorageAccountName, azureContainerName, azureCommonVirtualFile, jdkDestinationDirectory
  • Optional inputs: cleanDestinationDirectory, createExtractDirectory (both sources), azureResourceGroupName (AzureStorage only)

Validation

  • cargo build --all-targets
  • cargo test
  • cargo clippy --all-targets --all-features --workspace -- -D warnings

Created 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.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by ADO Task IR Contributor · 822.2 AIC · ⌖ 19.4 AIC · ⊞ 38.1K ·

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>
@jamesadevine jamesadevine marked this pull request as ready for review June 21, 2026 07:37
@jamesadevine jamesadevine merged commit f3ec497 into main Jun 21, 2026
@jamesadevine jamesadevine deleted the feat/ir-java-tool-installer-0d6d127e3cab7ed7 branch June 21, 2026 07:38
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

Successfully merging this pull request may close these issues.

1 participant