Skip to content

Commit

Permalink
CI - Fix versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelborn committed Nov 21, 2024
1 parent e5a941f commit 3c00f2b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ ext {
branch = System.getenv( 'BRANCH' ) ?: 'development'
}

if ( branch == 'development' ) {
// If the branch is 'development', ensure the version ends with '-snapshot'
// This replaces any existing prerelease identifier with '-snapshot'
version = version.contains('-') ? version.replaceAll(/-.*/, '-snapshot') : "${version}-snapshot"
boxlangVersion = boxlangVersion.contains('-') ? boxlangVersion.replaceAll(/-.*/, '-snapshot') : "${boxlangVersion}-snapshot"
}

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -32,12 +39,14 @@ dependencies {
// Until BoxLang is published to Maven Central
// Look for it in the local build directory
// You must run `./gradle build -x test` in the BoxLang project
compileOnly files( 'src/test/resources/libs/boxlang-1.0.0-all.jar' )
compileOnly files( '../../boxlang/build/libs/boxlang-' + boxlangVersion + '-all.jar' )
compileOnly files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
// https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
implementation 'org.mariadb.jdbc:mariadb-java-client:3.3.3'

// Testing Dependencies
testImplementation files( 'src/test/resources/libs/boxlang-1.0.0-all.jar' )
testImplementation files( '../../boxlang/build/libs/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation "org.junit.jupiter:junit-jupiter:5.+"
testImplementation "org.mockito:mockito-core:5.+"
testImplementation "com.google.truth:truth:1.+"
Expand Down Expand Up @@ -134,7 +143,7 @@ task createModuleStructure(type: Copy) {
// Token Replacements Go Here
filter{ line -> line.replaceAll( '@build.version@', project.version ) }
if( project.branch == "development" ){
filter{ line -> line.replaceAll( '\\+@build.number@', '-SNAPSHOT' ) }
filter{ line -> line.replaceAll( '\\+@build.number@', '' ) }
} else {
filter{ line -> line.replaceAll( '@build.number@', project.buildID ) }
}
Expand All @@ -146,7 +155,7 @@ task createModuleStructure(type: Copy) {
// Token Replacements Go Here
filter{ line -> line.replaceAll( '@build.version@', project.version ) }
if( project.branch == "development" ){
filter{ line -> line.replaceAll( '\\+@build.number@', '-SNAPSHOT' ) }
filter{ line -> line.replaceAll( '\\+@build.number@', '' ) }
} else {
filter{ line -> line.replaceAll( '@build.number@', project.buildID ) }
}
Expand Down

0 comments on commit 3c00f2b

Please sign in to comment.