Skip to content

Commit

Permalink
Merge pull request #2180 from mbeddr/feature/ghp
Browse files Browse the repository at this point in the history
build: additional publishing to github packages
  • Loading branch information
coolya committed Jun 24, 2021
2 parents d766706 + 464ed94 commit 9a7e2e7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ subprojects {
ext.mbeddrBuildCounter = GitBasedVersioning.getGitCommitCount()
}
if(mbeddrBuild == "stable" || mbeddrBuild.startsWith("maintenance-")) {
mbeddrBuild = "master"
ext.mbeddrBuild = "master"
}
ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int)
} else {
Expand Down
23 changes: 21 additions & 2 deletions build/com.mbeddr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ String minorVersion = '-Dminor.version=' + ext.mbeddrMinor
ext.mbeddr_home = ['-Dmbeddr.github.core.home=' + file(rootProject.projectDir.absolutePath).getAbsolutePath(), minorVersion, majorVersion, buildVersion]
ext.slall_home = ['-Dsl-all.home=' + file(artifactsDir.absolutePath + '/de.itemis.mps.extensions').getAbsolutePath(), minorVersion, majorVersion, buildVersion]
ext.dependsOnMPS_scriptArgs = [mps_home, build_dir, artifacts_root]
ext["itemis.mps.gradle.ant.defaultScriptArgs"] = ext.dependsOnMbeddr_scriptArgs = [*dependsOnMPS_scriptArgs, *mbeddr_home, *slall_home]
ext["itemis.mps.gradle.ant.defaultScriptArgs"] = ext.dependsOnMbeddr_scriptArgs = [*dependsOnMPS_scriptArgs, *mbeddr_home, *slall_home, "-Dmps.generator.skipUnmodifiedModels=true"]

// path locations
ext.mbeddrScripts_basePath = file(ant.properties['mbeddr.github.core.home'] + "/build").getAbsolutePath()
Expand Down Expand Up @@ -115,6 +115,24 @@ private static void configureRepositories(Project project) {
}
}
}

//mbeddr build is "master" also for maintenance branches
//using the closure to delay evaluate from configuration to execution phase is important because the
//mbeddrBuild property is created by a "subproject" block which is executed after this script is configured.
//if no closure is used the build script won't compile.
if({project.mbeddrBuild}() == "master") {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/mbeddr/mbeddr.core"
if (project.hasProperty("gpr.token")) {
credentials {
username = project.findProperty("gpr.user")
password = project.findProperty("gpr.token")
}
}
}
}

}
}
project.repositories {
Expand All @@ -134,6 +152,7 @@ private static void configureRepositories(Project project) {
}
}


task printVersions {
doLast {
println "mbeddrBuildNumber: $project.mbeddrBuildNumber"
Expand All @@ -147,4 +166,4 @@ task printRepositories {
println "releaseRepository: $releaseRepository"
println "dependencyRepositories: $dependencyRepositories"
}
}
}
14 changes: 14 additions & 0 deletions build/com.mbeddr/languages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,18 @@ publishing {
task publishMbeddrToLocal (dependsOn: ['publishMbeddrPublicationToMavenLocal',
':build:com.mbeddr:platform:publishMbeddrPlatformToLocal']) {}

//mbeddr build is "master" also for maintenance branches
//using the closure to delay evaluate from configuration to execution phase is important because the
//mbeddrBuild property is created by a "subproject" block which is executed after this script is configured.
//if no closure is used the build script won't compile.
if({project.mbeddrBuild}() == "master") {
/* this is pretty much a workaround so we don't need to change anything in Teamcity. Teamcity calls the publishMbeddrPlatformPublicationToMavenRepository
tasks but since we have a new publishing target we would need to change the teamcity config to also include publishMbeddrPlatformPublicationToGitHubPackagesRepository
If we change the Teamcity configuration this would break older maintenance and feature branches and we would loose the ablilty to
rebuild the exact same source code. There for this workaround is present that adds a dependency between the itemis maven repo
and github packages when we are on master or a maintenance branch.
*/
tasks.findByName("publishMbeddrPublicationToMavenRepository").dependsOn("publishMbeddrPublicationToGitHubPackagesRepository")
}

check.dependsOn test_mbeddr
14 changes: 14 additions & 0 deletions build/com.mbeddr/platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,17 @@ publishing {
}
}
}

//mbeddr build is "master" also for maintenance branches
//using the closure to delay evaluate from configuration to execution phase is important because the
//mbeddrBuild property is created by a "subproject" block which is executed after this script is configured.
//if no closure is used the build script won't compile.
if({project.mbeddrBuild}() == "master") {
/* this is pretty much a workaround so we don't need to change anything in Teamcity. Teamcity calls the publishMbeddrPlatformPublicationToMavenRepository
tasks but since we have a new publishing target we would need to change the teamcity config to also include publishMbeddrPlatformPublicationToGitHubPackagesRepository
If we change the Teamcity configuration this would break older maintenance and feature branches and we would loose the ablilty to
rebuild the exact same source code. There for this workaround is present that adds a dependency between the itemis maven repo
and github packages when we are on master or a maintenance branch.
*/
tasks.findByName("publishMbeddrPlatformPublicationToMavenRepository").dependsOn("publishMbeddrPlatformPublicationToGitHubPackagesRepository")
}

0 comments on commit 9a7e2e7

Please sign in to comment.