Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release new version of submodule if dependency changed #517

Open
cyberveseli opened this issue Aug 5, 2022 · 2 comments
Open

Release new version of submodule if dependency changed #517

cyberveseli opened this issue Aug 5, 2022 · 2 comments

Comments

@cyberveseli
Copy link

cyberveseli commented Aug 5, 2022

Hello
I am running multi-project architecture and we are doing version per module.
Let's say we Have ProjectA and ProjectB. Both projects contain build.gradle.kts with following lines:

plugins {
    id("pl.allegro.tech.build.axion-release") version "1.13.14"
}
scmVersion {
    tag {
        prefix = "$project.name-"
    }
}
project.version = scmVersion.version

ProjectB depends on ProjectA and has one more line:

dependencies {
    implementation(project(":ProjectA"))
}

Once we commit and push changes to ProjectA it's release new version of ProjectA and that's fine.
Problem:
ProjectB depends on ProjectA and we want to release new version of ProjectB if something changed in ProjectA but gradle release print out nothing to release
Are there any solution to this?
Somehow, axion should understand that if dependecy has some changes we should release new version of dependent modules.

I think this is similar to: #262 and #326

@bgalek
Copy link
Member

bgalek commented Aug 6, 2022

Hi! Unfortunately, I think that to support your setup we would need to recover this PR #326, would you like to participate? :)

@Olatunji-Longe
Copy link

Olatunji-Longe commented Jul 16, 2024

I have achieved this by doing something as simple as

build.gradle

def includes = []
rootProject.allprojects.forEach { it ->
    includes.add("${it.projectDir.parentFile.name}/${it.projectDir.name}")
}

scmVersion {
    monorepo {
        include(includes)
    }
}

Ref: Documentation which says;

Use the include configuration parameter within a monorepo block to identify dependencies directories that should be added to consideration when calculating whether to increment the version of the parent project

Note - I have all my modules nested in a subdirectory of my project root, so I've used ${it.projectDir.parentFile.name}/${it.projectDir.name} because of the part of the documentation which says the values for monorepo >> include need to be relative to project root;

Note: these values need to be relative to project root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants