Compare commits

...

21 Commits

Author SHA1 Message Date
Jesse Brault
e97381687a Add installDist step before release step.
All checks were successful
Ssg Check, Publish, and Release / ci (push) Successful in 2m50s
2025-06-30 19:47:27 -05:00
Jesse Brault
1826b9bc58 Change out release action.
All checks were successful
Ssg Check, Publish, and Release / ci (push) Successful in 2m46s
2025-06-30 15:03:35 -05:00
Jesse Brault
90a2769fb7 Remove jbArchiva plugin and switch to Gitea maven.
Some checks failed
Ssg Check, Publish, and Release / ci (push) Failing after 2m55s
2025-06-30 08:04:54 -05:00
Jesse Brault
aa44f0550d Update sourcesJar base name.
Some checks failed
Ssg Check, Publish, and Release / ci (push) Has been cancelled
2025-06-30 07:49:31 -05:00
Jesse Brault
5b53676a82 Version bump. 2025-06-30 07:48:16 -05:00
Jesse Brault
ad2b24754f Replace old GitHub workflow with Gitea workflow. 2025-06-30 07:47:38 -05:00
Jesse Brault
6ef7fb0117 Switch to new com.jessebrault.di/fp. 2025-06-30 07:38:25 -05:00
Jesse Brault
807556cd73 Update dependencies. 2025-06-01 14:43:44 -05:00
Jesse Brault
ab5b678920 Fix bug with compileUnit not seeing all ssg-gradle found classpath. 2025-05-31 23:07:06 -05:00
Jesse Brault
82a8be76b5 Work on 0.5.0-SNAPSHOT; various updates and such. 2025-05-31 20:43:40 -05:00
Jesse Brault
4757a2e9a5 Delete old test-ssg-project which was causing problems. 2025-05-31 20:08:56 -05:00
Jesse Brault
3170d2b2e9 Drop redundant 'ssg' from Maven coordinates. 2025-02-16 18:27:43 -06:00
Jesse Brault
57fa73f4c3 Set to 0.4.3-SNAPSHOT. 2025-02-16 18:25:42 -06:00
Jesse Brault
1799db2e37 Upgrade groowt and groovy dependencies. 2025-02-16 18:13:41 -06:00
Jesse Brault
753f3b67b1 Updated to Gradle 8.9 and jbarchiva 0.2.2. 2024-07-17 14:56:50 -05:00
JesseBrault0709
894bd55033 Added a todo. 2024-06-14 15:18:16 +02:00
JesseBrault0709
8355ec548b Added a todo. 2024-06-14 12:52:02 +02:00
JesseBrault0709
dfc9324a23 TODO and a bit of clean up. 2024-06-14 12:48:58 +02:00
JesseBrault0709
779cd26753 Updated test project. 2024-06-14 12:45:42 +02:00
JesseBrault0709
ae625d1229 Big update to TODO. 2024-06-14 12:40:44 +02:00
JesseBrault0709
0d7544f202 Move to v0.4.2.
Some checks failed
StaticSiteGenerator Release / release (push) Has been cancelled
2024-06-13 22:13:36 +02:00
55 changed files with 264 additions and 664 deletions

View File

