Skip to content

Commit

Permalink
Adding task copy dependencies (#296)
Browse files Browse the repository at this point in the history
Adding the profile into the runtime.
  • Loading branch information
pwplusnick authored and pritidesai committed Oct 9, 2019
1 parent 797de9f commit 629404f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions knative-build/runtimes/java/core/java8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN cd /javaAction \
&& rm -rf .classpath .gitignore .gradle .project .settings Dockerfile build \
&& ./gradlew oneJar \
&& rm -rf /javaAction/src \
&& ./gradlew copyDependencies \
&& ./compileClassCache.sh

CMD ["java", "-Dfile.encoding=UTF-8", "-Xshareclasses:cacheDir=/javaSharedCache,readonly", "-Xquickstart", "-jar", "/javaAction/build/libs/javaAction-all.jar"]
35 changes: 33 additions & 2 deletions knative-build/runtimes/java/core/java8/proxy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@
* limitations under the License.
*/

import groovy.io.FileType

apply plugin: 'java'

ext {
profile = "base"
}

repositories {
mavenCentral()
}

dependencies {
compile 'com.google.code.gson:gson:2.6.2'
//compile 'com.google.code.gson:gson:2.6.2'
compile 'com.google.code.gson:gson:2.8.5'
compile 'org.json:json:20190722'
}

jar {
Expand All @@ -31,11 +39,34 @@ jar {
}
}

task copyDependencies(type: Copy) {
println "Task: copyDependencies"
def target = "profiles/$profile/libs"

from configurations.compile
into target

doLast {
dumpDir(".")
dumpDir(target)
}
}

def dumpDir(dir) {
println "dumpDir('"+ dir + "'):"
new File(dir).listFiles().sort{ it.name }.reverse().each { def f ->
println ">> " + f.name
}
}

task oneJar(type: Jar) {
outputs.upToDateWhen { false }
manifest.from jar.manifest
classifier = 'all'
from {
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
Expand Down

0 comments on commit 629404f

Please sign in to comment.