@@ -13,8 +13,6 @@ buildscript {
1313 mavenCentral()
1414 }
1515}
16- val taxiVersion = " 1.64.0"
17- val orbitalVersion = " 0.35.0"
1816
1917repositories {
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-
6251tasks.shadowJar {
6352 archiveClassifier.set(" " ) // Make this the main JAR
6453 dependencies {
@@ -69,9 +58,80 @@ tasks.shadowJar {
6958}
7059
7160signing {
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+ }
0 commit comments