Skip to content

Commit c3e1d9b

Browse files
committed
Improve version handling, fix missing plugins, set version to 0.0.2
1 parent 6795ec7 commit c3e1d9b

File tree

8 files changed

+153
-84
lines changed

8 files changed

+153
-84
lines changed

.idea/compiler.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
import java.net.URI
2+
13
plugins {
24
id("com.orbitalhq.preflight")
35
}
6+
repositories {
7+
mavenCentral()
8+
mavenLocal()
9+
maven {
10+
name = "orbital"
11+
url = URI("https://repo.orbitalhq.com/release")
12+
mavenContent {
13+
releasesOnly()
14+
}
15+
}
16+
maven {
17+
name = "orbital-snapshot"
18+
url = URI("https://repo.orbitalhq.com/snapshot")
19+
mavenContent {
20+
snapshotsOnly()
21+
}
22+
}
23+
}

example-projects/simple-project/test/PersonTest.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.orbitalhq.firstRawValue
21
import com.orbitalhq.preflight.dsl.OrbitalSpec
32
import com.orbitalhq.preflight.dsl.PreflightExtension
43
import com.orbitalhq.preflight.dsl.stub
@@ -24,6 +23,13 @@ class PersonTest : OrbitalSpec({
2423
)
2524
)
2625
}
26+
it("can use stdlib functions") {
27+
"""find {
28+
shouldBeTrue : Boolean = "hello".startsWith("he")
29+
}
30+
""".queryForObject()
31+
.shouldBe(mapOf("shouldBeTrue" to true))
32+
}
2733
}
2834

2935

preflight-core/build.gradle.kts

Lines changed: 16 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,26 @@ plugins {
1111

1212

1313

14+
tasks.register("publishAll") {
15+
dependsOn(subprojects.map { "${it.path}:publish" })
16+
group = "publishing"
17+
description = "Publishes all subprojects"
18+
}
19+
20+
tasks.register("publishAllMavenLocal") {
21+
dependsOn(subprojects.map { "${it.path}:publishToMavenLocal" })
22+
group = "publishing"
23+
description = "Publishes all subprojects"
24+
}
25+
1426

1527
allprojects {
1628
group = "com.orbitalhq.preflight"
17-
version = "0.0.1"
29+
version = "0.0.2"
1830

1931
repositories {
2032
mavenCentral()
33+
mavenLocal()
2134
maven {
2235
name = "orbital"
2336
url = URI("https://repo.orbitalhq.com/release")
@@ -33,6 +46,8 @@ allprojects {
3346
}
3447
}
3548
}
49+
50+
3651
}
3752

3853
subprojects {
@@ -46,61 +61,6 @@ subprojects {
4661
extensions.configure<KotlinJvmProjectExtension>() {
4762
jvmToolchain(17)
4863
}
49-
5064
}
5165

5266
}
53-
54-
val taxiVersion = "1.64.0"
55-
val orbitalVersion = "0.35.0"
56-
57-
58-
// dependencies {
59-
// implementation("org.taxilang:compiler:$taxiVersion")
60-
// implementation("org.taxilang:compiler:$taxiVersion") {
61-
// artifact { classifier = "tests" }
62-
// }
63-
// implementation("com.orbitalhq:taxiql-query-engine:$orbitalVersion") {
64-
// // Not published to maven central, and not needed for testing
65-
// // as it relates to saml auth
66-
// exclude(group = "org.pac4j")
67-
// }
68-
// implementation("com.orbitalhq:taxiql-query-engine:$orbitalVersion") {
69-
// artifact { classifier = "tests" } // Not published to maven central, and not needed for testing
70-
// // as it relates to saml auth
71-
// exclude(group = "org.pac4j")
72-
// }
73-
// implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
74-
// implementation(platform("io.kotest:kotest-bom:5.8.0"))
75-
// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
76-
// implementation("io.kotest:kotest-framework-api")
77-
// implementation("io.kotest:kotest-framework-engine")
78-
// implementation("io.kotest:kotest-framework-datatest")
79-
// implementation("io.kotest:kotest-framework-discovery")
80-
// implementation("io.kotest:kotest-assertions-core")
81-
// testImplementation(platform("org.junit:junit-bom:5.10.0"))
82-
// testImplementation("org.junit.jupiter:junit-jupiter")
83-
84-
// }
85-
86-
// tasks.test {
87-
// useJUnitPlatform()
88-
// }
89-
90-
// gradlePlugin {
91-
// plugins {
92-
// create("preflight") {
93-
// id = "com.orbitalhq.preflight"
94-
// implementationClass = "com.orbitalhq.preflight.build.PreflightPlugin"
95-
// }
96-
// }
97-
// }
98-
99-
// publishing {
100-
// repositories {
101-
// maven {
102-
// name = "localTest"
103-
// url = uri("${project.rootDir}/../maven-repo")
104-
// }
105-
// }
106-
// }

preflight-core/preflight-gradle-plugin/build.gradle.kts

Lines changed: 75 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ buildscript {
1313
mavenCentral()
1414
}
1515
}
16-
val taxiVersion = "1.64.0"
17-
val orbitalVersion = "0.35.0"
1816

1917
repositories {
2018
mavenCentral()
@@ -50,15 +48,6 @@ gradlePlugin {
5048
}
5149
}
5250

