akhikhl / multiproject-git-gradle

Gradle script for multi-project git-based setup, configuration and build
30 stars 12 forks source link

How to enable SNAPSHOT dependencies? #8

Closed kavink closed 10 years ago

kavink commented 10 years ago

How can we pass flags to gradle release plugin which is a requirement https://github.com/townsfolk/gradle-release , i.e. if i would like to enable SNAPSHOT dependencies, how can i do it ?

akhikhl commented 10 years ago

I researched the possibility of external configuration of failOnSnapshotDependencies property. The result is:

  1. townsfolk/gradle-release does not support defining it's extension properties via project properties or system properties.
  2. Gradle does not support passing extension properties via command line or via GradleBuild task.

The only possible solution at the moment is to set failOnSnapshotDependencies within "build.gradle" of the concrete git repository:

release {
  failOnSnapshotDependencies = false
}
kavink commented 10 years ago

is it possible to inject into build.gradle temporarily ? Not committing any changes, just using it for building ?

akhikhl commented 10 years ago

I will think on it.

akhikhl commented 10 years ago

Now it is possible to configure ARF that way, that it allows SNAPSHOT dependencies:

multiproject {
  git baseDir: 'upstream_repos', {
    project name: 'project1', {
      releaseVersion(/(\d+)([^\d]*$)/, { null })
    }
    project name: 'project3'
    project name: 'project2', dependsOn: [ 'project1', 'project3' ], failOnSnapshotDependencies: false
  }
}

in this example project2 allows snapshot dependencies, while other projects don't.

failOnSnapshotDependencies can be defined globally:

multiproject {
  failOnSnapshotDependencies = false
  git baseDir: 'upstream_repos', {
    project name: 'project1', {
      releaseVersion(/(\d+)([^\d]*$)/, { null })
    }
    project name: 'project3'
    project name: 'project2', dependsOn: [ 'project1', 'project3' ]
  }
}

Note new special syntax in releaseVersion of project1: { null }. It means that code will be released with current version number, without modifications. For example, if project1 has version 2.0-SNAPSHOT, it will be released as 2.0-SNAPSHOT.

kavink commented 10 years ago

I did not understand the second part about { null } when is that needed ?

kavink commented 10 years ago

Thanks i will test enabling SNAPSHOT on one repo

akhikhl commented 10 years ago

On 07/28/2014 04:29 PM, kavink wrote:

I did not understand the second part about |{ null }| when is that needed ?

when we need to release with snapshot version.

Best regards, Andrey Hihlovskiy.