-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin: Publish Presto thin jar which allows consumers to control dep…
…endency graph (#49)
- Loading branch information
1 parent
cdfba52
commit 0b69275
Showing
5 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...e-udfs-plugin/src/main/java/com/linkedin/transport/plugin/packaging/ThinJarPackaging.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright 2019 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.plugin.packaging; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.linkedin.transport.plugin.Platform; | ||
import java.util.List; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.Task; | ||
import org.gradle.api.artifacts.Dependency; | ||
import org.gradle.api.tasks.SourceSet; | ||
import org.gradle.api.tasks.TaskProvider; | ||
import org.gradle.api.tasks.bundling.Jar; | ||
|
||
|
||
/** | ||
* A {@link Packaging} class which generates a Jar containing the autogenerated code for the platform | ||
*/ | ||
public class ThinJarPackaging implements Packaging { | ||
|
||
@Override | ||
public List<TaskProvider<? extends Task>> configurePackagingTasks(Project project, Platform platform, | ||
SourceSet platformSourceSet, SourceSet mainSourceSet) { | ||
/* | ||
task <platformName>ThinJar(type: Jar, dependsOn: prestoClasses) { | ||
classifier '<platformName>-thin' | ||
from sourceSets.<platform>.output | ||
from sourceSets.<platform>.resources | ||
} | ||
*/ | ||
|
||
TaskProvider<? extends Task> thinJarTask = | ||
project.getTasks().register(platformSourceSet.getTaskName(null, "thinJar"), Jar.class, task -> { | ||
task.dependsOn(project.getTasks().named(platformSourceSet.getClassesTaskName())); | ||
task.setDescription("Assembles a thin jar archive containing the " + platform.getName() | ||
+ " classes to be included in the distribution"); | ||
task.setClassifier(platform.getName() + "-thin"); | ||
task.from(platformSourceSet.getOutput()); | ||
task.from(platformSourceSet.getResources()); | ||
}); | ||
|
||
project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, thinJarTask); | ||
return ImmutableList.of(thinJarTask); | ||
} | ||
} |