mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Add support for HTTP proxying (#506)
* Add `--proxy` and `--no-proxy` CLI flags * Add property `http` to `pkl:settings` * Move `EvaluatorSettings` from `pkl:Project` to its own module and add property `http` * Add support for proxying in server mode, and through Gradle * Add `setProxy()` to `HttpClient` * Add documentation
This commit is contained in:
committed by
GitHub
parent
a520ae7d04
commit
b03530ed1f
@@ -3,10 +3,10 @@
|
||||
# This file is expected to be part of source control.
|
||||
com.github.ajalt.clikt:clikt-jvm:3.5.1=compileClasspath
|
||||
com.github.ajalt.clikt:clikt:3.5.1=compileClasspath,compileOnlyDependenciesMetadata
|
||||
net.bytebuddy:byte-buddy:1.14.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
net.bytebuddy:byte-buddy:1.14.16=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeOnlyDependenciesMetadata
|
||||
org.assertj:assertj-core:3.25.3=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.assertj:assertj-core:3.26.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
|
||||
@@ -281,6 +281,8 @@ public class PklPlugin implements Plugin<Project> {
|
||||
spec.getNoCache().convention(false);
|
||||
|
||||
spec.getTestPort().convention(-1);
|
||||
|
||||
spec.getNoProxy().convention(List.of());
|
||||
}
|
||||
|
||||
private void configureCodeGenSpec(CodeGenSpec spec) {
|
||||
@@ -424,6 +426,8 @@ public class PklPlugin implements Plugin<Project> {
|
||||
task.getModuleCacheDir().set(spec.getModuleCacheDir());
|
||||
task.getEvalTimeout().set(spec.getEvalTimeout());
|
||||
task.getTestPort().set(spec.getTestPort());
|
||||
task.getProxyAddress().set(spec.getProxyAddress());
|
||||
task.getNoProxy().set(spec.getNoProxy());
|
||||
}
|
||||
|
||||
private <T extends ModulesTask, S extends ModulesSpec> void configureModulesTask(T task, S spec) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.pkl.gradle.spec;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.Duration;
|
||||
import org.gradle.api.file.ConfigurableFileCollection;
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
@@ -50,4 +51,8 @@ public interface BasePklSpec {
|
||||
Property<Duration> getEvalTimeout();
|
||||
|
||||
Property<Integer> getTestPort();
|
||||
|
||||
Property<URI> getProxyAddress();
|
||||
|
||||
ListProperty<String> getNoProxy();
|
||||
}
|
||||
|
||||
@@ -125,6 +125,14 @@ public abstract class BasePklTask extends DefaultTask {
|
||||
@Optional
|
||||
public abstract Property<Integer> getTestPort();
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
public abstract Property<URI> getProxyAddress();
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
public abstract ListProperty<String> getNoProxy();
|
||||
|
||||
@TaskAction
|
||||
public void runTask() {
|
||||
doRunTask();
|
||||
@@ -156,7 +164,9 @@ public abstract class BasePklTask extends DefaultTask {
|
||||
false,
|
||||
false,
|
||||
getTestPort().getOrElse(-1),
|
||||
Collections.emptyList());
|
||||
Collections.emptyList(),
|
||||
getProxyAddress().getOrNull(),
|
||||
getNoProxy().getOrElse(List.of()));
|
||||
}
|
||||
return cachedOptions;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,9 @@ public abstract class ModulesTask extends BasePklTask {
|
||||
getNoProject().getOrElse(false),
|
||||
false,
|
||||
getTestPort().getOrElse(-1),
|
||||
Collections.emptyList());
|
||||
Collections.emptyList(),
|
||||
null,
|
||||
List.of());
|
||||
}
|
||||
return cachedOptions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user