@@ -51,13 +51,12 @@ esplugin.bundleSpec.from('config/discovery-ec2') {
5151}
5252
5353tasks. 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)
5458 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) {
6160 javaPolicy. write(
6261 [
6362 " grant {" ,
@@ -100,9 +99,9 @@ tasks.named("test").configure {
10099 // this is needed to manipulate com.amazonaws.sdk.ec2MetadataServiceEndpointOverride system property
101100 // it is better rather disable security manager at all with `systemProperty 'tests.security.manager', 'false'`
102101 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"
104103 } 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"
106105 }
107106}
108107
0 commit comments