diff --git a/cmd/pkl-gen-go/generatorsettings/GeneratorSettings.pkl.go b/cmd/pkl-gen-go/generatorsettings/GeneratorSettings.pkl.go index a65e3299..35e15b5c 100644 --- a/cmd/pkl-gen-go/generatorsettings/GeneratorSettings.pkl.go +++ b/cmd/pkl-gen-go/generatorsettings/GeneratorSettings.pkl.go @@ -20,20 +20,6 @@ type GeneratorSettings struct { // ``` PackageMappings map[string]string `pkl:"packageMappings"` - // The base path for module output. - // - // This determines the relative path that generated Go source code will be written to. - // For example, a base path of `"github.com/foo/bar"` means that the Go files for package - // `github.com/foo/bar/baz` will be written into a `baz` directory, relative to the current - // working directory where codegen is executed. - // - // Any Go packages that are not prefixed with [basePath] are skipped from code generation. - // - // This is typically a Go module's name, i.e. the `module` clause within a `go.mod` file. - // - // If empty, writes the full package path to the current directory. - BasePath string `pkl:"basePath"` - // Additional struct tags to place on all properties. // // In addition to these tags, every property implicitly receives a `pkl:` struct tag. @@ -51,22 +37,6 @@ type GeneratorSettings struct { // ``` StructTags map[string]string `pkl:"structTags"` - // The path to the Pkl code generator script. - // - // This is an internal setting that is used for testing purposes when developing the code - // generator. - GeneratorScriptPath string `pkl:"generatorScriptPath"` - - // URI patterns that determine which modules can be loaded and evaluated. - // - // This corresponds to the `--allowed-modules` flag in the Pkl CLI. - AllowedModules []string `pkl:"allowedModules"` - - // URI patterns that determine which external resources can be read. - // - // This corresponds to the `--allowed-resources` flag in the Pkl CLI. - AllowedResources []string `pkl:"allowedResources"` - // The project directory to control dependency and evaluator settings during codegen. // // This corresponds to the `--project-dir` flag in the Pkl CLI. @@ -83,11 +53,41 @@ type GeneratorSettings struct { // Paths must use `/` as the path separator. CacheDir *string `pkl:"cacheDir"` - // Print out the names of the files that will be generated, but skip writing anything to disk. - DryRun bool `pkl:"dryRun"` + // The base path for module output. + // + // This determines the relative path that generated Go source code will be written to. + // For example, a base path of `"github.com/foo/bar"` means that the Go files for package + // `github.com/foo/bar/baz` will be written into a `baz` directory, relative to the current + // working directory where codegen is executed. + // + // Any Go packages that are not prefixed with [basePath] are skipped from code generation. + // + // This is typically a Go module's name, i.e. the `module` clause within a `go.mod` file. + // + // If empty, writes the full package path to the current directory. + BasePath string `pkl:"basePath"` + + // The path to the Pkl code generator script. + // + // This is an internal setting that is used for testing purposes when developing the code + // generator. + GeneratorScriptPath string `pkl:"generatorScriptPath"` // The URI of this module, used to resolve [projectDir]. Uri string `pkl:"uri"` + + // URI patterns that determine which modules can be loaded and evaluated. + // + // This corresponds to the `--allowed-modules` flag in the Pkl CLI. + AllowedModules []string `pkl:"allowedModules"` + + // URI patterns that determine which external resources can be read. + // + // This corresponds to the `--allowed-resources` flag in the Pkl CLI. + AllowedResources []string `pkl:"allowedResources"` + + // Print out the names of the files that will be generated, but skip writing anything to disk. + DryRun bool `pkl:"dryRun"` } // LoadFromPath loads the pkl module at the given path and evaluates it into a GeneratorSettings diff --git a/cmd/pkl-gen-go/pkg/generate.go b/cmd/pkl-gen-go/pkg/generate.go index a45c357a..431eccd7 100644 --- a/cmd/pkl-gen-go/pkg/generate.go +++ b/cmd/pkl-gen-go/pkg/generate.go @@ -43,8 +43,8 @@ var ( ) type TemplateValues struct { - generatorsettings.GeneratorSettings PklModulePath string + generatorsettings.GeneratorSettings } func determineBasePath(v *generatorsettings.GeneratorSettings) error { diff --git a/pkl/evaluator.go b/pkl/evaluator.go index e13183ee..63c37db0 100644 --- a/pkl/evaluator.go +++ b/pkl/evaluator.go @@ -73,13 +73,13 @@ type Evaluator interface { } type evaluator struct { - evaluatorId int64 logger Logger manager *evaluatorManager pendingRequests *sync.Map - closed bool resourceReaders []ResourceReader moduleReaders []ModuleReader + evaluatorId int64 + closed bool } var _ Evaluator = (*evaluator)(nil) diff --git a/pkl/evaluator_manager_exec.go b/pkl/evaluator_manager_exec.go index 907d6411..533f48be 100644 --- a/pkl/evaluator_manager_exec.go +++ b/pkl/evaluator_manager_exec.go @@ -63,15 +63,15 @@ func NewEvaluatorManagerWithCommand(pklCommand []string) EvaluatorManager { } type execEvaluator struct { - cmd *exec.Cmd - in chan msgapi.IncomingMessage - out chan msgapi.OutgoingMessage - closed chan error - // exited is a flag that indicates evaluator was closed explicitly - exited atomicBool + cmd *exec.Cmd + in chan msgapi.IncomingMessage + out chan msgapi.OutgoingMessage + closed chan error version *internal.Semver - pklCommand []string processDone chan struct{} + pklCommand []string + // exited is a flag that indicates evaluator was closed explicitly + exited atomicBool } func (e *execEvaluator) inChan() chan msgapi.IncomingMessage { diff --git a/pkl/evaluator_options.go b/pkl/evaluator_options.go index e9515dcd..47e32ae3 100644 --- a/pkl/evaluator_options.go +++ b/pkl/evaluator_options.go @@ -30,20 +30,39 @@ import ( // EvaluatorOptions is the set of options available to control Pkl evaluation. type EvaluatorOptions struct { + + // Logger is the logging interface for messages emitted by the Pkl evaluator. + Logger Logger + // Properties is the set of properties available to the `prop:` resource reader. Properties map[string]string // Env is the set of environment variables available to the `env:` resource reader. Env map[string]string - // ModulePaths is the set of directories, ZIP archives, or JAR archives to search when - // resolving `modulepath`: resources and modules. + // DeclaredProjectDependencies is set of dependencies available to modules within ProjectBaseURI. // - // This option must be non-emptyMirror if ModuleReaderModulePath or ResourceModulePath are used. - ModulePaths []string + // When importing dependencies, a PklProject.deps.json file must exist within ProjectBaseURI + // that contains the project's resolved dependencies. + DeclaredProjectDependencies *ProjectDependencies - // Logger is the logging interface for messages emitted by the Pkl evaluator. - Logger Logger + // Settings for controlling how Pkl talks over HTTP(S). + // + // Added in Pkl 0.26. + // If the underlying Pkl does not support HTTP options, NewEvaluator will return with an error. + Http *Http + + // ExternalModuleReaders registers external commands that implement module reader schemes. + // + // Added in Pkl 0.27. + // If the underlying Pkl does not support external readers, evaluation will fail when a registered scheme is used. + ExternalModuleReaders map[string]ExternalReader + + // ExternalResourceReaders registers external commands that implement resource reader schemes. + // + // Added in Pkl 0.27. + // If the underlying Pkl does not support external readers, evaluation will fail when a registered scheme is used. + ExternalResourceReaders map[string]ExternalReader // OutputFormat controls the renderer to be used when rendering the `output.text` // property of a module. @@ -60,24 +79,6 @@ type EvaluatorOptions struct { // - `"pkl-binary"` OutputFormat string - // AllowedModules defines URI patterns that determine which modules are permitted to be loaded and evaluated. - // Patterns are regular expressions in the dialect understood by [java.util.regex.Pattern]. - // - // [java.util.regex.Pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html - AllowedModules []string - - // AllowedResources defines URI patterns that determine which resources are permitted to be loaded and evaluated. - // Patterns are regular expressions in the dialect understood by [java.util.regex.Pattern]. - // - // [java.util.regex.Pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html - AllowedResources []string - - // ResourceReaders are the resource readers to be used by the evaluator. - ResourceReaders []ResourceReader - - // ModuleReaders are the set of custom module readers to be used by the evaluator. - ModuleReaders []ModuleReader - // CacheDir is the directory where `package:` modules are cached. // // If empty, no caching is performed. @@ -109,35 +110,35 @@ type EvaluatorOptions struct { // or EvaluatorManager.NewProjectEvaluator. ProjectBaseURI string - // DeclaredProjectDependencies is set of dependencies available to modules within ProjectBaseURI. + // TraceMode dictates how Pkl will format messages logged by `trace()`. // - // When importing dependencies, a PklProject.deps.json file must exist within ProjectBaseURI - // that contains the project's resolved dependencies. - DeclaredProjectDependencies *ProjectDependencies + // Added in Pkl 0.30. + // If the underlying Pkl does not support trace modes, this option will be ignored. + TraceMode TraceMode - // Settings for controlling how Pkl talks over HTTP(S). + // ModulePaths is the set of directories, ZIP archives, or JAR archives to search when + // resolving `modulepath`: resources and modules. // - // Added in Pkl 0.26. - // If the underlying Pkl does not support HTTP options, NewEvaluator will return with an error. - Http *Http + // This option must be non-emptyMirror if ModuleReaderModulePath or ResourceModulePath are used. + ModulePaths []string - // ExternalModuleReaders registers external commands that implement module reader schemes. + // AllowedModules defines URI patterns that determine which modules are permitted to be loaded and evaluated. + // Patterns are regular expressions in the dialect understood by [java.util.regex.Pattern]. // - // Added in Pkl 0.27. - // If the underlying Pkl does not support external readers, evaluation will fail when a registered scheme is used. - ExternalModuleReaders map[string]ExternalReader + // [java.util.regex.Pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html + AllowedModules []string - // ExternalResourceReaders registers external commands that implement resource reader schemes. + // AllowedResources defines URI patterns that determine which resources are permitted to be loaded and evaluated. + // Patterns are regular expressions in the dialect understood by [java.util.regex.Pattern]. // - // Added in Pkl 0.27. - // If the underlying Pkl does not support external readers, evaluation will fail when a registered scheme is used. - ExternalResourceReaders map[string]ExternalReader + // [java.util.regex.Pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html + AllowedResources []string - // TraceMode dictates how Pkl will format messages logged by `trace()`. - // - // Added in Pkl 0.30. - // If the underlying Pkl does not support trace modes, this option will be ignored. - TraceMode TraceMode + // ResourceReaders are the resource readers to be used by the evaluator. + ResourceReaders []ResourceReader + + // ModuleReaders are the set of custom module readers to be used by the evaluator. + ModuleReaders []ModuleReader } type TraceMode string @@ -150,8 +151,8 @@ const ( ) type ProjectRemoteDependency struct { - PackageUri string `pkl:"uri"` Checksums *Checksums `pkl:"checksums"` + PackageUri string `pkl:"uri"` } func (dep *ProjectRemoteDependency) toMessage() *msgapi.ProjectOrDependency { @@ -174,11 +175,10 @@ func (checksums *Checksums) toMessage() *msgapi.Checksums { } type ProjectLocalDependency struct { - PackageUri string + Dependencies *ProjectDependencies + PackageUri string ProjectFileUri string - - Dependencies *ProjectDependencies } func (dep *ProjectLocalDependency) toMessage() *msgapi.ProjectOrDependency { @@ -211,10 +211,6 @@ func (p *ProjectDependencies) toMessage() map[string]*msgapi.ProjectOrDependency } type Http struct { - // PEM format certificates to trust when making HTTP requests. - // - // If empty, Pkl will trust its own built-in certificates. - CaCertificates []byte // Configuration of the HTTP proxy to use. // @@ -237,6 +233,10 @@ type Http struct { // "https://example.com/": "https://my.other.website/" // } Rewrites map[string]string + // PEM format certificates to trust when making HTTP requests. + // + // If empty, Pkl will trust its own built-in certificates. + CaCertificates []byte } func (http *Http) toMessage() *msgapi.Http { diff --git a/pkl/external_reader.go b/pkl/external_reader.go index 60542280..1fc19c57 100644 --- a/pkl/external_reader.go +++ b/pkl/external_reader.go @@ -96,10 +96,10 @@ func NewExternalReaderClient(opts ...func(options *ExternalReaderClientOptions)) } type externalReaderClient struct { - ExternalReaderClientOptions in chan msgapi.IncomingMessage out chan msgapi.OutgoingMessage closed chan error + ExternalReaderClientOptions exited atomicBool } diff --git a/pkl/internal/msgapi/incoming.go b/pkl/internal/msgapi/incoming.go index 2fb3f9e8..1041c252 100644 --- a/pkl/internal/msgapi/incoming.go +++ b/pkl/internal/msgapi/incoming.go @@ -44,73 +44,82 @@ var ( type CreateEvaluatorResponse struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Error string `msgpack:"error"` + Error string `msgpack:"error"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type EvaluateResponse struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Result []byte `msgpack:"result"` - Error string `msgpack:"error"` + Error string `msgpack:"error"` + Result []byte `msgpack:"result"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type ReadResource struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Uri string `msgpack:"uri"` + Uri string `msgpack:"uri"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type ReadModule struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Uri string `msgpack:"uri"` + Uri string `msgpack:"uri"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type Log struct { incomingMessageImpl - EvaluatorId int64 `msgpack:"evaluatorId"` - Level int `msgpack:"level"` - Message string `msgpack:"message"` - FrameUri string `msgpack:"frameUri"` + Message string `msgpack:"message"` + FrameUri string `msgpack:"frameUri"` + + EvaluatorId int64 `msgpack:"evaluatorId"` + Level int `msgpack:"level"` } type ListResources struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Uri string `msgpack:"uri"` + Uri string `msgpack:"uri"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type ListModules struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` - Uri string `msgpack:"uri"` + Uri string `msgpack:"uri"` + + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } type InitializeModuleReader struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - Scheme string `msgpack:"scheme"` + Scheme string `msgpack:"scheme"` + + RequestId int64 `msgpack:"requestId"` } type InitializeResourceReader struct { incomingMessageImpl - RequestId int64 `msgpack:"requestId"` - Scheme string `msgpack:"scheme"` + Scheme string `msgpack:"scheme"` + + RequestId int64 `msgpack:"requestId"` } type CloseExternalProcess struct { diff --git a/pkl/internal/msgapi/outgoing.go b/pkl/internal/msgapi/outgoing.go index 421fe16f..6f3c7ca2 100644 --- a/pkl/internal/msgapi/outgoing.go +++ b/pkl/internal/msgapi/outgoing.go @@ -66,39 +66,39 @@ type ModuleReader struct { } type CreateEvaluator struct { - RequestId int64 `msgpack:"requestId"` - ResourceReaders []*ResourceReader `msgpack:"clientResourceReaders,omitempty"` - ModuleReaders []*ModuleReader `msgpack:"clientModuleReaders,omitempty"` - ExternalReaderCommands [][]string `msgpack:"externalReaderCommands,omitempty"` - ModulePaths []string `msgpack:"modulePaths,omitempty"` - Env map[string]string `msgpack:"env,omitempty"` - Properties map[string]string `msgpack:"properties,omitempty"` - OutputFormat string `msgpack:"outputFormat,omitempty"` - AllowedModules []string `msgpack:"allowedModules,omitempty"` - AllowedResources []string `msgpack:"allowedResources,omitempty"` - RootDir string `msgpack:"rootDir,omitempty"` - CacheDir string `msgpack:"cacheDir,omitempty"` - Project *ProjectOrDependency `msgpack:"project,omitempty"` - Http *Http `msgpack:"http,omitempty"` - // Intentionally not used right now. Go has `context.WithTimeout` which is a more canonical way to handle timeouts. - TimeoutSeconds int64 `msgpack:"timeoutSeconds,omitempty"` + Env map[string]string `msgpack:"env,omitempty"` + Properties map[string]string `msgpack:"properties,omitempty"` + Project *ProjectOrDependency `msgpack:"project,omitempty"` + Http *Http `msgpack:"http,omitempty"` ExternalModuleReaders map[string]*ExternalReader `msgpack:"externalModuleReaders,omitempty"` ExternalResourceReaders map[string]*ExternalReader `msgpack:"externalResourceReaders,omitempty"` + OutputFormat string `msgpack:"outputFormat,omitempty"` + RootDir string `msgpack:"rootDir,omitempty"` + CacheDir string `msgpack:"cacheDir,omitempty"` TraceMode string `msgpack:"traceMode,omitempty"` + ResourceReaders []*ResourceReader `msgpack:"clientResourceReaders,omitempty"` + ModuleReaders []*ModuleReader `msgpack:"clientModuleReaders,omitempty"` + ExternalReaderCommands [][]string `msgpack:"externalReaderCommands,omitempty"` + ModulePaths []string `msgpack:"modulePaths,omitempty"` + AllowedModules []string `msgpack:"allowedModules,omitempty"` + AllowedResources []string `msgpack:"allowedResources,omitempty"` + RequestId int64 `msgpack:"requestId"` + // Intentionally not used right now. Go has `context.WithTimeout` which is a more canonical way to handle timeouts. + TimeoutSeconds int64 `msgpack:"timeoutSeconds,omitempty"` } type ProjectOrDependency struct { + Checksums *Checksums `msgpack:"checksums,omitempty"` + Dependencies map[string]*ProjectOrDependency `msgpack:"dependencies"` PackageUri string `msgpack:"packageUri,omitempty"` Type string `msgpack:"type"` ProjectFileUri string `msgpack:"projectFileUri,omitempty"` - Checksums *Checksums `msgpack:"checksums,omitempty"` - Dependencies map[string]*ProjectOrDependency `msgpack:"dependencies"` } type Http struct { - CaCertificates []byte `msgpack:"caCertificates,omitempty"` Proxy *Proxy `msgpack:"proxy,omitempty"` Rewrites map[string]string `msgpack:"rewrites,omitempty"` + CaCertificates []byte `msgpack:"caCertificates,omitempty"` } type Proxy struct { @@ -128,11 +128,11 @@ func (msg *CloseEvaluator) ToMsgPack() ([]byte, error) { } type Evaluate struct { - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` ModuleUri string `msgpack:"moduleUri"` ModuleText string `msgpack:"moduleText,omitempty"` Expr string `msgpack:"expr,omitempty"` + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } func (msg *Evaluate) ToMsgPack() ([]byte, error) { @@ -140,10 +140,10 @@ func (msg *Evaluate) ToMsgPack() ([]byte, error) { } type ReadResourceResponse struct { + Error string `msgpack:"error,omitempty"` + Contents []byte `msgpack:"contents,omitempty"` RequestId int64 `msgpack:"requestId"` EvaluatorId int64 `msgpack:"evaluatorId"` - Contents []byte `msgpack:"contents,omitempty"` - Error string `msgpack:"error,omitempty"` } func (msg *ReadResourceResponse) ToMsgPack() ([]byte, error) { @@ -151,10 +151,10 @@ func (msg *ReadResourceResponse) ToMsgPack() ([]byte, error) { } type ReadModuleResponse struct { - RequestId int64 `msgpack:"requestId"` - EvaluatorId int64 `msgpack:"evaluatorId"` Contents string `msgpack:"contents,omitempty"` Error string `msgpack:"error,omitempty"` + RequestId int64 `msgpack:"requestId"` + EvaluatorId int64 `msgpack:"evaluatorId"` } func (msg *ReadModuleResponse) ToMsgPack() ([]byte, error) { @@ -162,10 +162,10 @@ func (msg *ReadModuleResponse) ToMsgPack() ([]byte, error) { } type ListResourcesResponse struct { + Error string `msgpack:"error,omitempty"` + PathElements []*PathElement `msgpack:"pathElements,omitempty"` RequestId int64 `msgpack:"requestId"` EvaluatorId int64 `msgpack:"evaluatorId"` - PathElements []*PathElement `msgpack:"pathElements,omitempty"` - Error string `msgpack:"error,omitempty"` } func (msg ListResourcesResponse) ToMsgPack() ([]byte, error) { @@ -173,10 +173,10 @@ func (msg ListResourcesResponse) ToMsgPack() ([]byte, error) { } type ListModulesResponse struct { + Error string `msgpack:"error,omitempty"` + PathElements []*PathElement `msgpack:"pathElements,omitempty"` RequestId int64 `msgpack:"requestId"` EvaluatorId int64 `msgpack:"evaluatorId"` - PathElements []*PathElement `msgpack:"pathElements,omitempty"` - Error string `msgpack:"error,omitempty"` } func (msg ListModulesResponse) ToMsgPack() ([]byte, error) { @@ -189,8 +189,8 @@ type PathElement struct { } type InitializeModuleReaderResponse struct { - RequestId int64 `msgpack:"requestId"` Spec *ModuleReader `msgpack:"spec,omitempty"` + RequestId int64 `msgpack:"requestId"` } func (msg InitializeModuleReaderResponse) ToMsgPack() ([]byte, error) { @@ -198,8 +198,8 @@ func (msg InitializeModuleReaderResponse) ToMsgPack() ([]byte, error) { } type InitializeResourceReaderResponse struct { - RequestId int64 `msgpack:"requestId"` Spec *ResourceReader `msgpack:"spec,omitempty"` + RequestId int64 `msgpack:"requestId"` } func (msg InitializeResourceReaderResponse) ToMsgPack() ([]byte, error) { diff --git a/pkl/internal/version.go b/pkl/internal/version.go index e63fbe6b..cbab0fc6 100644 --- a/pkl/internal/version.go +++ b/pkl/internal/version.go @@ -46,17 +46,17 @@ var PklVersion0_29 = MustParseSemver("0.29.0") var PklVersion0_30 = MustParseSemver("0.30.0") type Semver struct { - major int - minor int - patch int prerelease string build string prereleaseIdentifiers []prereleaseIdentifier + major int + minor int + patch int } type prereleaseIdentifier struct { - numericId int alphaNumericId string + numericId int } func (i prereleaseIdentifier) compareTo(other prereleaseIdentifier) int { diff --git a/pkl/project.go b/pkl/project.go index 3f640efc..a4b3e1f2 100644 --- a/pkl/project.go +++ b/pkl/project.go @@ -30,17 +30,17 @@ func init() { // Project is the go representation of pkl.Project. type Project struct { - ProjectFileUri string `pkl:"projectFileUri"` - Package *ProjectPackage `pkl:"package"` - EvaluatorSettings ProjectEvaluatorSettings `pkl:"evaluatorSettings"` - Tests []string `pkl:"tests"` - Annotations []Object `pkl:"annotations"` + Package *ProjectPackage `pkl:"package"` // internal field; use Project.Dependencies instead. // values are either Project or ProjectRemoteDependency RawDependencies map[string]any `pkl:"dependencies"` - dependencies *ProjectDependencies `pkl:"-"` + dependencies *ProjectDependencies `pkl:"-"` + ProjectFileUri string `pkl:"projectFileUri"` + Tests []string `pkl:"tests"` + Annotations []Object `pkl:"annotations"` + EvaluatorSettings ProjectEvaluatorSettings `pkl:"evaluatorSettings"` } // ProjectPackage is the go representation of pkl.Project#Package. @@ -50,7 +50,6 @@ type ProjectPackage struct { Version string `pkl:"version"` PackageZipUrl string `pkl:"packageZipUrl"` Description string `pkl:"description"` - Authors []string `pkl:"authors"` Website string `pkl:"website"` Documentation string `pkl:"documentation"` SourceCode string `pkl:"sourceCode"` @@ -58,9 +57,10 @@ type ProjectPackage struct { License string `pkl:"license"` LicenseText string `pkl:"licenseText"` IssueTracker string `pkl:"issueTracker"` + Uri string `pkl:"uri"` + Authors []string `pkl:"authors"` ApiTests []string `pkl:"apiTests"` Exclude []string `pkl:"exclude"` - Uri string `pkl:"uri"` } // ProjectEvaluatorSettings is the Go representation of pkl.EvaluatorSettings @@ -70,15 +70,15 @@ type ProjectEvaluatorSettings struct { AllowedModules *[]string `pkl:"allowedModules"` AllowedResources *[]string `pkl:"allowedResources"` NoCache *bool `pkl:"noCache"` - ModulePath []string `pkl:"modulePath"` - Timeout Duration `pkl:"timeout"` - ModuleCacheDir string `pkl:"moduleCacheDir"` - RootDir string `pkl:"rootDir"` Http *ProjectEvaluatorSettingsHttp `pkl:"http"` - Color string `pkl:"color"` ExternalModuleReaders map[string]ProjectEvaluatorSettingExternalReader `pkl:"externalModuleReaders"` ExternalResourceReaders map[string]ProjectEvaluatorSettingExternalReader `pkl:"externalResourceReaders"` TraceMode *TraceMode `pkl:"traceMode"` + ModuleCacheDir string `pkl:"moduleCacheDir"` + RootDir string `pkl:"rootDir"` + Color string `pkl:"color"` + ModulePath []string `pkl:"modulePath"` + Timeout Duration `pkl:"timeout"` } // ProjectEvaluatorSettingsHttp is the Go representation of pkl.EvaluatorSettings.Http diff --git a/pkl/test_fixtures/gen/classes/Cat.pkl.go b/pkl/test_fixtures/gen/classes/Cat.pkl.go index 40534d6a..a2fecd40 100644 --- a/pkl/test_fixtures/gen/classes/Cat.pkl.go +++ b/pkl/test_fixtures/gen/classes/Cat.pkl.go @@ -10,9 +10,8 @@ type Cat interface { var _ Cat = CatImpl{} type CatImpl struct { - Meows bool `pkl:"meows"` - - Name string `pkl:"name"` + Name string `pkl:"name"` + Meows bool `pkl:"meows"` } func (rcv CatImpl) GetMeows() bool { diff --git a/pkl/test_fixtures/gen/classes/Classes.pkl.go b/pkl/test_fixtures/gen/classes/Classes.pkl.go index 80962c56..f96024bf 100644 --- a/pkl/test_fixtures/gen/classes/Classes.pkl.go +++ b/pkl/test_fixtures/gen/classes/Classes.pkl.go @@ -8,12 +8,12 @@ import ( ) type Classes struct { + MyAnimal Animal `pkl:"myAnimal"` + Animals []Animal `pkl:"animals"` NullableAnimals []*Animal `pkl:"nullableAnimals"` - MyAnimal Animal `pkl:"myAnimal"` - House House `pkl:"house"` } diff --git a/pkl/test_fixtures/gen/classes/Dog.pkl.go b/pkl/test_fixtures/gen/classes/Dog.pkl.go index ccff6b2f..5e61f00a 100644 --- a/pkl/test_fixtures/gen/classes/Dog.pkl.go +++ b/pkl/test_fixtures/gen/classes/Dog.pkl.go @@ -12,11 +12,10 @@ type Dog interface { var _ Dog = DogImpl{} type DogImpl struct { - Barks bool `pkl:"barks"` - Breed string `pkl:"breed"` - Name string `pkl:"name"` + Name string `pkl:"name"` + Barks bool `pkl:"barks"` } func (rcv DogImpl) GetBarks() bool { diff --git a/pkl/test_fixtures/gen/collections/Collections.pkl.go b/pkl/test_fixtures/gen/collections/Collections.pkl.go index 954bdf95..3a5976e3 100644 --- a/pkl/test_fixtures/gen/collections/Collections.pkl.go +++ b/pkl/test_fixtures/gen/collections/Collections.pkl.go @@ -8,13 +8,9 @@ import ( ) type Collections struct { - Res1 []int `pkl:"res1"` - - Res2 []int `pkl:"res2"` - - Res3 [][]int `pkl:"res3"` + Res12 pkl.Pair[any, any] `pkl:"res12"` - Res4 [][]int `pkl:"res4"` + Res13 pkl.Pair[int, *int] `pkl:"res13"` Res5 map[int]bool `pkl:"res5"` @@ -28,13 +24,17 @@ type Collections struct { Res10 map[int8]struct{} `pkl:"res10"` - Res11 pkl.Pair[int, float64] `pkl:"res11"` + Res1 []int `pkl:"res1"` - Res12 pkl.Pair[any, any] `pkl:"res12"` + Res2 []int `pkl:"res2"` - Res13 pkl.Pair[int, *int] `pkl:"res13"` + Res3 [][]int `pkl:"res3"` + + Res4 [][]int `pkl:"res4"` Res14 []byte `pkl:"res14"` + + Res11 pkl.Pair[int, float64] `pkl:"res11"` } // LoadFromPath loads the pkl module at the given path and evaluates it into a Collections diff --git a/pkl/test_fixtures/gen/primitives/Primitives.pkl.go b/pkl/test_fixtures/gen/primitives/Primitives.pkl.go index c0db1dad..e8388f30 100644 --- a/pkl/test_fixtures/gen/primitives/Primitives.pkl.go +++ b/pkl/test_fixtures/gen/primitives/Primitives.pkl.go @@ -8,33 +8,33 @@ import ( ) type Primitives struct { + Res11 any `pkl:"res11"` + Res0 string `pkl:"res0"` Res1 int `pkl:"res1"` - Res2 int8 `pkl:"res2"` - - Res3 int16 `pkl:"res3"` + Res5 uint `pkl:"res5"` - Res4 int32 `pkl:"res4"` + Res9 float64 `pkl:"res9"` - Res5 uint `pkl:"res5"` + Res12 float64 `pkl:"res12"` - Res6 uint8 `pkl:"res6"` + Res13 float64 `pkl:"res13"` - Res7 uint16 `pkl:"res7"` + Res4 int32 `pkl:"res4"` Res8 uint32 `pkl:"res8"` - Res9 float64 `pkl:"res9"` + Res3 int16 `pkl:"res3"` - Res10 bool `pkl:"res10"` + Res7 uint16 `pkl:"res7"` - Res11 any `pkl:"res11"` + Res2 int8 `pkl:"res2"` - Res12 float64 `pkl:"res12"` + Res6 uint8 `pkl:"res6"` - Res13 float64 `pkl:"res13"` + Res10 bool `pkl:"res10"` } // LoadFromPath loads the pkl module at the given path and evaluates it into a Primitives