Skip to content

Commit

Permalink
Merge pull request #2515 from mbeddr/feature/snapshopPublication
Browse files Browse the repository at this point in the history
build.gradle: align snapshot publication with other platforms
  • Loading branch information
sergej-koscejev authored Sep 16, 2024
2 parents e1f373d + 5053fee commit 1fc84e7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ subprojects {
if(mbeddrBuild == "stable" || mbeddrBuild.matches(/(maintenance|mps)[\/-](mps)?\d+(\.\d+)*/)) {
ext.mbeddrBuild = "master"
}

// locally versions are SNAPSHOT
// locally versions and all branches other than master/maintenance*/mps* are SNAPSHOTs
if (ciBuild) {
// setting mbeddrMajor
if (project.hasProperty('mbeddrMajor')) {
Expand All @@ -136,7 +135,13 @@ subprojects {
ext.mbeddrBuildCounter = GitBasedVersioning.getGitCommitCount()
}

ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int)
if(mbeddrBuild == "master" || mbeddrBuild.matches(/(maintenance|mps)[\/-](mps)?\d+(\.\d+)*/)) {
ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int)
} else {
// use same logic as in all other platforms for snapshot publications
ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int) + "-SNAPSHOT"
}

} else {
ext.mbeddrBuildNumber = "${ext.mbeddrMajor}.${ext.mbeddrMinor}-SNAPSHOT"
// TODO: not clear why this has been added - makes local builds from any branch to behave like a master build
Expand Down
22 changes: 16 additions & 6 deletions build/com.mbeddr/languages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,22 @@ publishing {
artifact(package_mbeddr) {}
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.mbeddrPlatform.resolvedConfiguration.firstLevelModuleDependencies.each{
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.moduleGroup)
dependencyNode.appendNode('artifactId', it.moduleName)
dependencyNode.appendNode('version', it.moduleVersion)
dependencyNode.appendNode('type', it.moduleArtifacts[0].type)
if (usePrebuiltPlatform) {
configurations.mbeddrPlatform.resolvedConfiguration.firstLevelModuleDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.moduleGroup)
dependencyNode.appendNode('artifactId', it.moduleName)
dependencyNode.appendNode('version', it.moduleVersion)
dependencyNode.appendNode('type', it.moduleArtifacts[0].type)
}
} else {
configurations.mbeddrPlatform.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('type', 'zip')
}
}
}
pom additionalPomInfo
Expand Down

0 comments on commit 1fc84e7

Please sign in to comment.