MCPcopy Index your code
hub / github.com/actions/setup-java / generateToolchainDefinition

Function generateToolchainDefinition

src/toolchains.ts:79–133  ·  view source on GitHub ↗
(
  original: string,
  version: string,
  vendor: string,
  id: string,
  jdkHome: string
)

Source from the content-addressed store, hash-verified

77
78// only exported for testing purposes
79export function generateToolchainDefinition(
80 original: string,
81 version: string,
82 vendor: string,
83 id: string,
84 jdkHome: string
85) {
86 let xmlObj;
87 if (original?.length) {
88 xmlObj = xmlCreate(original)
89 .root()
90 .ele({
91 toolchain: {
92 type: 'jdk',
93 provides: {
94 version: `${version}`,
95 vendor: `${vendor}`,
96 id: `${id}`
97 },
98 configuration: {
99 jdkHome: `${jdkHome}`
100 }
101 }
102 });
103 } else
104 xmlObj = xmlCreate({
105 toolchains: {
106 '@xmlns': 'http://maven.apache.org/TOOLCHAINS/1.1.0',
107 '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
108 '@xsi:schemaLocation':
109 'http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd',
110 toolchain: [
111 {
112 type: 'jdk',
113 provides: {
114 version: `${version}`,
115 vendor: `${vendor}`,
116 id: `${id}`
117 },
118 configuration: {
119 jdkHome: `${jdkHome}`
120 }
121 }
122 ]
123 }
124 });
125
126 return xmlObj.end({
127 format: 'xml',
128 wellFormed: false,
129 headless: false,
130 prettyPrint: true,
131 width: 80
132 });
133}
134
135async function readExistingToolchainsFile(directory: string) {
136 const location = path.join(directory, constants.MVN_TOOLCHAINS_FILE);

Callers 1

createToolchainsSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected