Skip to content

Commit f016f9a

Browse files
committed
feat: initial gradle module metadata model
Signed-off-by: Sam Gammon <sam@elide.dev>
1 parent 5c178b1 commit f016f9a

File tree

5 files changed

+1106
-0
lines changed

5 files changed

+1106
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Copyright (c) 2024-2025 Elide Technologies, Inc.
3+
*
4+
* Licensed under the MIT license (the "License"); you may not use this file except in compliance
5+
* with the License. You may obtain a copy of the License at
6+
*
7+
* https://opensource.org/license/mit/
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
* License for the specific language governing permissions and limitations under the License.
12+
*/
13+
@file:OptIn(ExperimentalSerializationApi::class)
14+
15+
package elide.tooling.jvm.gradle
16+
17+
import kotlinx.serialization.ExperimentalSerializationApi
18+
import kotlinx.serialization.SerialName
19+
import kotlinx.serialization.Serializable
20+
21+
/**
22+
* Attribute values can be strings, booleans, or numbers.
23+
*/
24+
@Serializable(with = GradleAttributeSerializer::class)
25+
public sealed interface AttributeValue {
26+
@Serializable
27+
@SerialName("string")
28+
@JvmRecord
29+
public data class StringValue(val value: String) : AttributeValue
30+
31+
@Serializable
32+
@SerialName("boolean")
33+
@JvmRecord
34+
public data class BooleanValue(val value: Boolean) : AttributeValue
35+
36+
@Serializable
37+
@SerialName("number")
38+
@JvmRecord
39+
public data class NumberValue(val value: Int) : AttributeValue
40+
}
41+
42+
43+
// Serialization helpers for common attribute names
44+
public object StandardAttributes {
45+
public const val USAGE: String = "org.gradle.usage"
46+
public const val CATEGORY: String = "org.gradle.category"
47+
public const val LIBRARYELEMENTS: String = "org.gradle.libraryelements"
48+
public const val BUNDLING: String = "org.gradle.bundling"
49+
public const val STATUS: String = "org.gradle.status"
50+
public const val DOCS_TYPE: String = "org.gradle.docstype"
51+
52+
// JVM specific
53+
public const val JVM_VERSION: String = "org.gradle.jvm.version"
54+
public const val JVM_ENVIRONMENT: String = "org.gradle.jvm.environment"
55+
56+
// Kotlin specific
57+
public const val KOTLIN_PLATFORM_TYPE: String = "org.jetbrains.kotlin.platform.type"
58+
public const val KOTLIN_NATIVE_TARGET: String = "org.jetbrains.kotlin.native.target"
59+
}
60+
61+
// Common attribute values
62+
public object AttributeValues {
63+
// Usage values
64+
public const val JAVA_API: String = "java-api"
65+
public const val JAVA_RUNTIME: String = "java-runtime"
66+
public const val JAVA_RUNTIME_JARS: String = "java-runtime-jars"
67+
68+
// Category values
69+
public const val LIBRARY: String = "library"
70+
public const val PLATFORM: String = "platform"
71+
public const val DOCUMENTATION: String = "documentation"
72+
73+
// Library elements values
74+
public const val JAR: String = "jar"
75+
public const val CLASSES: String = "classes"
76+
public const val RESOURCES: String = "resources"
77+
public const val SOURCES: String = "sources"
78+
public const val JAVADOC: String = "javadoc"
79+
80+
// Status values
81+
public const val RELEASE: String = "release"
82+
public const val MILESTONE: String = "milestone"
83+
public const val INTEGRATION: String = "integration"
84+
85+
// Bundling values
86+
public const val EXTERNAL: String = "external"
87+
public const val EMBEDDED: String = "embedded"
88+
public const val SHADOWED: String = "shadowed"
89+
}

0 commit comments

Comments
 (0)