Slackbot
12/12/2023, 5:57 PMCaleb Cushing
12/12/2023, 6:13 PMGiuseppe Barbieri
12/12/2023, 6:15 PMCaleb Cushing
12/12/2023, 6:15 PMproviders.getEnvironment or similarGiuseppe Barbieri
12/12/2023, 6:17 PMCannot query the value of this provider because it has no value available.
Giuseppe Barbieri
12/12/2023, 6:17 PMGiuseppe Barbieri
12/12/2023, 6:18 PMGiuseppe Barbieri
12/12/2023, 6:18 PMCaleb Cushing
12/12/2023, 6:18 PMGiuseppe Barbieri
12/12/2023, 6:18 PMCaleb Cushing
12/12/2023, 6:18 PMCaleb Cushing
12/12/2023, 6:19 PMCaleb Cushing
12/12/2023, 6:19 PMGiuseppe Barbieri
12/12/2023, 6:20 PMGiuseppe Barbieri
12/12/2023, 6:21 PMGiuseppe Barbieri
12/12/2023, 6:21 PMGiuseppe Barbieri
12/12/2023, 6:21 PMwill not love the summoningLet's see 😄
Giuseppe Barbieri
12/12/2023, 6:22 PMGiuseppe Barbieri
12/12/2023, 6:22 PMCaleb Cushing
12/12/2023, 6:22 PMjava.home?Caleb Cushing
12/12/2023, 6:23 PMenvironment("JAVA_HOME", providers.environmentVariable("JAVA_HOME"))Caleb Cushing
12/12/2023, 6:23 PMCaleb Cushing
12/12/2023, 6:23 PMGiuseppe Barbieri
12/12/2023, 6:23 PMelect@5800x:~/IdeaProjects/java-launcher$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64while
"java.home" is /home/elect/.jdks/openjdk-19.0.1, which is the Idea jdk I guessGiuseppe Barbieri
12/12/2023, 6:24 PMChris Lee
12/12/2023, 6:24 PMCaleb Cushing
12/12/2023, 6:24 PMCaleb Cushing
12/12/2023, 6:25 PMGiuseppe Barbieri
12/12/2023, 6:25 PMCan you use a Java ToolChain here to avoid the low-level launching of a specific JVM?Sure, I can
Giuseppe Barbieri
12/12/2023, 6:26 PMenvironment("JAVA_HOME", providers.environmentVariable("JAVA_HOME"))
"echo \$JAVA_HOME".execute() returns
valueof(EnvironmentVariableValueSource)
Chris Lee
12/12/2023, 6:26 PMproviders.environmentVariable("JAVA_HOME").get()Giuseppe Barbieri
12/12/2023, 6:27 PMCannot query the value of this provider because it has no value available.
Caleb Cushing
12/12/2023, 6:27 PM.get make it eager or something in a way you might not want? also it sounds like there's 2 sources so maybe you need a getOrElse(...Caleb Cushing
12/12/2023, 6:27 PMCaleb Cushing
12/12/2023, 6:28 PMGiuseppe Barbieri
12/12/2023, 6:28 PMCan you use a Java ToolChain here to avoid the low-level launching of a specific JVM?I mean, between using a specific jdk and using whatever jdk Idea is running, I don't see any differences for my purposes, though
Giuseppe Barbieri
12/12/2023, 6:28 PMlike try JAVA_HOME then try java.homesame
Giuseppe Barbieri
12/12/2023, 6:28 PMCannot query the value of this provider because it has no value available.
Caleb Cushing
12/12/2023, 6:29 PMCaleb Cushing
12/12/2023, 6:29 PMGiuseppe Barbieri
12/12/2023, 6:29 PMlibjvm, I don't think I care which oneGiuseppe Barbieri
12/12/2023, 6:30 PMjava.home returns me a valid, I guess I might be happy..Caleb Cushing
12/12/2023, 6:30 PMGiuseppe Barbieri
12/12/2023, 6:31 PMCaleb Cushing
12/12/2023, 6:32 PMJAVA_HOME="..." ./gradlew build with
environment("JAVA_HOME", providers.environmentVariable("JAVA_HOME").get())
is throwing an NPE? or...Giuseppe Barbieri
12/12/2023, 6:33 PM./gradlew runDebungExecutableNative
returns my JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64
Caleb Cushing
12/12/2023, 6:33 PMCaleb Cushing
12/12/2023, 6:33 PMGiuseppe Barbieri
12/12/2023, 6:33 PMCaleb Cushing
12/12/2023, 6:34 PMGiuseppe Barbieri
12/12/2023, 6:34 PMMatthew Von-Maszewski
12/12/2023, 6:40 PM/**
* We have one environment where gradle choses a non-jdk java,
* and another where JAVA_HOME is not set. This is a trial
* by fire approach.
*/
ext {
if (System.getenv('JAVA_HOME') == null) {
cJDK = System.properties['java.home']
} else {
cJDK = System.getenv('JAVA_HOME')
}
}Caleb Cushing
12/12/2023, 6:56 PMSystem. for this in gradle anymore, use the providers (although this looks like groovy, not sure how providers work there)Vampire
12/12/2023, 11:27 PMSystem. is fine, especially if you need the value eagerly and not as provider. Especially if it is an environment variable which are more or less read-only anyway.Vampire
12/12/2023, 11:30 PMSystem. should also be perfectly CC-compatible and -safe. That you needed to use the providers for CC was just an intermediate situation while it was still incubating.Vampire
12/12/2023, 11:32 PMVampire
12/13/2023, 9:27 AMGiuseppe Barbieri
12/13/2023, 9:28 AMWell, as I said, if the environment variable is available in a commandline and you start Gradle from that commandline, it should also be available in the build script.yep, that's what I discovered
Giuseppe Barbieri
12/13/2023, 9:29 AMVampire
12/13/2023, 9:35 AMVampire
12/13/2023, 9:35 AM*java*.*home should always give you that.*Giuseppe Barbieri
12/13/2023, 9:37 AMVampire
12/13/2023, 9:40 AMGiuseppe Barbieri
12/13/2023, 9:42 AMVampire
12/13/2023, 10:19 AMGiuseppe Barbieri
12/13/2023, 10:20 AMCaleb Cushing
12/13/2023, 1:56 PMVampire
12/13/2023, 2:06 PMVampire
12/13/2023, 2:08 PMSystem.... or ways to execute processes and so on as CC input.
Otherwise you could for example not as easily use 3rd party libs doing such actions without finding out what exactly they do and what needs to be declared as CC input.Caleb Cushing
12/13/2023, 2:21 PMVampire
12/13/2023, 2:27 PM