Add flag to turn power assertions on/off (#1419)

This commit is contained in:
Islon Scherer
2026-02-03 09:35:16 +01:00
committed by GitHub
parent 7b7b51c0ae
commit f0449c8330
29 changed files with 345 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -146,6 +146,10 @@ public abstract class BasePklTask extends DefaultTask {
@Optional
public abstract MapProperty<URI, URI> getHttpRewrites();
@Input
@Optional
public abstract Property<Boolean> getPowerAssertions();
/**
* There are issues with using native libraries in Gradle plugins. As a workaround for now, make
* Truffle use an un-optimized runtime.
@@ -202,7 +206,8 @@ public abstract class BasePklTask extends DefaultTask {
getHttpRewrites().getOrNull(),
Map.of(),
Map.of(),
null);
null,
getPowerAssertions().getOrElse(false));
}
return cachedOptions;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -166,7 +166,8 @@ public abstract class ModulesTask extends BasePklTask {
getHttpRewrites().getOrNull(),
Map.of(),
Map.of(),
null);
null,
getPowerAssertions().getOrElse(false));
}
return cachedOptions;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@ public abstract class TestTask extends ModulesTask {
public TestTask() {
this.getJunitAggregateSuiteName().convention("pkl-tests");
this.getPowerAssertions().convention(true);
}
@Override