Skip to content

Commit

Permalink
update to plugin 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pahjbo committed Apr 26, 2024
1 parent 1acd225 commit ddf9896
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 11 deletions.
8 changes: 6 additions & 2 deletions doc/guide/Transformers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ The models are also transformed into schema that describe the various serializat
VO-DML tooling is to be able to exchange instances of the models between different computer languages, with
all the source code and schema automatically generated.

The gradle plugin does not currently have a task directly to generate XML and RDB schema from the models, however, this can be done
indirectly from the generated Java code as can be seen from the [Small java example](https://github.com/ivoa/vo-dml/tree/master/gradletooling/sample/src/main/java/WriteSampleSchema.java).
The gradle task

```shell
gradle vodmlSchema
```
will generate XML and JSON schema for the model. These schema files will automatically be included withing the jar file for the model.

2 changes: 1 addition & 1 deletion models/ivoa/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("net.ivoa.vo-dml.vodmltools") version "0.4.5"
id("net.ivoa.vo-dml.vodmltools") version "0.5.0"
// id ("com.diffplug.spotless") version "5.17.1"
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
Expand Down
4 changes: 2 additions & 2 deletions runtime/java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ plugins {
signing
}
group = "org.javastro.ivoa.vo-dml"
version = "0.6.1"
version = "0.7.0"


dependencies {
// xjcPlugins("net.codesup.util:jaxb2-rich-contract-plugin:2.1.0")
// implementation("jakarta.persistence:jakarta.persistence-api:3.0.0") // more modern, but perhaps not quite ready
implementation("org.xmlresolver:xmlresolver:6.0.4") // for xml catalogues - note that the apache xml-commons resolver is out of date
implementation("jakarta.xml.bind:jakarta.xml.bind-api:4.0.0")
// implementation("org.glassfish.jaxb:jaxb-runtime:2.3.6")
implementation("jakarta.persistence:jakarta.persistence-api:3.1.0")
Expand Down
1 change: 1 addition & 0 deletions tools/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
* new XML Schema generation
* xml id handling includes vodmlid
* take into account packages.
* 0.5.0 Json Schema Generation (+ new style XSD schema generation)
1 change: 1 addition & 0 deletions tools/gradletooling/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ VODML Tooling TODO
* allow attributes to be
* perhaps standardize on the binding of the ivoa std primitives so that they do not need to be specified in the files
* specialized "hand written" IVOA base schema
* allow "schema fragments" in binding to cope with specialist overriding of primitives and some base dataTypes...
* Anything that might help in mapping to OPENAPI
* idea of a "view" - eg. jobsummary in uws

Expand Down
6 changes: 3 additions & 3 deletions tools/gradletooling/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ plugins {
`java-gradle-plugin`

// Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.8.20"
id("org.jetbrains.kotlin.jvm") version "1.8.22"
`maven-publish`
id("com.gradle.plugin-publish") version "1.1.0"
}

group = "net.ivoa.vo-dml"
version = "0.4.5"
version = "0.5.0"

repositories {
mavenLocal() // FIXME remove this when releasing - just here to pick up local vodsl updates
Expand Down Expand Up @@ -73,7 +73,7 @@ gradlePlugin {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand Down
46 changes: 43 additions & 3 deletions tools/gradletooling/sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import ru.vyarus.gradle.plugin.python.task.PythonTask
*
*/
plugins {
id("net.ivoa.vo-dml.vodmltools") version "0.4.5"
// id ("com.diffplug.spotless") version "5.17.1"
id("net.ivoa.vo-dml.vodmltools") version "0.5.0"
id("com.diffplug.spotless") version "6.25.0"
id("ru.vyarus.use-python") version "3.0.0"

}
Expand Down Expand Up @@ -43,6 +43,7 @@ vodml {
)
outputDocDir.set(layout.projectDirectory.dir("docs"))
outputSiteDir.set(outputDocDir.dir("generated"))
outputSchemaDir.set(outputDocDir.dir("schema"))
vodslDir.set(vodmlDir) // same place for source models
modelsToDocument.set("sample,filter,coords,jpatest,lifecycleTest")
outputPythonDir.set(layout.projectDirectory.dir("pythontest/generated"))
Expand Down Expand Up @@ -79,12 +80,13 @@ tasks.test {
dependencies {
implementation("org.javastro.ivoa.vo-dml:ivoa-base")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testImplementation("com.networknt:json-schema-validator:1.4.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.slf4j:slf4j-api:2.0.9")
testRuntimeOnly("ch.qos.logback:logback-classic:1.4.7")
testImplementation("com.h2database:h2:2.1.214") // try out h2
// testImplementation("org.apache.derby:derby:10.14.2.0")
compileOnly("com.google.googlejavaformat:google-java-format:1.16.0")
compileOnly("com.google.googlejavaformat:google-java-format:1.22.0")

}

Expand All @@ -104,6 +106,44 @@ python {
}



tasks.register("tpath") {
group = "Other"
description = "looking at various paths"

dependsOn("vodmlJavaGenerate")
doLast{

println(sourceSets.main.get().java.sourceDirectories.asPath)
println(sourceSets.main.get().resources.sourceDirectories.asPath)
println(sourceSets.main.get().output.classesDirs.asPath)
println(sourceSets.test.get().resources.sourceDirectories.asPath)

sourceSets.test.get().compileClasspath.files.forEach{
println(it.path)
}
SourceSet.TEST_SOURCE_SET_NAME

}
}

//TODO
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
// optional: limit format enforcement to just the files changed by this feature branch
// ratchetFrom 'origin/main'


java {
// don't need to set target, it is inferred from java
target("build/generated/sources/vodml/java/**/*.java")
// apply a specific flavor of google-java-format
googleJavaFormat("1.22.0").reflowLongStrings().skipJavadocFormatting()
// fix formatting of type annotations
formatAnnotations()

}
}

tasks.register("pytest", PythonTask::class.java) {
command = "pythontest/src/SourceCatalogueTest.py"
// command = "-c \"import sys; print(sys.path)\""
Expand Down

0 comments on commit ddf9896

Please sign in to comment.