How I can reference a field defined in the gradle script?

Patrick

I have a script to prepare build of an apk.

It defines some value which has some random specific for each build value:

def salt = generateSalt()

def generatedSalt() {
 return generateRandomlySalt
}

In the same script I want to have another method which will operate on this value.

def generateMapAndSalt() {
  // here is additional logic which depends on the defined salt
  generateEncodedHash(certificate, salt, shaKey)
}

There is another method inside of android closure which will pass this defined salt value to the buildConfigFiles. How do I reference once generated salt value from defined method? Tired accessing it with following syntax:

this.$salt
$salt
salt

With no luck.

Opal

You can define the salt in an ext block and refer to it via project instance.

ext {
   salt = generateSalt()
}

project.salt

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I reference a calculated field in a subquery?

In Ruby, how can I reference a lambda defined in a module?

how can i access the values of an other script without getting this error: CS0120:An object reference is required for the non-static field?

How can I make a user defined "Other" in a field with Choices in Django?

How can I refer to an awk field defined with an arbitrary expression?

How can I download and reference a single artifact in Gradle?

How can I reference the value of a final static field in the class?

How can I reference a field in MongoDB without knowing its name?

How can I swap in a new value for a field in a mutable reference to a structure?

How can I reference a "@typeparam TModel" field in the Blazor (sub)-component?

How can I populate the reference Field using Firestore

How can I reference to model field in Django using String?

How can I reference the current directory of a script when sourcing it?

How can I reference system assembly in Cake script?

How can I reference package version in npm script?

How can I include Gradle Plugins in a Script plugin in Kotlin DSL?

How can I import one Gradle script into another?

Gradle : how can I call a 'def' from an imported script?

Gradle: How can I configure repositories in buildscript block of external script

How can I write this Gradle build script snippet in Groovy?

In Elasticsearch how can I get field length using the painless script?

How can I create a int field in OnGui in editorwindow script?

How can I limit an entity reference selection to a specific field value on the reference

In Javascript, how can I reference a function-scoped variable from a function called within that function but defined elsewhere?

How can I get a proto file to reference a message defined in another proto?

How do I ensure a field is defined in struct?

How can I make a struct which may or may not have a field defined?

How can I find the number of objects in a list defined with a certain field? Flutter

How can I script a field in Kibana that matches first 4 digits of a field?