Compare commits

..

2 Commits

Author SHA1 Message Date
Jesse Brault
43008cf0d7 Add profiling option, update CLI displayed version. 2025-11-08 16:15:03 -06:00
Jesse Brault
8d461e2cc4 Upgrade to Gradle 9.2.0/Java 25. 2025-11-08 11:14:06 -06:00
8 changed files with 30 additions and 7 deletions

View File

@ -41,7 +41,7 @@ java {
}
jar {
archivesBaseName = 'ssg-api'
archiveBaseName = 'ssg-api'
}
sourcesJar {

View File

@ -1,5 +1,5 @@
plugins {
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.convert' version '4.0.5'
}
repositories {

View File

@ -36,7 +36,7 @@ dependencies {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(25)
}
}

View File

@ -22,7 +22,7 @@ dependencies {
}
application {
mainClassName = 'com.jessebrault.ssg.StaticSiteGeneratorCli'
mainClass = 'com.jessebrault.ssg.StaticSiteGeneratorCli'
applicationName = 'ssg'
}
@ -31,7 +31,7 @@ java {
}
jar {
archivesBaseName = 'ssg-cli'
archiveBaseName = 'ssg-cli'
}
sourcesJar {

View File

@ -68,6 +68,12 @@ abstract class AbstractBuildCommand extends AbstractSubCommand {
)
boolean dryRun
@CommandLine.Option(
names = ['--profile'],
description = 'Log elapsed times for build steps.'
)
boolean profile
protected StaticSiteGenerator staticSiteGenerator = null
protected final Integer doSingleBuild(String buildName) {
@ -77,6 +83,7 @@ abstract class AbstractBuildCommand extends AbstractSubCommand {
def groovyClassLoader = new GroovyClassLoader(this.class.classLoader)
if (this.gradle) {
def gradleStartTime = System.currentTimeMillis()
def projectConnection = GradleConnector.newConnector()
.forProjectDirectory(
this.commonCliOptions.projectDir.toPath().resolve(this.gradleProjectDir).toFile()
@ -97,6 +104,11 @@ abstract class AbstractBuildCommand extends AbstractSubCommand {
projectConnection.newBuild().forTasks('ssgJars').run()
projectConnection.close()
if (this.profile) {
def gradleElapsedTime = System.currentTimeMillis() - gradleStartTime
logger.info("Gradle connection elapsed time: ${gradleElapsedTime / 1000} seconds")
}
}
this.libDirs.each { libDir ->
@ -123,6 +135,8 @@ abstract class AbstractBuildCommand extends AbstractSubCommand {
)
}
def buildStartTime = System.currentTimeMillis()
final Collection<Diagnostic> diagnostics = this.staticSiteGenerator.doBuild(
this.commonCliOptions.projectDir,
buildName,
@ -130,6 +144,11 @@ abstract class AbstractBuildCommand extends AbstractSubCommand {
this.scriptArgs ?: [:]
)
def buildElapsedTime = System.currentTimeMillis() - buildStartTime
if (this.profile) {
logger.info("Build $buildName elapsed time: ${buildElapsedTime / 1000} seconds")
}
if (!diagnostics.isEmpty()) {
diagnostics.each {
logger.error(it.message)

View File

@ -5,7 +5,7 @@ import picocli.CommandLine
@CommandLine.Command(
name = 'ssg',
mixinStandardHelpOptions = true,
version = '0.4.0',
version = '0.6.0-SNAPSHOT',
description = 'A static site generator which can interface with Gradle for high extensibility.',
subcommands = [SsgInit, SsgBuild, SsgWatch]
)

View File

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

View File

@ -21,6 +21,10 @@ java {
withSourcesJar()
}
tasks.withType(AbstractTestTask).configureEach {
failOnNoDiscoveredTests = false
}
publishing {
publications {
create('ssgGradlePlugin', MavenPublication) {