mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Added support for an alternative current dir mode in pkldoc (#824)
Some systems have trouble with handling symlinks, which breaks the current directory links created by Pkldoc. In this PR, we add an alternative mode which creates a full copy of the latest published version contents in the current directory instead. Co-authored-by: Dan Chao <dan.chao@apple.com>
This commit is contained in:
@@ -261,8 +261,14 @@ public class PklPlugin implements Plugin<Project> {
|
||||
.getBuildDirectory()
|
||||
.map(it -> it.dir("pkldoc").dir(spec.getName())));
|
||||
|
||||
spec.getNoSymlinks().convention(false);
|
||||
|
||||
createModulesTask(PkldocTask.class, spec)
|
||||
.configure(task -> task.getOutputDir().set(spec.getOutputDir()));
|
||||
.configure(
|
||||
task -> {
|
||||
task.getOutputDir().set(spec.getOutputDir());
|
||||
task.getNoSymlinks().set(spec.getNoSymlinks());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 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.
|
||||
@@ -16,8 +16,11 @@
|
||||
package org.pkl.gradle.spec;
|
||||
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
|
||||
/** Configuration options for Pkldoc generators. Documented in user manual. */
|
||||
public interface PkldocSpec extends ModulesSpec {
|
||||
DirectoryProperty getOutputDir();
|
||||
|
||||
Property<Boolean> getNoSymlinks();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
package org.pkl.gradle.task;
|
||||
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.OutputDirectory;
|
||||
import org.pkl.doc.CliDocGenerator;
|
||||
import org.pkl.doc.CliDocGeneratorOptions;
|
||||
@@ -24,11 +26,17 @@ public abstract class PkldocTask extends ModulesTask {
|
||||
@OutputDirectory
|
||||
public abstract DirectoryProperty getOutputDir();
|
||||
|
||||
@Input
|
||||
public abstract Property<Boolean> getNoSymlinks();
|
||||
|
||||
@Override
|
||||
protected void doRunTask() {
|
||||
new CliDocGenerator(
|
||||
new CliDocGeneratorOptions(
|
||||
getCliBaseOptions(), getOutputDir().get().getAsFile().toPath()))
|
||||
getCliBaseOptions(),
|
||||
getOutputDir().get().getAsFile().toPath(),
|
||||
false,
|
||||
getNoSymlinks().get()))
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user