@ -0,0 +1,28 @@
name: Ssg Check, Publish, and Release
on:
push:
tags:
- v*
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Java.
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Check libraries
run: ./gradlew check
- name: Publish to git.jessebrault.com
run: ./gradlew publishAllPublicationsToGiteaRepository
- name: Create install distribution
run: ./gradlew installDist
- name: Release cli to git.jessebrault.com
uses: akkuman/gitea-release-action@v1
with:
files: |-
cli/build/distributions/*.tar
cli/build/distributions/*.zip

View File

@ -1,29 +0,0 @@
name: StaticSiteGenerator Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
cache: gradle
- name: Gradle Test
run: ./gradlew test
- name: Gradle Install
run: ./gradlew :cli:assembleDist
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: 'cli/build/distributions/*.tar,cli/build/distributions/*.zip'
name: ${{ env.GITHUB_REF_NAME }}
tag: ${{ env.GITHUB_REF_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,16 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="debug-test-project" type="Remote">
<module name="ssg" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="localhost" />
<option name="PORT" value="8192" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="8192" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>

View File

@ -1,19 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="launch-debug-test-project" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/test-ssg-project/bin/ssg" />
<option name="SCRIPT_OPTIONS" value="--debug build -g --dry-run -b default" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/test-ssg-project" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/usr/bin/env" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="publishToMavenLocal" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>

View File

@ -1,19 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="run-test-project" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/test-ssg-project/bin/ssg" />
<option name="SCRIPT_OPTIONS" value="build --log-level=debug --gradle --dry-run --build default" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/test-ssg-project" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/usr/bin/env" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="false" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="publishToMavenLocal" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# Static Site Generator (SSG)
## Updating Gradle
Update the Gradle wrapper via `gradle/wrapper/gradle-wrapper.properties`. Make sure that the tooling-api dependency is
updated to the same version in `cli/build.gradle`.
## Version-bumping
Update the version of the project in `buildSrc/src/main/groovy/ssg-common.gradle`. Then update the references to the
`cli` and `api` projects in `ssg-gradle-plugin/src/main/java/com/jessebrault/ssg/gradle/SsgGradlePlugin.java`.
## Publishing
Gradle command `publishAllPublicationsToJbArchiva<Internal|Snapshots>Repository`. Which one of `internal` or `snapshots`
appears depends on the current version.

59
TODO.md
View File

@ -1,52 +1,41 @@
# TODO
Here will be kept all of the various todos for this project, organized by release.
N.b. that v0.3.0 was skipped because of such a fundamental change in the usage of the
program with the incorporation of Groowt and Web View Components.
## 0.4.2
## 0.6.0
- [ ] Plugin system for build scripts
## 0.5.0
- [ ] watch/dev mode and server
- [ ] Reorganize gradle project layout so there is less hunting around for files
## 0.4.* Ongoing
- [ ] Automate test project
- [ ] Move as much gradle integration from `cli` project to `api` project
- [ ] Think about abstracting the build tool logic, because all we need
really is the URLs/Paths for the classes/jars of components and resources
- [ ] Document new api and usage.
- [ ] Re-incorporate dist plugin in gradle build of cli/api
- [ ] Think about how these might be used without a gradle project backing
## 0.4.3
- [ ] `Text` component for simply rendering Text objects. Can be used as such:
```
<Text path='/SomeText.md' />
<Text name='SomeText.md' />
<Text text={text} />
```
- [ ] `TextContainer` for accessing all found texts
- [ ] `ModelFactory` for creating models, and `TextModelFactory` for creating models from texts.
- [ ] `Model` component for rendering a model with either a supplied renderer, or a registered `ModelRenderer`
- [ ] `Global` component for rendering globals.
- [ ] Automatically inject self PageSpec and path to Pages.
## 0.4.1
- [x] Update groowt to 0.1.2.
## Future
### Add
- [ ] Plan out plugin system such that we can create custom providers of texts, data, etc.
- [ ] Add `Watchable` interface/trait back; an abstraction over FS watching and other sources (such as a database, etc.).
- [ ] Explore `apply(Plugin)` in buildScripts.
### Fix
## v0.2.0
### Add
- [ ] Write manual.
- [x] Remove `lib` module.
- [x] Add a way for CLI to choose a build to do, or multiple builds, defaulting to 'default' if it exists.
- [ ] Still must work on 'default'-ing.
- [x] Write lots of tests for buildscript dsl, etc.
- [x] Explore `base` in buildScript dsl.
- Get rid of `allBuilds` concept, and replace it with composable/concat-able builds. In the dsl we could have a notion of `abstractBuild` which can be 'extended' (i.e., on the left side of a concat operation) but not actually run (since it doesn't have a name).
- `OutputDir` should be concat-able, such that the left is the *base* for the right.
- `OutputDirFunctions.concat` should be concat-able as well, such that both are `BiFunction<OutputDir, Build, OutputDir>`, and the output of the left is the input of the right.
- Make the delegates as dumb as possible; no more `getResult` methods; make different classes/object handle concat'ing and getting results.
- [x] Provide a way to override `ssgBuilds` variables from the cli.
### Fix
- [ ] Update CHANGELOG to reflect the gsp-dsl changes.
- [ ] `taskTypes` gone, use class name instead
- [ ] introduction of `models`
- [x] Change most instances of `Closure<Void>` to `Closure<?>` to help with IDE expectations.
- [ ] Fix auto-imports in build script so we don't need to import things.
- [x] Re-introduce input/output concept to tasks, if possible
## Finished
### v0.2.0
- [x] Investigate imports, including static, in scripts
- Does not work; must use binding

View File

@ -8,7 +8,6 @@ plugins {
repositories {
mavenCentral()
mavenLocal()
}
configurations {
@ -20,7 +19,12 @@ configurations {
dependencies {
api libs.groovy
api libs.groovy.yaml
api libs.groowt.all
api libs.groowt.v
api libs.groowt.vc
api libs.groowt.wvc
api libs.di
api libs.fp
compileOnlyApi libs.jetbrains.anontations
@ -29,7 +33,7 @@ dependencies {
implementation libs.commonmark.frontmatter
implementation libs.jsoup
runtimeOnly libs.groowt.wvcCompiler
runtimeOnly libs.groowt.wvcc
}
java {
@ -40,10 +44,14 @@ jar {
archivesBaseName = 'ssg-api'
}
sourcesJar {
archiveBaseName = 'ssg-api'
}
publishing {
publications {
create('ssgApi', MavenPublication) {
artifactId = 'ssg-api'
artifactId = 'api'
from components.java
}
}

View File

@ -16,10 +16,9 @@ import com.jessebrault.ssg.view.SkipTemplate
import com.jessebrault.ssg.view.WvcCompiler
import com.jessebrault.ssg.view.WvcPageView
import groovy.transform.TupleConstructor
import groowt.util.di.ObjectFactory
import groowt.util.di.RegistryObjectFactory
import groowt.util.fp.option.Option
import groowt.view.component.compiler.DefaultComponentTemplateCompilerConfiguration
import com.jessebrault.di.ObjectFactory
import com.jessebrault.di.RegistryObjectFactory
import com.jessebrault.fp.option.Option
import groowt.view.component.compiler.SimpleComponentTemplateClassFactory
import groowt.view.component.factory.ComponentFactories
import groowt.view.component.web.DefaultWebViewComponentContext
@ -33,8 +32,8 @@ import org.slf4j.LoggerFactory
import java.nio.file.Files
import java.nio.file.Path
import static groowt.util.di.BindingUtil.named
import static groowt.util.di.BindingUtil.toSingleton
import static com.jessebrault.di.BindingUtil.named
import static com.jessebrault.di.BindingUtil.toSingleton
@TupleConstructor(includeFields = true, defaults = false)
class DefaultStaticSiteGenerator implements StaticSiteGenerator {
@ -72,10 +71,7 @@ class DefaultStaticSiteGenerator implements StaticSiteGenerator {
}
protected WvcCompiler getWvcCompiler() {
def wvcCompilerConfiguration = new DefaultComponentTemplateCompilerConfiguration()
wvcCompilerConfiguration.groovyClassLoader = this.groovyClassLoader
def templateClassFactory = new SimpleComponentTemplateClassFactory(this.groovyClassLoader)
new WvcCompiler(wvcCompilerConfiguration, templateClassFactory)
new WvcCompiler(this.groovyClassLoader, new SimpleComponentTemplateClassFactory(this.groovyClassLoader))
}
protected WebViewComponentContext makeContext(

View File

@ -4,8 +4,8 @@ import com.jessebrault.ssg.model.Model
import com.jessebrault.ssg.text.TextConverter
import groovy.transform.EqualsAndHashCode
import groovy.transform.NullCheck
import groowt.util.di.RegistryObjectFactory
import groowt.util.fp.provider.Provider
import com.jessebrault.di.RegistryObjectFactory
import com.jessebrault.fp.provider.Provider
import static com.jessebrault.ssg.util.ObjectUtil.requireProvider
import static com.jessebrault.ssg.util.ObjectUtil.requireString

View File

@ -5,13 +5,13 @@ import com.jessebrault.ssg.model.Models
import com.jessebrault.ssg.text.MarkdownTextConverter
import com.jessebrault.ssg.text.TextConverter
import com.jessebrault.ssg.util.PathUtil
import groowt.util.di.DefaultRegistryObjectFactory
import groowt.util.di.RegistryObjectFactory
import groowt.util.fp.property.DefaultProperty
import groowt.util.fp.property.Property
import groowt.util.fp.provider.DefaultProvider
import groowt.util.fp.provider.NamedProvider
import groowt.util.fp.provider.Provider
import com.jessebrault.di.DefaultRegistryObjectFactory
import com.jessebrault.di.RegistryObjectFactory
import com.jessebrault.fp.property.DefaultProperty
import com.jessebrault.fp.property.Property
import com.jessebrault.fp.provider.DefaultProvider
import com.jessebrault.fp.provider.NamedProvider
import com.jessebrault.fp.provider.Provider
import java.nio.file.Path
import java.util.function.Supplier

View File

@ -1,11 +1,11 @@
package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.QualifierHandlerContainer
import groowt.util.di.RegistryExtension
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension
import com.jessebrault.di.SingletonBinding
import java.lang.annotation.Annotation

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectModelQualifierHandler implements QualifierHandler<InjectModel> {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectModelsQualifierHandler implements QualifierHandler<InjectModels> {

View File

@ -2,9 +2,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectPageQualifierHandler implements QualifierHandler<InjectPage> {

View File

@ -3,9 +3,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page
import com.jessebrault.ssg.util.Glob
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectPagesQualifierHandler implements QualifierHandler<InjectPages> {

View File

@ -2,9 +2,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectTextQualifierHandler implements QualifierHandler<InjectText> {

View File

@ -3,9 +3,9 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text
import com.jessebrault.ssg.util.Glob
import groovy.transform.TupleConstructor
import groowt.util.di.Binding
import groowt.util.di.QualifierHandler
import groowt.util.di.SingletonBinding
import com.jessebrault.di.Binding
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.SingletonBinding
@TupleConstructor(includeFields = true)
class InjectTextsQualifierHandler implements QualifierHandler<InjectTexts> {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di
import com.jessebrault.ssg.model.Model
import groowt.util.di.QualifierHandler
import groowt.util.di.QualifierHandlerContainer
import groowt.util.di.RegistryExtension
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension
import java.lang.annotation.Annotation

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page
import groowt.util.di.QualifierHandler
import groowt.util.di.QualifierHandlerContainer
import groowt.util.di.RegistryExtension
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension
import java.lang.annotation.Annotation

View File

@ -2,7 +2,7 @@ package com.jessebrault.ssg.di
import com.jessebrault.ssg.page.Page
import groovy.transform.TupleConstructor
import groowt.util.di.*
import com.jessebrault.di.*
import java.lang.annotation.Annotation

View File

@ -1,6 +1,6 @@
package com.jessebrault.ssg.di;
import groowt.util.di.*;
import com.jessebrault.di.*;
import jakarta.inject.Named;
import org.jetbrains.annotations.Nullable;

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.di
import groowt.util.di.DefaultRegistryObjectFactory
import groowt.util.di.RegistryObjectFactory
import com.jessebrault.di.DefaultRegistryObjectFactory
import com.jessebrault.di.RegistryObjectFactory
final class SsgObjectFactoryUtil {

View File

@ -1,9 +1,9 @@
package com.jessebrault.ssg.di
import com.jessebrault.ssg.text.Text
import groowt.util.di.QualifierHandler
import groowt.util.di.QualifierHandlerContainer
import groowt.util.di.RegistryExtension
import com.jessebrault.di.QualifierHandler
import com.jessebrault.di.QualifierHandlerContainer
import com.jessebrault.di.RegistryExtension
import java.lang.annotation.Annotation

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.model
import groowt.util.fp.provider.NamedProvider
import groowt.util.fp.provider.Provider
import com.jessebrault.fp.provider.NamedProvider
import com.jessebrault.fp.provider.Provider
import java.util.function.Supplier

View File

@ -4,7 +4,7 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.NullCheck
import groovy.transform.PackageScope
import groovy.transform.TupleConstructor
import groowt.util.fp.provider.Provider
import com.jessebrault.fp.provider.Provider
@PackageScope
@TupleConstructor(includeFields = true, defaults = false)

View File

@ -5,8 +5,8 @@ import com.jessebrault.ssg.util.Diagnostic
import com.jessebrault.ssg.view.PageView
import com.jessebrault.ssg.view.WvcCompiler
import com.jessebrault.ssg.view.WvcPageView
import groowt.util.di.RegistryObjectFactory
import groowt.util.fp.either.Either
import com.jessebrault.di.RegistryObjectFactory
import com.jessebrault.fp.either.Either
class DefaultWvcPage extends AbstractPage implements Page {

View File

@ -2,7 +2,7 @@ package com.jessebrault.ssg.page
import com.jessebrault.ssg.util.Diagnostic
import com.jessebrault.ssg.view.PageView
import groowt.util.fp.either.Either
import com.jessebrault.fp.either.Either
interface Page {

View File

@ -1,7 +1,7 @@
package com.jessebrault.ssg.util
import groowt.util.fp.property.Property
import groowt.util.fp.provider.Provider
import com.jessebrault.fp.property.Property
import com.jessebrault.fp.provider.Provider
import static java.util.Objects.requireNonNull

View File

@ -2,18 +2,32 @@ package com.jessebrault.ssg.view
import com.jessebrault.ssg.util.Diagnostic
import groovy.transform.TupleConstructor
import groowt.util.fp.either.Either
import com.jessebrault.fp.either.Either
import groowt.view.component.ComponentTemplate
import groowt.view.component.ViewComponent
import groowt.view.component.compiler.ComponentTemplateClassFactory
import groowt.view.component.compiler.ComponentTemplateCompilerConfiguration
import groowt.view.component.compiler.source.ComponentTemplateSource
import groowt.view.component.web.compiler.DefaultWebViewComponentTemplateCompileUnit
@TupleConstructor
class WvcCompiler {
final ComponentTemplateCompilerConfiguration compilerConfiguration
private static class SsgWvcTemplateCompileUnit extends DefaultWebViewComponentTemplateCompileUnit {
SsgWvcTemplateCompileUnit(
String descriptiveName,
Class<? extends ViewComponent> forClass,
ComponentTemplateSource source,
String defaultPackageName,
GroovyClassLoader groovyClassLoader
) {
super(descriptiveName, forClass, source, defaultPackageName)
this.groovyCompilationUnit.setClassLoader(groovyClassLoader)
}
}
final GroovyClassLoader groovyClassLoader
final ComponentTemplateClassFactory templateClassFactory
Either<Diagnostic, ComponentTemplate> compileTemplate(
@ -27,13 +41,14 @@ class WvcCompiler {
))
}
def source = ComponentTemplateSource.of(templateUrl)
def compileUnit = new DefaultWebViewComponentTemplateCompileUnit(
def compileUnit = new SsgWvcTemplateCompileUnit(
source.descriptiveName,
componentClass,
source,
componentClass.packageName
componentClass.packageName,
this.groovyClassLoader
)
def compileResult = compileUnit.compile(compilerConfiguration)
def compileResult = compileUnit.compile()
def templateClass = templateClassFactory.getTemplateClass(compileResult)
def componentTemplate = templateClass.getConstructor().newInstance()
return Either.right(componentTemplate)

View File

@ -23,5 +23,5 @@ repositories {
}
dependencies {
implementation 'com.jessebrault.jbarchiva:jbarchiva:0.1.0'
implementation 'com.jessebrault.jbarchiva:jbarchiva:0.2.2'
}

View File

@ -1,13 +1,18 @@
plugins {
id 'com.jessebrault.jbarchiva'
id 'java'
id 'maven-publish'
}
group 'com.jessebrault.ssg'
version '0.4.1'
version '0.6.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = 'Gitea'
url = uri('https://git.jessebrault.com/api/packages/jessebrault/maven')
}
}
configurations {
@ -42,3 +47,21 @@ testing {
}
}
}
publishing {
repositories {
maven {
name = 'Gitea'
url = uri('https://git.jessebrault.com/api/packages/jessebrault/maven')
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token ${System.getenv("GITEA_ACCESS_TOKEN")}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}

View File

@ -8,7 +8,6 @@ plugins {
repositories {
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
mavenLocal()
}
dependencies {
@ -17,7 +16,7 @@ dependencies {
implementation libs.picocli
implementation libs.log4j2.api
implementation libs.log4j2.core
implementation "org.gradle:gradle-tooling-api:8.7"
implementation "org.gradle:gradle-tooling-api:8.14.1"
runtimeOnly libs.log4j2.slf4j2.impl
}
@ -32,7 +31,11 @@ java {
}
jar {
archivesBaseName = "ssg-cli"
archivesBaseName = 'ssg-cli'
}
sourcesJar {
archiveBaseName = 'ssg-cli'
}
distributions {
@ -45,7 +48,7 @@ distributions {
publishing {
publications {
create('ssgCli', MavenPublication) {
artifactId = 'ssg-cli'
artifactId = 'cli'
from components.java
}
}

View File

@ -1,26 +1,39 @@
[versions]
commonmark = '0.22.0'
groovy = '4.0.21'
groowt = '0.1.2'
log4j2 = '2.23.1'
mockito = '5.12.0'
junit = '5.10.2'
classgraph = '4.8.179'
commonmark = '0.24.0'
di = '0.1.0'
fp = '0.1.0'
groovy = '4.0.27'
groowt = '0.1.4'
jetbrains-annotations = '26.0.2'
jsoup = '1.20.1'
junit = '5.13.0'
log4j2 = '2.24.3'
mockito = '5.18.0'
picocli = '4.7.7'
slf4j = '2.0.17'
[libraries]
classgraph = 'io.github.classgraph:classgraph:4.8.172'
classgraph = { module = 'io.github.classgraph:classgraph', version.ref = 'classgraph' }
commonmark = { module = 'org.commonmark:commonmark', version.ref = 'commonmark' }
commonmark-frontmatter = { module = 'org.commonmark:commonmark-ext-yaml-front-matter', version.ref = 'commonmark' }
di = { module = 'com.jessebrault.di:di', version.ref = 'di' }
fp = { module = 'com.jessebrault.fp:fp', version.ref = 'fp' }
groovy = { module = 'org.apache.groovy:groovy', version.ref = 'groovy' }
groovy-yaml = { module = 'org.apache.groovy:groovy-yaml', version.ref = 'groovy' }
groowt-all = { module = 'groowt:groowt-all', version.ref = 'groowt' }
groowt-wvcCompiler = { module = 'groowt:web-view-components-compiler', version.ref = 'groowt' }
jetbrains-anontations = 'org.jetbrains:annotations:24.1.0'
jsoup = 'org.jsoup:jsoup:1.17.2'
groowt-v = { module = 'groowt:views', version.ref = 'groowt' }
groowt-vc = { module = 'groowt:view-components', version.ref = 'groowt' }
groowt-wvc= { module = 'groowt:web-view-components', version.ref = 'groowt' }
groowt-wvcc = { module = 'groowt:web-view-components-compiler', version.ref = 'groowt' }
groowt-fp = { module = 'groowt:util-fp', version.ref = 'groowt' }
groowt-di = { module = 'groowt:util-di', version.ref = 'groowt' }
jetbrains-anontations = { module = 'org.jetbrains:annotations', version.ref = 'jetbrains-annotations' }
jsoup = { module = 'org.jsoup:jsoup', version.ref = 'jsoup' }
junit-jupiter-api = { module = 'org.junit.jupiter:junit-jupiter-api', version.ref = 'junit' }
log4j2-api = { module = 'org.apache.logging.log4j:log4j-api', version.ref = 'log4j2' }
log4j2-core = { module = 'org.apache.logging.log4j:log4j-core', version.ref = 'log4j2' }
log4j2-slf4j2-impl = { module = 'org.apache.logging.log4j:log4j-slf4j2-impl', version.ref = 'log4j2' }
mockito-core = { module = 'org.mockito:mockito-core', version.ref = 'mockito' }
mockito-junit-jupiter = { module = 'org.mockito:mockito-junit-jupiter', version.ref = 'mockito' }
picocli = 'info.picocli:picocli:4.7.6'
slf4j-api = 'org.slf4j:slf4j-api:2.0.13'
picocli = { module = 'info.picocli:picocli', version.ref = 'picocli' }
slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j' }

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

6
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

2
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################

View File

@ -1,4 +1,5 @@
# Targeting 0.4.0: Ideas and Plans
**This file is old as of 06/14/2024.**
Have the following layout of dirs and files. It is a combined gradle/ssg project.
- bin: a folder for shell scripts

View File

@ -162,8 +162,8 @@ public class SsgGradlePlugin implements Plugin<Project> {
Configuration ssgApiConfiguration,
Configuration ssgCliConfiguration
) {
final Dependency ssgApi = project.getDependencies().create("com.jessebrault.ssg:ssg-api:0.4.0");
final Dependency ssgCli = project.getDependencies().create("com.jessebrault.ssg:ssg-cli:0.4.0");
final Dependency ssgApi = project.getDependencies().create("com.jessebrault.ssg:api:0.5.0-SNAPSHOT");
final Dependency ssgCli = project.getDependencies().create("com.jessebrault.ssg:cli:0.5.0-SNAPSHOT");
ssgApiConfiguration.getDependencies().add(ssgApi);
ssgCliConfiguration.getDependencies().add(ssgCli);
}

View File

@ -0,0 +1,35 @@
package com.jessebrault.ssg.gradle;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.io.TempDir;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* This is just a scaffolding test file for the future.
*/
public class SsgGradlePluginTests {
@TempDir
private Path tempDir;
private Path buildFile;
@BeforeEach
public void beforeEach() throws IOException {
buildFile = tempDir.resolve("build.gradle");
Files.writeString(buildFile, """
plugins {
id 'com.jessebrault.ssg'
}
dependencies {
implementation 'org.apache.groovy:groovy:4.0.25'
}
"""
);
}
}

