@@ -46,13 +46,12 @@ esplugin.bundleSpec.from('config/discovery-ec2') {
4646}
4747
4848tasks. register(" writeTestJavaPolicy" ) {
49+ boolean inFips = buildParams. inFipsJvm
50+ inputs. property(" inFipsJvm" , inFips)
51+ final File javaPolicy = new File (layout. buildDirectory. asFile. get(), " tmp/java.policy" )
52+ outputs. file(javaPolicy)
4953 doLast {
50- final File tmp = file(" ${ buildDir} /tmp" )
51- if (tmp. exists() == false && tmp. mkdirs() == false ) {
52- throw new GradleException (" failed to create temporary directory [${ tmp} ]" )
53- }
54- final File javaPolicy = file(" ${ tmp} /java.policy" )
55- if (buildParams. inFipsJvm) {
54+ if (inFips) {
5655 javaPolicy. write(
5756 [
5857 " grant {" ,
@@ -95,9 +94,9 @@ tasks.withType(Test).configureEach {
9594 // this is needed to manipulate com.amazonaws.sdk.ec2MetadataServiceEndpointOverride system property
9695 // it is better rather disable security manager at all with `systemProperty 'tests.security.manager', 'false'`
9796 if (buildParams. inFipsJvm){
98- nonInputProperties. systemProperty ' java.security.policy' , " =file://${ buildDir } /tmp/java.policy"
97+ nonInputProperties. systemProperty ' java.security.policy' , " =file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
9998 } else {
100- nonInputProperties. systemProperty ' java.security.policy' , " file://${ buildDir } /tmp/java.policy"
99+ nonInputProperties. systemProperty ' java.security.policy' , " file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
101100 }
102101}
103102
0 commit comments