From ed3bf3f435308b3c9a92170af283a7d25c0e8b2a Mon Sep 17 00:00:00 2001 From: Alexander Rimer Date: Mon, 16 Sep 2024 11:34:39 +0200 Subject: [PATCH 1/3] build.gradle: align snapshot publication with other platforms all other branches than master and maintenance are published as snapshots --- build.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 45cda5b3cf0..8ae26d7ba5a 100644 --- a/build.gradle +++ b/build.gradle @@ -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')) { @@ -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.getVersionWithCount(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 From ee8adf47ada0e571d2bc4c4c4a6d4f266cc51c88 Mon Sep 17 00:00:00 2001 From: Alexander Rimer Date: Mon, 16 Sep 2024 13:39:35 +0200 Subject: [PATCH 2/3] build.gradle: adding branch name to snapshot artifact name --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8ae26d7ba5a..fb877d23456 100644 --- a/build.gradle +++ b/build.gradle @@ -139,7 +139,7 @@ subprojects { 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.getVersionWithCount(mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int) + "-SNAPSHOT" + ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int) + "-SNAPSHOT" } } else { From 5053fee6af4425c37ab196b491791db077fbae09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergej=20Ko=C5=A1=C4=8Dejev?= Date: Mon, 16 Sep 2024 15:30:17 +0200 Subject: [PATCH 3/3] POM generation now works when the platform project is used The POM is generated based on the declared dependency. This is good enough for the snapshot builds (and could in fact be good enough for release builds, too). --- build/com.mbeddr/languages/build.gradle | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/build/com.mbeddr/languages/build.gradle b/build/com.mbeddr/languages/build.gradle index bc557597d98..d747c901f0c 100755 --- a/build/com.mbeddr/languages/build.gradle +++ b/build/com.mbeddr/languages/build.gradle @@ -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