##// END OF EJS Templates
Rework variant artifacts materialization model...
Rework variant artifacts materialization model Refactor VariantArtifactsPlugin around a live outgoing artifacts context and split artifact publication into explicit internal services: outgoing variant registry, assembly binding, materialization policy hooks, primary-slot convention, and slot assembly handling. Introduce variant artifact slots as identity-first public API and expose materialized assembly handles through ArtifactAssemblies. Add replayable configuration hooks for outgoing configurations, outgoing slots, outgoing variants, and registered assemblies. Create consumable outgoing configurations per variant, bind the primary slot to the root outgoing artifact set, and publish non-primary slots as Gradle outgoing configuration variants. Add deterministic injective task names for slot assembly tasks, use Sync for directory assembly, and configure the default assembly output location under build/variant-assemblies. Make primary-slot selection finalize-on-read and provide a single-slot convention that fails when no unique default can be inferred. Mark artifact internal implementation package as non-public API.

File last commit:

r26:2ed527593ad4 default
r51:9db7822cd26c default
Show More
sources-plugin.md
83 lines | 2.9 KiB | text/x-minidsrc | MarkdownLexer
cin
implemented variants model, variants-sources adapter
r26 # Sources Plugin
## NAME
`SourcesPlugin` и extension `sources`.
## SYNOPSIS
```groovy
// Обычно подключается транзитивно через org.implab.gradle-variants-sources
sources {
register('main') {
declareOutputs('compiled', 'typings')
sets {
ts { srcDir 'src/main/ts' }
js { srcDir 'src/main/js' }
}
}
}
```
## DESCRIPTION
`SourcesPlugin` регистрирует extension `sources` типа
`NamedDomainObjectContainer<GenericSourceSet>`.
`GenericSourceSet` — это автономный source bundle с четким контрактом outputs.
### sourceSetDir
Базовый каталог набора. Конвенция по умолчанию: `src/<name>`.
### outputsDir
Базовый каталог результатов набора. Конвенция по умолчанию: `build/<name>`.
### sets
Контейнер `SourceDirectorySet` внутри `GenericSourceSet`. Используется для
логического разделения подпапок (например `ts`, `js`, `typings`).
### outputs contract
Outputs именованные и должны быть объявлены заранее:
- `declareOutputs(...)` — декларация доступных output keys;
- `output(name)` — доступ к `ConfigurableFileCollection` для output key;
- `registerOutput(...)` — регистрация output из файлов или task provider.
Такой контракт упрощает wiring задач через inputs/outputs без ручного
`dependsOn`.
## API
### SourcesPlugin
- `apply(Project)` — добавляет extension `sources` в проект.
- `getSourcesExtension(Project)` — возвращает контейнер `GenericSourceSet`.
### GenericSourceSet
- `getSourceSetDir()` — root directory источников набора.
- `getOutputsDir()` — root directory результатов набора.
- `getSets()` — контейнер поднаборов `SourceDirectorySet`.
- `declareOutputs(...)` — объявляет разрешенные output names.
- `output(name)` — возвращает `FileCollection` для конкретного output.
- `registerOutput(name, files...)` — добавляет файлы в output.
- `registerOutput(name, task, mapper)` — связывает output с task provider.
- `getAllOutputs()` — агрегированный `FileCollection` всех outputs.
- `getAllSourceDirectories()` — агрегированный `FileCollection` всех source dirs.
## KEY CLASSES
- `SourcesPlugin` — регистрация extension `sources`.
- `GenericSourceSet` — модель источников и outputs.
## NOTES
- Обращение к `output(name)` без предварительного `declareOutputs(name)`
приводит к ошибке валидации.
- Плагин `sources` сейчас без marker id.