First commit.

This commit is contained in:
Erik C. Thauvin 2017-04-10 22:10:01 -07:00
commit 99250cc9cb
16 changed files with 201 additions and 0 deletions

5
.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# batch files are specific to windows and always crlf
*.bat eol=crlf

28
.gitignore vendored Normal file
View file

@ -0,0 +1,28 @@
**/.idea/dictionaries
**/.idea/gradle.xml
**/.idea/libraries
**/.idea/tasks.xml
**/.idea/workspace.xml
*.iws
.classpath
.DS_Store
.gradle
.kobalt
.nb-gradle
.project
.settings
/bin
/build
/deploy
/dist
/gen
/gradle.properties
/local.properties
/out
/proguard-project.txt
/project.properties
/target
/test-output
ehthumbs.db
kobaltBuild
Thumbs.db

BIN
kobalt-1.0.58-sources.jar Normal file

Binary file not shown.

BIN
kobalt-1.0.58.jar Normal file

Binary file not shown.

22
kobalt/Build.kt.iml Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Build.kt" external.linked.project.path="$MODULE_DIR$/.." external.root.project.path="$MODULE_DIR$/.." external.system.id="KOBALT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/out/classes" />
<output-test url="file://$MODULE_DIR$/out/test-classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.59">
<CLASSES>
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.59/kobalt/wrapper/kobalt-1.0.59.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>

47
kobalt/src/Build.kt Normal file
View file

@ -0,0 +1,47 @@
import com.beust.kobalt.buildScript
import com.beust.kobalt.plugin.application.application
import com.beust.kobalt.plugin.packaging.assemble
import com.beust.kobalt.project
val bs = buildScript {
repos()
}
val p = project {
name = "fatjar"
group = "com.example"
artifactId = name
version = "0.1"
sourceDirectories {
path("src/main/kotlin")
}
sourceDirectoriesTest {
path("src/test/kotlin")
}
dependencies {
compile("org.apache.commons:commons-compress:1.13")
compile("commons-io:commons-io:2.5")
}
dependenciesTest {
compile("org.testng:testng:6.11")
}
assemble {
jar {
}
}
application {
mainClass = "com.example.MainKt"
}
}

Binary file not shown.

View file

@ -0,0 +1 @@
kobalt.version=1.0.59

2
kobaltw Normal file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "`dirname "$0"`/kobalt/wrapper/kobalt-wrapper.jar" $*

4
kobaltw.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %*

BIN
lib/kotlin-reflect.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/kotlin-runtime.jar Normal file

Binary file not shown.

BIN
libs/fatjar-0.1.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,84 @@
package com.example
import org.apache.commons.compress.archivers.zip.*
import java.io.File
import java.util.*
internal var allFilesPredicate: ZipArchiveEntryPredicate = ZipArchiveEntryPredicate { true }
fun main(args: Array<String>) {
val kobalt = File("kobalt-1.0.58.jar")
val zip = File("kobalt-1.0.58.zip")
val src = File("kobalt-1.0.58-sources.jar")
//rezip2(kobalt, zip)
rezip3(kobalt, src, zip)
}
fun rezip(jarIn: File, zipOut: File) {
val s = System.currentTimeMillis()
val zos = ZipArchiveOutputStream(zipOut)
zos.encoding = "UTF-8"
val zip = ZipFile(jarIn)
zip.copyRawEntries(zos, allFilesPredicate)
zos.close()
zip.close()
println("Rezip Time: " + (System.currentTimeMillis() - s) + "ms")
}
fun rezip2(jarIn: File, zipOut: File) {
val s = System.currentTimeMillis()
val zos = ZipArchiveOutputStream(zipOut)
zos.encoding = "UTF-8"
val zip = ZipFile(jarIn)
for (entry in zip.entries) {
zos.addRawArchiveEntry(entry, zip.getRawInputStream(entry))
}
zos.close()
zip.close()
println("Rezip2 Time: " + (System.currentTimeMillis() - s) + "ms")
}
fun rezip3(jarIn: File, srcJar: File, zipOut: File) {
val s = System.currentTimeMillis()
val zos = ZipArchiveOutputStream(zipOut)
zos.encoding = "UTF-8"
val jar = ZipFile(jarIn)
val jarEntries = jar.entries
for (entry in jar.entries) {
zos.addRawArchiveEntry(entry, jar.getRawInputStream(entry))
}
jar.close()
val src = ZipFile(srcJar)
for (entry in src.entries) {
if (!entryExists(jarEntries, entry)) {
zos.addRawArchiveEntry(entry, src.getRawInputStream(entry))
}
}
src.close()
zos.close()
println("Rezip3 Time: " + (System.currentTimeMillis() - s) + "ms")
}
fun entryExists(jarEntries: Enumeration<ZipArchiveEntry>, entry: ZipArchiveEntry): Boolean {
for (e in jarEntries) {
if (e.name == entry.name) {
return true
}
}
return false
}

View file

@ -0,0 +1,8 @@
package com.example
import org.testng.annotations.Test
class ExampleTest {
@Test
fun f() = println("Running test")
}