Skip to content

Commit c2c1909

Browse files
Adds Zig version validation for publishing task (cedar-policy#306)
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
1 parent 94d4d15 commit c2c1909

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

CedarJava/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 4.3.0
4+
### Added
5+
* Added Zig version validation for publishing artifacts [#306](https://github.com/cedar-policy/cedar-java/pull/306)
6+
37
## 4.3.0
48
### Added
59
* Introduced new model classes for improved type safety and functionality:

CedarJava/build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@ tasks.register('installCargoZigbuild', Exec) {
124124
commandLine 'cargo', '+' + RustVersion, 'install', 'cargo-zigbuild@0.19.7'
125125
}
126126

127+
def ZigVersion = '0.11'
128+
tasks.register('validateZigVersion') {
129+
group = 'Build'
130+
description = 'Validates that the correct zig version is installed'
131+
132+
doLast {
133+
def output = new ByteArrayOutputStream()
134+
exec {
135+
commandLine 'zig', 'version'
136+
standardOutput = output
137+
}
138+
def version = output.toString().trim()
139+
println "Detected Zig version: ${version}"
140+
if (!version.startsWith(ZigVersion)) {
141+
throw new GradleException("Zig version must be ${ZigVersion} but found: ${version}")
142+
}
143+
println "Zig version validation successful"
144+
}
145+
}
146+
127147
tasks.register('compileFFI') {
128148
dependsOn('installCargoZigbuild')
129149
group 'Build'
@@ -252,6 +272,7 @@ java {
252272
/*
253273
Configures Maven publishing
254274
*/
275+
publish.dependsOn('validateZigVersion')
255276
publishing {
256277
publications {
257278
mavenJava(MavenPublication) {

0 commit comments

Comments
 (0)