Skip to content

Commit

Permalink
Merge pull request #74 from bavardage/feature/set-default-tmp-location
Browse files Browse the repository at this point in the history
default tmp location is var/tmp/files
  • Loading branch information
markelliot committed May 23, 2016
2 parents 8242c73 + 0411c16 commit 1a4df6e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class DistTarTask extends Tar {
}
}

new File(project.projectDir, "var/tmp/files").mkdirs()

from("${project.projectDir}/deployment") {
into "${archiveRootDir}/deployment"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ package com.palantir.gradle.javadist;

class DistributionExtension {

private static final List<String> requiredJvmOpts = ['-Djava.security.egd=file:/dev/./urandom']
private static final List<String> requiredJvmOpts = [
'-Djava.security.egd=file:/dev/./urandom',
'-Djava.io.tmpdir=var/tmp/files'
]

private String serviceName
private String mainClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ class JavaDistributionPluginTests extends Specification {
!new File(projectDir, 'dist/service-name-0.1/var/run').exists()
new File(projectDir, 'dist/service-name-0.1/var/conf/service-name.yml').exists()
}

def 'produce distribution bundle and check var/tmp/files is created' () {
given:
createUntarBuildFile(buildFile)

when:
BuildResult buildResult = run('build', 'distTar', 'untar').build()

then:
buildResult.task(':build').outcome == TaskOutcome.SUCCESS
buildResult.task(':distTar').outcome == TaskOutcome.SUCCESS
buildResult.task(':untar').outcome == TaskOutcome.SUCCESS

// check content was extracted
new File(projectDir, 'dist/service-name-0.1/var/tmp/files').exists()
}

def 'produce distribution bundle with custom exclude set' () {
given:
Expand Down Expand Up @@ -252,7 +268,7 @@ class JavaDistributionPluginTests extends Specification {
// check start script uses default JVM options
new File(projectDir, 'dist/service-name-0.1/service/bin/service-name').exists()
String startScript = readFully('dist/service-name-0.1/service/bin/service-name')
startScript.contains('DEFAULT_JVM_OPTS=\'"-Djava.security.egd=file:/dev/./urandom" "-Xmx4M" "-Djavax.net.ssl.trustStore=truststore.jks"\'')
startScript.contains('DEFAULT_JVM_OPTS=\'"-Djava.security.egd=file:/dev/./urandom" "-Djava.io.tmpdir=var/tmp/files" "-Xmx4M" "-Djavax.net.ssl.trustStore=truststore.jks"\'')
}

def 'produce distribution bundle that populates config.sh' () {
Expand Down

0 comments on commit 1a4df6e

Please sign in to comment.