Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix archive baseName #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -73,8 +73,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 @@ -51,20 +51,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 @@ -89,7 +89,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 @@ -187,11 +187,11 @@ private Provider<String> getBaseNameForDistribution(ProviderFactory providers, D
@Override
public String call() throws Exception {
String baseName = (String) Distribution.class.getMethod("getBaseName").invoke(distribution);
return "".equals(baseName) ? "" : distribution.getName();
return baseName != null && !baseName.isEmpty() ? baseName : distribution.getName();
}
});
} else {
return distribution.getDistributionBaseName().map(baseName -> baseName.isEmpty() ? "" : distribution.getName()).orElse(distribution.getName());
return distribution.getDistributionBaseName().map(baseName -> !baseName.isEmpty() ? baseName : distribution.getName()).orElse(distribution.getName());
}
}

Expand Down Expand Up @@ -238,7 +238,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
Loading