2929
3030package org.opensearch.gradle.internal
3131
32+ import org.opensearch.gradle.Architecture
3233import org.opensearch.gradle.VersionProperties
3334import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
3435import org.gradle.testkit.runner.GradleRunner
@@ -59,7 +60,8 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
5960 def " resolves current version from local build" () {
6061 given :
6162 internalBuild()
62- localDistroSetup()
63+ def archive = archiveTask()
64+ localDistroSetup(archive)
6365 def distroVersion = VersionProperties . getOpenSearch()
6466 buildFile << """
6567 apply plugin: 'opensearch.internal-distribution-download'
@@ -82,7 +84,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
8284 def result = gradleRunner(" setupDistro" , ' -g' , testProjectDir. newFolder(' GUH' ). path). build()
8385
8486 then :
85- result. task(" :distribution:archives:linux-tar :buildExpanded" ). outcome == TaskOutcome . SUCCESS
87+ result. task(" :distribution:archives:${ archive } :buildExpanded" ). outcome == TaskOutcome . SUCCESS
8688 result. task(" :setupDistro" ). outcome == TaskOutcome . SUCCESS
8789 assertExtractedDistroIsCreated(" build/distro" , ' current-marker.txt' )
8890 }
@@ -150,42 +152,47 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
150152 settingsFile << """
151153 include ':distribution:bwc:minor'
152154 """
155+ def archive = archiveTask()
153156 def bwcSubProjectFolder = testProjectDir. newFolder(" distribution" , " bwc" , " minor" )
154157 new File (bwcSubProjectFolder, ' bwc-marker.txt' ) << " bwc=minor"
155158 new File (bwcSubProjectFolder, ' build.gradle' ) << """
156159 apply plugin:'base'
157160
158161 // packed distro
159- configurations.create("linux-tar ")
162+ configurations.create("${ archive } ")
160163 tasks.register("buildBwcTask", Tar) {
161164 from('bwc-marker.txt')
162165 archiveExtension = "tar.gz"
163166 compression = Compression.GZIP
164167 }
165168 artifacts {
166- it.add("linux-tar ", buildBwcTask)
169+ it.add("${ archive } ", buildBwcTask)
167170 }
168171
169172 // expanded distro
170- configurations.create("expanded-linux-tar ")
173+ configurations.create("expanded-${ archive } ")
171174 def expandedTask = tasks.register("buildBwcExpandedTask", Copy) {
172175 from('bwc-marker.txt')
173176 into('build/install/opensearch-distro')
174177 }
175178 artifacts {
176- it.add("expanded-linux-tar ", file('build/install')) {
179+ it.add("expanded-${ archive } ", file('build/install')) {
177180 builtBy expandedTask
178181 type = 'directory'
179182 }
180183 }
181184 """
182185 }
183186
184- private void localDistroSetup () {
187+ private String archiveTask () {
188+ return Architecture . current() == Architecture . X64 ? " linux-tar" : " linux-${ Architecture.current().name().toLowerCase()} -tar" ;
189+ }
190+
191+ private void localDistroSetup (def archive ) {
185192 settingsFile << """
186- include ":distribution:archives:linux-tar "
193+ include ":distribution:archives:${ archive } "
187194 """
188- def bwcSubProjectFolder = testProjectDir. newFolder(" distribution" , " archives" , " linux-tar " )
195+ def bwcSubProjectFolder = testProjectDir. newFolder(" distribution" , " archives" , " ${ archive } " )
189196 new File (bwcSubProjectFolder, ' current-marker.txt' ) << " current"
190197 new File (bwcSubProjectFolder, ' build.gradle' ) << """
191198 import org.gradle.api.internal.artifacts.ArtifactAttributes;
0 commit comments