@@ -51,13 +51,12 @@ esplugin.bundleSpec.from('config/discovery-ec2') {
51
51
}
52
52
53
53
tasks. register(" writeTestJavaPolicy" ) {
54
+ boolean inFips = buildParams. inFipsJvm
55
+ inputs. property(" inFipsJvm" , inFips)
56
+ final File javaPolicy = new File (layout. buildDirectory. asFile. get(), " tmp/java.policy" )
57
+ outputs. file(javaPolicy)
54
58
doLast {
55
- final File tmp = file(" ${ buildDir} /tmp" )
56
- if (tmp. exists() == false && tmp. mkdirs() == false ) {
57
- throw new GradleException (" failed to create temporary directory [${ tmp} ]" )
58
- }
59
- final File javaPolicy = file(" ${ tmp} /java.policy" )
60
- if (buildParams. inFipsJvm) {
59
+ if (inFips) {
61
60
javaPolicy. write(
62
61
[
63
62
" grant {" ,
@@ -100,9 +99,9 @@ tasks.named("test").configure {
100
99
// this is needed to manipulate com.amazonaws.sdk.ec2MetadataServiceEndpointOverride system property
101
100
// it is better rather disable security manager at all with `systemProperty 'tests.security.manager', 'false'`
102
101
if (buildParams. inFipsJvm){
103
- nonInputProperties. systemProperty ' java.security.policy' , " =file://${ buildDir } /tmp/java.policy"
102
+ nonInputProperties. systemProperty ' java.security.policy' , " =file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
104
103
} else {
105
- nonInputProperties. systemProperty ' java.security.policy' , " file://${ buildDir } /tmp/java.policy"
104
+ nonInputProperties. systemProperty ' java.security.policy' , " file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
106
105
}
107
106
}
108
107
0 commit comments