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

Add support for SNAPSHOT dependencies layer #584

Merged
merged 4 commits into from
Jul 12, 2018
Merged

Conversation

loosebazooka
Copy link
Member

@loosebazooka loosebazooka commented Jul 12, 2018

Partial solution to #403

The behavior of this change is to separate out snapshot and non-snapshot dependencies as their own layers but still writes them both to /app/libs.

So SourceFilesConfiguration only add a getter on location of the snapshot dependency files, but adds no extra configuration paramter for the location to write those files (it's just shared with regular dependencies)

@loosebazooka loosebazooka force-pushed the snapshot-deps branch 3 times, most recently from bb71d9f to 3fa7cda Compare July 12, 2018 15:57
@@ -37,6 +37,7 @@
ImmutableList<String> classPaths =
ImmutableList.of(
sourceFilesConfiguration.getDependenciesPathOnImage() + "*",
sourceFilesConfiguration.getSnapshotDependenciesPathOnImage() + "*",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any harm to putting the snapshot dependencies in the same /app/libs/ directory?

Copy link
Contributor

Choose a reason for hiding this comment

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

We also might not want to have the snapshot layer if there are no snapshot dependencies, so having that directory added to the classpath may cause directory not found exceptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I don't have any reason reason for picking a separate directory. Let me change it.

@patflynn
Copy link
Contributor

patflynn commented Jul 12, 2018 via email

@@ -63,6 +63,17 @@
sourceFilesConfiguration.getDependenciesPathOnImage())
.build(),
cache))
.add(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably not add this if there are no snapshot dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated.

try (Stream<Path> fileStream =
Files.list(Paths.get(Resources.getResource(resourcePath).toURI()))) {
return fileStream.collect(ImmutableList.toImmutableList());
public static Builder builder() {
Copy link
Contributor

Choose a reason for hiding this comment

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

ordering nit: for convention in the codebase, we're trying to follow the class element ordering of:

  • public->private
  • static->non-static
  • members->constructor->methods

@loosebazooka loosebazooka merged commit 9af66b8 into master Jul 12, 2018
@coollog coollog deleted the snapshot-deps branch July 14, 2018 05:14
@@ -92,11 +94,16 @@ private GradleSourceFilesConfiguration(Project project, GradleBuildLogger gradle
if (resourcesOutputDirectory.equals(dependencyFile.toPath())) {
continue;
}
dependenciesFiles.add(dependencyFile.toPath());
if (dependencyFile.getName().contains("SNAPSHOT")) {
Copy link

@stigkj stigkj Jul 23, 2018

Choose a reason for hiding this comment

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

I guess it would be better to use the Grade API for asking about whether a dependency is a SNAPSHOT or not. Don't know at the top of my head how to do that, I'm afraid.

Copy link
Member

Choose a reason for hiding this comment

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

It does look like Gradle supports explicitly indicating that a dependency may be changing and provides an API (docs). Opened #694.

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

Successfully merging this pull request may close these issues.

5 participants