View File

@ -1,5 +0,0 @@
bin
.ssg
testBuild
dist
default

View File

@ -1,12 +0,0 @@
plugins {
id 'com.jessebrault.ssg' version '0.4.0'
}
dependencies {
implementation 'org.apache.groovy:groovy:4.0.21'
}
repositories {
mavenCentral()
mavenLocal()
}

View File

@ -1,14 +0,0 @@
package com.jessebrault.site
import groowt.view.component.web.BaseWebViewComponent
class Head extends BaseWebViewComponent {
final String title
Head(Map attr) {
super(Head.getResource('HeadTemplate.wvc'))
this.title = attr.title
}
}

View File

@ -1,6 +0,0 @@
---
package com.jessebrault.site
---
<head>
<title>$title</title>
</head>

View File

@ -1,7 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,249 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@ -1,92 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,21 +0,0 @@
package com.jessebrault.site
import com.jessebrault.ssg.di.InjectText
import com.jessebrault.ssg.page.PageSpec
import com.jessebrault.ssg.text.Text
import com.jessebrault.ssg.view.WvcPageView
import jakarta.inject.Inject
@PageSpec(name = 'Biography', path = '/biography')
class Biography extends WvcPageView {
static final String greeting = 'Hello, World!'
final Text biographyText
@Inject
Biography(@InjectText('/Biography.md') Text biographyText) {
this.biographyText = biographyText
}
}

View File

@ -1,14 +0,0 @@
---
package com.jessebrault.site
---
<html lang="en">
<Head title={pageTitle} />
<body>
<h1>$pageTitle</h1>
<h2>$url</h2>
<p>$greeting</p>
<section>
<%= biographyText.render() %>
</section>
</body>
</html>

View File

@ -1,7 +0,0 @@
---
package com.jessebrault.site
---
$pageTitle
$url
Hello, World!

View File

@ -1,8 +0,0 @@
pluginManagement {
repositories {
mavenCentral()
mavenLocal()
}
}
rootProject.name = 'test-ssg-project'

View File

@ -1,10 +0,0 @@
import com.jessebrault.ssg.buildscript.BuildScriptBase
import groovy.transform.BaseScript
@BaseScript
BuildScriptBase base
build {
siteName 'My Test Site'
baseUrl 'https://hello.com'
}

View File

@ -1,3 +0,0 @@
# Biography
Hello! My name is Jesse Brault.