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

Auto build gradle lib-project dependencies #821

Merged
merged 6 commits into from
Aug 10, 2018
Merged

Conversation

loosebazooka
Copy link
Member

Search through all configurations for dependencies of the style
'configurationName project(":path")' and have jib depend on the
'assemble' task of that project. This ensure jar dependencies
are built before jib starts to package the project.

Fixes #815

@loosebazooka loosebazooka force-pushed the multi-module-gradle branch 2 times, most recently from 91ab7cd to 59293dd Compare August 9, 2018 22:43
Search through all configurations for dependencies of the style
'configurationName project(":path")' and have jib depend on the
'assemble' task of that project. This ensure jar dependencies
are built before jib starts to package the project.
dockerContextTask.dependsOn(classesTask);
buildDockerTask.dependsOn(classesTask);
buildTarTask.dependsOn(classesTask);
buildImageTask.dependsOn(taskDependencies.toArray());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use setDependsOn to avoid toArray.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That overwrites any previously dependencies.

For instance in a build.gradle like

apply plugin: 'jib'

task myCustomTask {
  doLast {
    // blah balh
  }
}

jib.dependOn("myCustomTask")

the build using setDependsOn will not honor the myCustomTask dependency.

* @param project this project we are containerizing
* @return a list of "assemble" tasks associated with projects that this project depends on.
*/
static List<Task> getProjectDependencyAssembleTasks(Project project) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Order above non-static and annotate with @VisibleForTesting.

@@ -40,6 +40,42 @@
@VisibleForTesting static final String BUILD_DOCKER_TASK_NAME = "jibDockerBuild";
@VisibleForTesting static final String DOCKER_CONTEXT_TASK_NAME = "jibExportDockerContext";

private static void checkGradleVersion() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: private static below package-private static

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

Successfully merging this pull request may close these issues.

3 participants