53-
publishing {
54-
repositories {
55-
maven {
56-
name = "localTest"
57-
url = uri("${project.rootDir}/../maven-repo")
58-
}
59-
}
60-
}
61-
6251
tasks.shadowJar {
6352
archiveClassifier.set("") // Make this the main JAR
6453
dependencies {
@@ -69,9 +58,80 @@ tasks.shadowJar {
6958
}
7059

7160
signing {
72-
useInMemoryPgpKeys(
73-
System.getenv("GPG_PRIVATE_KEY"),
74-
System.getenv("GPG_PASSPHRASE")
75-
)
61+
val gpgPrivateKey = System.getenv("GPG_PRIVATE_KEY")
62+
val gpgPassphrase = System.getenv("GPG_PASSPHRASE")
63+
64+
if (gpgPrivateKey != null && gpgPassphrase != null) {
65+
// GitHub Actions path - use environment variables
66+
useInMemoryPgpKeys(gpgPrivateKey, gpgPassphrase)
67+
} else {
68+
// Local development path - use gradle.properties
69+
// Gradle will automatically pick up signing.keyId and signing.password
70+
}
7671
sign(publishing.publications)
7772
}
73+
74+
publishing {
75+
repositories {
76+
mavenLocal()
77+
maven {
78+
name = "orbital"
79+
url = if (version.toString().endsWith("SNAPSHOT")) {
80+
uri("s3://repo.orbitalhq.com/snapshot")
81+
} else {
82+
uri("s3://repo.orbitalhq.com/release")
83+
}
84+
credentials(AwsCredentials::class) {
85+
accessKey = providers.environmentVariable("AWS_ACCESS_KEY_ID").orNull
86+
secretKey = providers.environmentVariable("AWS_SECRET_ACCESS_KEY").orNull
87+
}
88+
}
89+
}
90+
}
91+
92+
// Capture the version at script level (configuration time)
93+
//val projectVersion = project.version.toString()
94+
/**
95+
* Generates a Versions.kt file containing the current version of this project
96+
* which we can use inside the plugin code
97+
*/
98+
val generateVersionConstants by tasks.registering {
99+
description = "Generate version constants for plugin"
100+
101+
val outputDir = layout.buildDirectory.dir("generated/kotlin")
102+
val outputFile = outputDir.get().file("com/orbitalhq/preflight/Versions.kt")
103+
104+
// Use Provider API - this is configuration cache safe
105+
val versionProvider = providers.provider { version.toString() }
106+
107+
inputs.property("version", versionProvider)
108+
outputs.file(outputFile)
109+
110+
doLast {
111+
val versionString = versionProvider.get()
112+
outputFile.asFile.parentFile.mkdirs()
113+
outputFile.asFile.writeText("""
114+
package com.orbitalhq.preflight
115+
116+
object Versions {
117+
const val PREFLIGHT_VERSION = "$versionString"
118+
}
119+
""".trimIndent())
120+
}
121+
}
122+
123+
tasks.compileKotlin {
124+
dependsOn(generateVersionConstants)
125+
}
126+
// Fix the sourcesJar dependency issue - only if the task exists
127+
tasks.matching { it.name == "sourcesJar" }.configureEach {
128+
dependsOn(generateVersionConstants)
129+
}
130+
// Add the generated source to the source set
131+
kotlin {
132+
sourceSets {
133+
main {
134+
kotlin.srcDir(layout.buildDirectory.dir("generated/kotlin"))
135+
}
136+
}
137+
}

preflight-core/preflight-gradle-plugin/src/main/kotlin/com/orbitalhq/preflight/gradle/PreflightPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.gradle.api.Project
55
import org.gradle.api.tasks.SourceSetContainer
66
import org.gradle.api.tasks.testing.Test
77
import java.net.URI
8-
8+
import com.orbitalhq.preflight.Versions
99
class PreflightPlugin : Plugin<Project> {
1010
override fun apply(project: Project) {
1111
project.pluginManager.apply("org.jetbrains.kotlin.jvm")
@@ -24,7 +24,7 @@ class PreflightPlugin : Plugin<Project> {
2424

2525

2626
project.dependencies.add("implementation", "org.jetbrains.kotlin:kotlin-stdlib")
27-
project.dependencies.add("implementation", "com.orbitalhq.preflight:preflight-runtime:0.1.0-SNAPSHOT")
27+
project.dependencies.add("implementation", "com.orbitalhq.preflight:preflight-runtime:${Versions.PREFLIGHT_VERSION}")
2828
project.dependencies.add("testImplementation", "io.kotest:kotest-runner-junit5:5.8.0")
2929
project.dependencies.add("testImplementation", "io.kotest:kotest-assertions-core:5.8.0")
3030

preflight-core/preflight-runtime/build.gradle.kts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ plugins {
33
`maven-publish`
44
}
55

6-
val taxiVersion = "1.64.0"
7-
val orbitalVersion = "0.35.0"
6+
val taxiVersion = "1.65.0"
7+
val orbitalVersion = "0.36.0-M4"
88

99
dependencies {
1010
testImplementation(platform("org.junit:junit-bom:5.10.0"))
@@ -57,4 +57,31 @@ dependencies {
5757

5858
tasks.test {
5959
useJUnitPlatform()
60-
}
60+
}
61+
62+
publishing {
63+
publications {
64+
create<MavenPublication>("maven") {
65+
from(components["java"])
66+
67+
// Optional: customize the publication
68+
// artifactId = "preflight-runtime"
69+
// groupId and version are inherited from the project
70+
}
71+
}
72+
repositories {
73+
mavenLocal()
74+
maven {
75+
name = "orbital"
76+
url = if (version.toString().endsWith("SNAPSHOT")) {
77+
uri("s3://repo.orbitalhq.com/snapshot")
78+
} else {
79+
uri("s3://repo.orbitalhq.com/release")
80+
}
81+
credentials(AwsCredentials::class) {
82+
accessKey = providers.environmentVariable("AWS_ACCESS_KEY_ID").orNull
83+
secretKey = providers.environmentVariable("AWS_SECRET_ACCESS_KEY").orNull
84+
}
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)