Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: liberica
java-version: |
8
17
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
Expand Down Expand Up @@ -73,9 +71,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: liberica
java-version: |
8
17
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
Expand Down Expand Up @@ -162,9 +158,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: liberica
java-version: |
8
17
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
Expand Down
19 changes: 16 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ import tool.generator.ast.task.GenerateAst
import java.text.SimpleDateFormat

ext {
lwjglVersion = '3.3.6'
lwjglVersion = '3.4.1'
}

// Gradle 9's configuration cache forbids starting external processes at
// configuration time via Groovy's '...'.execute() (the cache can't know
// if the result would be different next time). Use providers.exec, which
// is cache-aware.
def gitDescribeProvider = providers.exec {
commandLine 'git', 'describe', '--tags', '--always'
}.standardOutput.asText.map { it.trim().startsWith('v') ? it.trim().substring(1) : it.trim() }.orElse('unknown')

def gitRevProvider = providers.exec {
commandLine 'git', 'rev-parse', 'HEAD'
}.standardOutput.asText.map { it.trim() }.orElse('unknown')

allprojects {
group = 'imgui-java'
version = 'git describe --tags --always'.execute().text.trim().substring(1)
version = gitDescribeProvider.get()

repositories {
mavenCentral()
Expand All @@ -23,13 +35,14 @@ allprojects {

def jdkMetadata = tasks.withType(JavaCompile).find().javaCompiler.get().metadata
def buildJdk = "${jdkMetadata.javaRuntimeVersion} (${jdkMetadata.vendor})".toString()
def buildRev = gitRevProvider.get()

manifest {
attributes (
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(System.currentTimeMillis()),
'Build-Revision': 'git rev-parse HEAD'.execute().text.trim(),
'Build-Revision': buildRev,
'Build-Jdk': buildJdk,
'Source-Compatibility': tasks.withType(JavaCompile).find().sourceCompatibility,
'Target-Compatibility': tasks.withType(JavaCompile).find().targetCompatibility,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import spoon.reflect.code.CtJavaDoc
import spoon.reflect.declaration.CtElement
import spoon.reflect.declaration.CtField
import spoon.reflect.declaration.CtMethod
import spoon.reflect.declaration.CtNamedElement
import spoon.reflect.declaration.CtType
import spoon.reflect.declaration.CtTypedElement
import kotlin.math.max

class BindingSourceProcessor(
Expand Down Expand Up @@ -135,13 +137,13 @@ class BindingSourceProcessor(

for (i in 0 until variantsCount) {
val m = method.clone()
m.setParent<Nothing>(method.parent)
m.setParent<CtElement>(method.parent)
variantsMap.values.forEach { vList ->
val v = vList[i]
val p = m.parameters[v.idx]
p.setAnnotations<Nothing>(p.annotations.filterNot { it.name == A_NAME_ARG_VARIANT })
p.setType<Nothing>(m.factory.createTypeParameterReference(v.type))
p.setSimpleName<Nothing>(v.name)
p.setAnnotations<CtElement>(p.annotations.filterNot { it.name == A_NAME_ARG_VARIANT })
p.setType<CtTypedElement<Any>>(m.factory.createTypeParameterReference(v.type))
p.setSimpleName<CtNamedElement>(v.name)
}
content += jvmMethodContent(m) + jniMethodContent(m)
}
Expand Down
17 changes: 11 additions & 6 deletions buildSrc/src/main/kotlin/tool/generator/api/ast_content.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package tool.generator.api

import spoon.reflect.code.CtRHSReceiver
import spoon.reflect.declaration.CtAnnotation
import spoon.reflect.declaration.CtElement
import spoon.reflect.declaration.CtModifiable
import spoon.reflect.declaration.CtNamedElement
import spoon.reflect.declaration.CtTypedElement
import spoon.reflect.declaration.ModifierKind
import tool.generator.ast.AstEnumConstantDecl
import tool.generator.ast.AstParser
Expand All @@ -19,11 +24,11 @@ fun astEnumContent(markerAnnotation: CtAnnotation<*>): List<String> {
val factory = markerAnnotation.factory

enums.forEach { e ->
val f = factory.createField<Nothing>()
val f = factory.createField<Any>()

f.setModifiers<Nothing>(setOf(ModifierKind.PUBLIC, ModifierKind.STATIC, ModifierKind.FINAL))
f.setType<Nothing>(factory.createTypeParam("int"))
f.setSimpleName<Nothing>(sanitizeName(markerAnnotation.getValueSanitizeName(qualType), e.name))
f.setModifiers<CtModifiable>(setOf(ModifierKind.PUBLIC, ModifierKind.STATIC, ModifierKind.FINAL))
f.setType<CtTypedElement<Any>>(factory.createTypeParam("int"))
f.setSimpleName<CtNamedElement>(sanitizeName(markerAnnotation.getValueSanitizeName(qualType), e.name))
buildString {
if (e.docComment != null) {
appendLine(e.docComment)
Expand All @@ -37,10 +42,10 @@ fun astEnumContent(markerAnnotation: CtAnnotation<*>): List<String> {
}
}.let {
if (it.isNotEmpty()) {
f.setDocComment<Nothing>(sanitizeDocComment(it))
f.setDocComment<CtElement>(sanitizeDocComment(it))
}
}
f.setAssignment<Nothing>(factory.createCodeSnippetExpression((e.evaluatedValue ?: e.order).toString()))
f.setAssignment<CtRHSReceiver<Any>>(factory.createCodeSnippetExpression((e.evaluatedValue ?: e.order).toString()))

result += f.prettyprint()
}
Expand Down
Loading
Loading