Skip to content

Commit

Permalink
Fix archive baseName
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Fridrick <[email protected]>
  • Loading branch information
PaulFridrick committed Oct 15, 2020
1 parent 0ac91fd commit 19b59a8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class InDepthUserGuideSamplesIntegrationTest extends Specification {
}

List<ArchiveTestFixture> distributionArchives(File sampleDir) {
[new ZipTestFixture(new File(sampleDir, "build/distributions/main.zip")),
new TarTestFixture(new File(sampleDir, "build/distributions/main.tar"))]
[new ZipTestFixture(new File(sampleDir, "build/distributions/custom-distribution.zip")),
new TarTestFixture(new File(sampleDir, "build/distributions/custom-distribution.tar"))]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class MiscUserGuideIntegrationTest extends InDepthUserGuideSamplesIntegrationTes

then:
distributionArchives(sample.dir)*.containsDescendants(
"main/README.md",
"main/bin/runPlayBinaryAsUser.sh"
"custom-distribution/README.md",
"custom-distribution/bin/runPlayBinaryAsUser.sh"
)

where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ abstract class PlayDistributionApplicationIntegrationTest extends PlayMultiVersi
}

List<ArchiveTestFixture> archives() {
[ zip("build/distributions/main.zip"), tar("build/distributions/main.tar") ]
[ zip("build/distributions/${playApp.name}.zip"), tar("build/distributions/${playApp.name}.tar") ]
}
void verifyArchives() {
archives()*.containsDescendants(
"main/lib/${playApp.name}.jar",
"main/lib/${playApp.name}-assets.jar",
"main/bin/main",
"main/bin/main.bat",
"main/conf/application.conf",
"main/README")
"${playApp.name}/lib/${playApp.name}.jar",
"${playApp.name}/lib/${playApp.name}-assets.jar",
"${playApp.name}/bin/main",
"${playApp.name}/bin/main.bat",
"${playApp.name}/conf/application.conf",
"${playApp.name}/README")
}

void verifyStagedFiles() {
File stageMainDir = file("build/stage/main")
File stageMainDir = file("build/stage/${playApp.name}")
[
"lib/${playApp.name}.jar",
"lib/${playApp.name}-assets.jar",
Expand All @@ -92,7 +92,7 @@ abstract class PlayDistributionApplicationIntegrationTest extends PlayMultiVersi
// Verify that the Class-Path attribute contains the correct runtime classpath
def classpath = mainJar.manifest.mainAttributes.getValue("Class-Path")
def classpathAsFilenames = Arrays.asList(classpath.split(" "))
def dependencies = file("build/stage/main/lib/").listFiles().collect { it.name } - [ mainJar.file.name ]
def dependencies = file("build/stage/${playApp.name}/lib/").listFiles().collect { it.name } - [ mainJar.file.name ]
assert dependencies.size() == classpathAsFilenames.size()
assert classpathAsFilenames.containsAll(dependencies)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class PlayDistributionAdvancedAppIntegrationTest extends PlayDistributionApplica
super.verifyArchives()

archives()*.containsDescendants(
"main/conf/jva.routes",
"main/conf/scala.routes")
"${playApp.name}/conf/jva.routes",
"${playApp.name}/conf/scala.routes")
}

@Override
void verifyStagedFiles() {
super.verifyStagedFiles()

File stageMainDir = file("build/stage/main")
File stageMainDir = file("build/stage/${playApp.name}")
[
"conf/jva.routes",
"conf/scala.routes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ class DistributionZipIntegrationTest extends AbstractIntegrationTest {
build "dist"

then:
zip("build/distributions/main.zip").containsDescendants("main/additionalFile.txt")
zip("build/distributions/dist-play-app.zip").containsDescendants("dist-play-app/additionalFile.txt")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ private Provider<String> getBaseNameForDistribution(ProviderFactory providers, D
return providers.provider(new Callable<String>() {
@Override
public String call() throws Exception {
return (distribution.getBaseName() != null && "".equals(distribution.getBaseName())) ? distribution.getBaseName() : distribution.getName();
return (distribution.getBaseName() != null && !distribution.getBaseName().isEmpty()) ? distribution.getBaseName() : distribution.getName();
}
});
} else {
return distribution.getDistributionBaseName().map(baseName -> baseName.isEmpty() ? "" : distribution.getName()).orElse(distribution.getName());
return distribution.getDistributionBaseName().map(baseName -> baseName.isEmpty() ? distribution.getName() : baseName).orElse(distribution.getName());
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ public void execute(FileCopyDetails fileCopyDetails) {
public String apply(File input) {
calculateRenames();
String rename = renames.get(input);
if (rename!=null) {
if (rename != null) {
return rename;
}
return input.getName();
Expand Down

0 comments on commit 19b59a8

Please sign in to comment.