diff --git a/.github/readme.md b/.github/readme.md
index d77ee1d3..d63e5075 100644
--- a/.github/readme.md
+++ b/.github/readme.md
@@ -8,6 +8,37 @@ vgo is a tool for optimizing vector artwork files that helps ensure your vector
Download the distribution from the releases page and ensure it has execute permission. On macOS & Linux run `chmod +x vgo`.
+## Gradle Plugin
+Add the plugin to your buildscript classpath.
+```
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath "com.jzbrooks:vgo-plugin:1.4.0"
+ }
+}
+```
+
+Then, in the relevant project, add the plugin.
+```
+plugins {
+ id 'com.jzbrooks.vgo'
+}
+
+vgo {
+ inputs = fileTree(projectDir) {
+ include '**/res/drawable*/*.xml'
+ }
+ outputs = inputs
+ showStatistics = true
+ format = OutputFormat.UNCHANGED
+ indent = 0
+}
+```
+
## Command Line Interface
```
diff --git a/.github/workflows/gradle.yml b/.github/workflows/build.yml
similarity index 83%
rename from .github/workflows/gradle.yml
rename to .github/workflows/build.yml
index 0f325dc2..07cb764e 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/build.yml
@@ -32,11 +32,6 @@ jobs:
with:
name: vgo_core_test_results
path: vgo-core/build/reports/tests/test/
- - name: archive integration test results
- uses: actions/upload-artifact@v1
- with:
- name: integration_test_results
- path: vgo/build/reports/tests/integrationTest
- name: release binary
run: ./gradlew binary
- name: archive vgo
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 00000000..b1193446
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,37 @@
+name: publish
+
+on:
+ release:
+ types: [released]
+
+jobs:
+ publish:
+ name: Release build and publish
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: set up JDK
+ id: setup-jdk
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+
+ - name: Create binary keyring
+ env:
+ GPG_KEY_CONTENTS: ${{ secrets.SIGNING_KEY_SECRET }}
+ SIGNING_KEY_RING_FILE: ${{ secrets.SIGNING_KEY_FILE_PATH }}
+ run: |
+ git fetch --unshallow
+ sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_KEY_RING_FILE'"
+
+ - name: Publish to MavenCentral
+ run: ./gradlew --max-workers 1 --no-daemon publishReleasePublicationToSonatypeRepository closeAndReleaseRepository
+ env:
+ SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
+ SIGNING_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
+ SIGNING_KEY_FILE_PATH: ${{ secrets.SIGNING_KEY_FILE_PATH }}
+ OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
+ OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
+ SONATYPE_PROFILE_ID: ${{ secrets.SONATYPE_PROFILE_ID }}
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 55a34cee..72a8a920 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -14,6 +14,7 @@
+
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index efa46250..67a1b5f1 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -16,5 +16,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_jzbrooks_vgo_1_4_0.xml b/.idea/libraries/Gradle__com_jzbrooks_vgo_1_4_0.xml
new file mode 100644
index 00000000..b5443970
--- /dev/null
+++ b/.idea/libraries/Gradle__com_jzbrooks_vgo_1_4_0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_jzbrooks_vgo_core_1_4_0.xml b/.idea/libraries/Gradle__com_jzbrooks_vgo_core_1_4_0.xml
new file mode 100644
index 00000000..b3a371bd
--- /dev/null
+++ b/.idea/libraries/Gradle__com_jzbrooks_vgo_core_1_4_0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml
index 4f32fdef..1fa0fa9f 100644
--- a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml
+++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml
@@ -3,7 +3,9 @@
-
+
+
+
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_reflect_1_4_20.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_reflect_1_4_20.xml
new file mode 100644
index 00000000..eed7590f
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_reflect_1_4_20.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml
index d8a64161..f5a073e9 100644
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_21.xml
@@ -3,7 +3,9 @@
-
+
+
+
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml
index 7d5e0ca9..9bac695a 100644
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_21.xml
@@ -3,7 +3,9 @@
-
+
+
+
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml
index 15d96e9b..591d7ada 100644
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_21.xml
@@ -3,7 +3,9 @@
-
+
+
+
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_21.xml
index 87c709a0..54b0ce29 100644
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_21.xml
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_21.xml
@@ -3,7 +3,9 @@
-
+
+
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 1640a3a2..632ef252 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,11 +3,14 @@
+
-
+
+
+
diff --git a/.idea/modules/vgo-core/vgo.vgo-core.main.iml b/.idea/modules/vgo-core/vgo.vgo-core.main.iml
index 900feb1a..72c99887 100644
--- a/.idea/modules/vgo-core/vgo.vgo-core.main.iml
+++ b/.idea/modules/vgo-core/vgo.vgo-core.main.iml
@@ -1,5 +1,6 @@
+
diff --git a/.idea/modules/vgo-core/vgo.vgo-core.test.iml b/.idea/modules/vgo-core/vgo.vgo-core.test.iml
index 33e50903..21258ea4 100644
--- a/.idea/modules/vgo-core/vgo.vgo-core.test.iml
+++ b/.idea/modules/vgo-core/vgo.vgo-core.test.iml
@@ -1,5 +1,6 @@
+
@@ -48,6 +49,8 @@
+
+
diff --git a/.idea/modules/vgo-plugin.iml b/.idea/modules/vgo-plugin.iml
new file mode 100644
index 00000000..3b4972d2
--- /dev/null
+++ b/.idea/modules/vgo-plugin.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/vgo-plugin/vgo.vgo-plugin.iml b/.idea/modules/vgo-plugin/vgo.vgo-plugin.iml
new file mode 100644
index 00000000..43e54253
--- /dev/null
+++ b/.idea/modules/vgo-plugin/vgo.vgo-plugin.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/vgo-plugin/vgo.vgo-plugin.main.iml b/.idea/modules/vgo-plugin/vgo.vgo-plugin.main.iml
new file mode 100644
index 00000000..9d87f481
--- /dev/null
+++ b/.idea/modules/vgo-plugin/vgo.vgo-plugin.main.iml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/vgo-plugin/vgo.vgo-plugin.test.iml b/.idea/modules/vgo-plugin/vgo.vgo-plugin.test.iml
new file mode 100644
index 00000000..06319ecd
--- /dev/null
+++ b/.idea/modules/vgo-plugin/vgo.vgo-plugin.test.iml
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/vgo/vgo.vgo.integrationTest.iml b/.idea/modules/vgo/vgo.vgo.integrationTest.iml
new file mode 100644
index 00000000..ce70a57f
--- /dev/null
+++ b/.idea/modules/vgo/vgo.vgo.integrationTest.iml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/vgo/vgo.vgo.main.iml b/.idea/modules/vgo/vgo.vgo.main.iml
index 67339a03..2205d512 100644
--- a/.idea/modules/vgo/vgo.vgo.main.iml
+++ b/.idea/modules/vgo/vgo.vgo.main.iml
@@ -1,5 +1,6 @@
+
diff --git a/.idea/modules/vgo/vgo.vgo.test.iml b/.idea/modules/vgo/vgo.vgo.test.iml
index be969c62..4d4d4ce5 100644
--- a/.idea/modules/vgo/vgo.vgo.test.iml
+++ b/.idea/modules/vgo/vgo.vgo.test.iml
@@ -1,5 +1,6 @@
+
diff --git a/.idea/runConfigurations/test.xml b/.idea/runConfigurations/test.xml
index 007adb41..20e14137 100644
--- a/.idea/runConfigurations/test.xml
+++ b/.idea/runConfigurations/test.xml
@@ -1,6 +1,9 @@
+
+
+
diff --git a/build.gradle.kts b/build.gradle.kts
index 150d8292..20d0d43e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,18 +1,33 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import io.codearte.gradle.nexus.NexusStagingExtension
+import java.util.Properties
+import java.io.FileInputStream
buildscript {
repositories {
jcenter()
+ mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21")
+ classpath("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0")
}
}
allprojects {
+ val buildProperties = run {
+ val properties = Properties()
+ FileInputStream("$rootDir/build.properties").use(properties::load)
+ properties
+ }
+
+ group = "com.jzbrooks"
+ version = buildProperties["version"]?.toString() ?: ""
+
repositories {
- jcenter()
+ mavenLocal()
+ mavenCentral()
}
tasks.withType {
@@ -24,6 +39,8 @@ allprojects {
}
tasks.withType {
+ useJUnitPlatform()
+
addTestListener(object : TestListener {
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent == null) {
@@ -43,4 +60,18 @@ allprojects {
override fun beforeSuite(suite: TestDescriptor?) {}
})
}
+}
+
+ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID")
+ext["signing.password"] = System.getenv("SIGNING_PASSWORD")
+ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_KEY_FILE_PATH")
+
+apply(plugin = "io.codearte.nexus-staging")
+configure {
+ packageGroup = "com.jzbrooks"
+ stagingProfileId = System.getenv("SONATYPE_PROFILE_ID")
+ numberOfRetries = 60
+ delayBetweenRetriesInMillis = 30_000
+ username = System.getenv("OSSRH_USERNAME")
+ password = System.getenv("OSSRH_PASSWORD")
}
\ No newline at end of file
diff --git a/build.properties b/build.properties
new file mode 100644
index 00000000..e16eed22
--- /dev/null
+++ b/build.properties
@@ -0,0 +1 @@
+version=1.4.0
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index 598951e0..951fca40 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,15 @@
Change Log
==========
+## 1.4.0
+_02.15.2021_
+
+* Added: Gradle plugin
+* Improved: Reworked the gradle modules to better be published as a library (vgo-core) and thin application wrapper (vgo).
+* Added: Sonatype publishing
+
## 1.3.0
+_01.18.2021_
* Added: Collapse multiple Bézier curves into elliptical arcs when possible
* Improvement: Target JVM 11
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ce31224f..d7d99ef3 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -7,4 +7,4 @@
* in the user manual at https://docs.gradle.org/5.6/userguide/multi_project_builds.html
*/
-include("vgo", "vgo-core")
\ No newline at end of file
+include("vgo-core", "vgo", "vgo-plugin")
diff --git a/vgo-core/build.gradle.kts b/vgo-core/build.gradle.kts
index dd994f7c..dc047f1b 100644
--- a/vgo-core/build.gradle.kts
+++ b/vgo-core/build.gradle.kts
@@ -1,16 +1,79 @@
plugins {
id("org.jetbrains.kotlin.jvm")
+ id("maven-publish")
+ id("signing")
}
dependencies {
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
-
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.22")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.6.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.0")
}
-tasks.withType {
- useJUnitPlatform()
+tasks {
+ val sourcesJar by creating(Jar::class) {
+ archiveClassifier.set("sources")
+ from(sourceSets["main"].allSource)
+ }
+
+ val javadocJar by creating(Jar::class) {
+ archiveClassifier.set("javadoc")
+ from(this@tasks["javadoc"])
+ }
+}
+
+publishing {
+ publications {
+ create("release") {
+ artifactId = "vgo-core"
+
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["javadocJar"])
+ from(components["kotlin"])
+
+ @Suppress("UnstableApiUsage")
+ pom {
+ name.set("vgo-core")
+ description.set("vgo-core is a library for optimizing vector artwork files.")
+ url.set("https://github.com/jzbrooks/vgo/")
+
+ licenses {
+ license {
+ name.set("MIT License")
+ url.set("https://github.com/jzbrooks/vgo/blob/master/LICENSE")
+ }
+ }
+
+ developers {
+ developer {
+ id.set("jzbrooks")
+ name.set("Justin Brooks")
+ email.set("justin@jzbrooks.com")
+ }
+ }
+
+ scm {
+ connection.set("scm:git:github.com/jzbrooks/vgo.git")
+ developerConnection.set("scm:git:ssh://github.com/jzbrooks/vgo.git")
+ url.set("https://github.com/jzbrooks/vgo/tree/master")
+ }
+ }
+ }
+ }
+
+ repositories {
+ maven {
+ name = "sonatype"
+ url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials {
+ username = System.getenv("OSSRH_USERNAME")
+ password = System.getenv("OSSRH_PASSWORD")
+ }
+ }
+ }
+}
+
+signing {
+ sign(publishing.publications)
}
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphic.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphic.kt
similarity index 87%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphic.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphic.kt
index c6f0ad14..7ed1d923 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphic.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphic.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.graphic.Element
import com.jzbrooks.vgo.core.graphic.Graphic
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicCommandPrinter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicCommandPrinter.kt
similarity index 99%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicCommandPrinter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicCommandPrinter.kt
index 2e1fa752..d3fccb9a 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicCommandPrinter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicCommandPrinter.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.graphic.command.*
import com.jzbrooks.vgo.core.util.math.Point
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReader.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReader.kt
similarity index 91%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReader.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReader.kt
index 1d09cd40..2b24bba9 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReader.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReader.kt
@@ -1,11 +1,11 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.graphic.*
import com.jzbrooks.vgo.core.graphic.command.Command
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.svg.graphic.ClipPath
-import com.jzbrooks.vgo.util.xml.asSequence
-import com.jzbrooks.vgo.util.xml.toMutableMap
+import com.jzbrooks.vgo.core.svg.graphic.ClipPath
+import com.jzbrooks.vgo.core.util.xml.asSequence
+import com.jzbrooks.vgo.core.util.xml.toMutableMap
import org.w3c.dom.Comment
import org.w3c.dom.Node
import org.w3c.dom.Text
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriter.kt
similarity index 97%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriter.kt
index ab0ade71..19d78c9d 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriter.kt
@@ -1,8 +1,8 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.Writer
import com.jzbrooks.vgo.core.graphic.*
-import com.jzbrooks.vgo.svg.graphic.ClipPath
+import com.jzbrooks.vgo.core.svg.graphic.ClipPath
import org.w3c.dom.Document
import java.io.OutputStream
import javax.xml.parsers.DocumentBuilderFactory
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/SvgOptimizationRegistry.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/SvgOptimizationRegistry.kt
similarity index 90%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/SvgOptimizationRegistry.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/SvgOptimizationRegistry.kt
index 6577ba24..ce90483a 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/SvgOptimizationRegistry.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/SvgOptimizationRegistry.kt
@@ -1,7 +1,7 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.optimization.*
-import com.jzbrooks.vgo.svg.optimization.BakeTransformations
+import com.jzbrooks.vgo.core.svg.optimization.BakeTransformations
class SvgOptimizationRegistry : OptimizationRegistry(emptyList(), topDownOptimizations, emptyList(), wholeGraphicOptimizations) {
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverter.kt
similarity index 98%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverter.kt
index 72c16e5d..224cc4e2 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverter.kt
@@ -1,11 +1,11 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import com.jzbrooks.vgo.core.graphic.*
-import com.jzbrooks.vgo.svg.graphic.ClipPath
-import com.jzbrooks.vgo.vd.VectorDrawable
+import com.jzbrooks.vgo.core.svg.graphic.ClipPath
+import com.jzbrooks.vgo.core.vd.VectorDrawable
import kotlin.math.atan
import kotlin.math.hypot
-import com.jzbrooks.vgo.vd.graphic.ClipPath as AndroidClipPath
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath as AndroidClipPath
private val namedColorValues = mapOf(
"black" to "#000000",
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/graphic/ClipPath.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/graphic/ClipPath.kt
similarity index 86%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/graphic/ClipPath.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/graphic/ClipPath.kt
index cef8b819..35ed8617 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/graphic/ClipPath.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/graphic/ClipPath.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.svg.graphic
+package com.jzbrooks.vgo.core.svg.graphic
import com.jzbrooks.vgo.core.graphic.ContainerElement
import com.jzbrooks.vgo.core.graphic.Element
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/optimization/BakeTransformations.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/optimization/BakeTransformations.kt
similarity index 99%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/svg/optimization/BakeTransformations.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/optimization/BakeTransformations.kt
index d7c767d9..9da97c02 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/svg/optimization/BakeTransformations.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/svg/optimization/BakeTransformations.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.svg.optimization
+package com.jzbrooks.vgo.core.svg.optimization
import com.jzbrooks.vgo.core.graphic.Group
import com.jzbrooks.vgo.core.graphic.PathElement
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/util/xml/XmlExtensions.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/util/xml/XmlExtensions.kt
similarity index 94%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/util/xml/XmlExtensions.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/util/xml/XmlExtensions.kt
index d634237c..0fa64a55 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/util/xml/XmlExtensions.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/util/xml/XmlExtensions.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.util.xml
+package com.jzbrooks.vgo.core.util.xml
import org.w3c.dom.NamedNodeMap
import org.w3c.dom.Node
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/SvgConverter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/SvgConverter.kt
similarity index 98%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/SvgConverter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/SvgConverter.kt
index 538050eb..40009686 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/SvgConverter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/SvgConverter.kt
@@ -1,9 +1,9 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.graphic.*
import com.jzbrooks.vgo.core.util.math.Matrix3
-import com.jzbrooks.vgo.svg.ScalableVectorGraphic
-import com.jzbrooks.vgo.vd.graphic.ClipPath
+import com.jzbrooks.vgo.core.svg.ScalableVectorGraphic
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sin
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawable.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawable.kt
similarity index 87%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawable.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawable.kt
index 092b33f4..3a2843a7 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawable.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawable.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.graphic.Element
import com.jzbrooks.vgo.core.graphic.Graphic
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinter.kt
similarity index 99%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinter.kt
index fc10126a..412fe309 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinter.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.graphic.command.*
import com.jzbrooks.vgo.core.util.math.Point
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableOptimizationRegistry.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableOptimizationRegistry.kt
similarity index 90%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableOptimizationRegistry.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableOptimizationRegistry.kt
index 3f72f924..678d3dde 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableOptimizationRegistry.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableOptimizationRegistry.kt
@@ -1,7 +1,7 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.optimization.*
-import com.jzbrooks.vgo.vd.optimization.BakeTransformations
+import com.jzbrooks.vgo.core.vd.optimization.BakeTransformations
class VectorDrawableOptimizationRegistry : OptimizationRegistry(prePass, topDownOptimizations, emptyList(), postPass) {
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReader.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReader.kt
similarity index 92%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReader.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReader.kt
index 3d34a801..d1120d6c 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReader.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReader.kt
@@ -1,11 +1,11 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.graphic.*
import com.jzbrooks.vgo.core.graphic.command.Command
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.util.xml.asSequence
-import com.jzbrooks.vgo.util.xml.toMutableMap
-import com.jzbrooks.vgo.vd.graphic.ClipPath
+import com.jzbrooks.vgo.core.util.xml.asSequence
+import com.jzbrooks.vgo.core.util.xml.toMutableMap
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath
import org.w3c.dom.Comment
import org.w3c.dom.Node
import org.w3c.dom.Text
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriter.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriter.kt
similarity index 97%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriter.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriter.kt
index 34e3b335..791eb082 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriter.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriter.kt
@@ -1,8 +1,8 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import com.jzbrooks.vgo.core.Writer
import com.jzbrooks.vgo.core.graphic.*
-import com.jzbrooks.vgo.vd.graphic.ClipPath
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath
import org.w3c.dom.Document
import java.io.OutputStream
import javax.xml.parsers.DocumentBuilderFactory
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/graphic/ClipPath.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/graphic/ClipPath.kt
similarity index 86%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/graphic/ClipPath.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/graphic/ClipPath.kt
index 36fad3dd..c2f85935 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/graphic/ClipPath.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/graphic/ClipPath.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd.graphic
+package com.jzbrooks.vgo.core.vd.graphic
import com.jzbrooks.vgo.core.graphic.PathElement
import com.jzbrooks.vgo.core.graphic.command.Command
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformations.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformations.kt
similarity index 99%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformations.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformations.kt
index 749ca840..169c6814 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformations.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformations.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd.optimization
+package com.jzbrooks.vgo.core.vd.optimization
import com.jzbrooks.vgo.core.graphic.*
import com.jzbrooks.vgo.core.graphic.command.*
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributes.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributes.kt
similarity index 93%
rename from vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributes.kt
rename to vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributes.kt
index 6b26c5d4..bba66696 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributes.kt
+++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributes.kt
@@ -1,11 +1,11 @@
-package com.jzbrooks.vgo.vd.optimization
+package com.jzbrooks.vgo.core.vd.optimization
import com.jzbrooks.vgo.core.graphic.ContainerElement
import com.jzbrooks.vgo.core.graphic.PathElement
import com.jzbrooks.vgo.core.optimization.ContainerElementVisitor
import com.jzbrooks.vgo.core.optimization.PathElementVisitor
import com.jzbrooks.vgo.core.optimization.TopDownOptimization
-import com.jzbrooks.vgo.vd.VectorDrawable
+import com.jzbrooks.vgo.core.vd.VectorDrawable
class RemoveRedundantAttributes : TopDownOptimization, ContainerElementVisitor, PathElementVisitor {
override fun visit(containerElement: ContainerElement) {
diff --git a/vgo-core/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Map.kt
similarity index 93%
rename from vgo-core/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Map.kt
index 14cdc4bf..2b31379c 100644
--- a/vgo-core/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Map.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.assertk.extensions
+package com.jzbrooks.vgo.core.assertk.extensions
import assertk.Assert
import assertk.assertions.support.expected
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Node.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Node.kt
similarity index 93%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Node.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Node.kt
index 07ffbf85..4384d295 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Node.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/assertk/extensions/Node.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.assertk.extensions
+package com.jzbrooks.vgo.core.assertk.extensions
import assertk.Assert
import assertk.assertions.support.fail
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReaderTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReaderTests.kt
similarity index 96%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReaderTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReaderTests.kt
index 18a4907a..4496de88 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicReaderTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicReaderTests.kt
@@ -1,13 +1,13 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.hasSize
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
-import com.jzbrooks.vgo.assertk.extensions.containsKey
-import com.jzbrooks.vgo.assertk.extensions.containsKeys
-import com.jzbrooks.vgo.assertk.extensions.doesNotContainKey
+import com.jzbrooks.vgo.core.assertk.extensions.containsKey
+import com.jzbrooks.vgo.core.assertk.extensions.containsKeys
+import com.jzbrooks.vgo.core.assertk.extensions.doesNotContainKey
import com.jzbrooks.vgo.core.graphic.Extra
import com.jzbrooks.vgo.core.graphic.Graphic
import com.jzbrooks.vgo.core.graphic.Path
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriterTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriterTests.kt
similarity index 95%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriterTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriterTests.kt
index aef52330..bee76e36 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/ScalableVectorGraphicWriterTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/ScalableVectorGraphicWriterTests.kt
@@ -1,15 +1,15 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import assertk.assertThat
import assertk.assertions.isEqualTo
-import com.jzbrooks.vgo.assertk.extensions.hasName
-import com.jzbrooks.vgo.assertk.extensions.hasNames
-import com.jzbrooks.vgo.assertk.extensions.hasValue
+import com.jzbrooks.vgo.core.assertk.extensions.hasName
+import com.jzbrooks.vgo.core.assertk.extensions.hasNames
+import com.jzbrooks.vgo.core.assertk.extensions.hasValue
import com.jzbrooks.vgo.core.graphic.Extra
import com.jzbrooks.vgo.core.graphic.Group
import com.jzbrooks.vgo.core.graphic.Path
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.util.xml.toList
+import com.jzbrooks.vgo.core.util.xml.toList
import org.junit.jupiter.api.Test
import org.w3c.dom.Document
import java.io.ByteArrayInputStream
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverterTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverterTests.kt
similarity index 98%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverterTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverterTests.kt
index 9deeb13e..f95ad860 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/svg/VectorDrawableConverterTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/svg/VectorDrawableConverterTests.kt
@@ -1,13 +1,13 @@
-package com.jzbrooks.vgo.svg
+package com.jzbrooks.vgo.core.svg
import assertk.assertThat
import assertk.assertions.*
import com.jzbrooks.vgo.core.graphic.Group
import com.jzbrooks.vgo.core.graphic.Path
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.svg.graphic.ClipPath
+import com.jzbrooks.vgo.core.svg.graphic.ClipPath
import org.junit.jupiter.api.Test
-import com.jzbrooks.vgo.vd.graphic.ClipPath as AndroidClipPath
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath as AndroidClipPath
class VectorDrawableConverterTests {
@Test
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/SvgConverterTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/SvgConverterTests.kt
similarity index 99%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/SvgConverterTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/SvgConverterTests.kt
index 66b08567..48f29353 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/SvgConverterTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/SvgConverterTests.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import assertk.assertThat
import assertk.assertions.contains
@@ -9,7 +9,7 @@ import com.jzbrooks.vgo.core.graphic.Extra
import com.jzbrooks.vgo.core.graphic.Group
import com.jzbrooks.vgo.core.graphic.Path
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.vd.graphic.ClipPath
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath
import org.junit.jupiter.api.Test
class SvgConverterTests {
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinterTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinterTests.kt
similarity index 99%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinterTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinterTests.kt
index fc8c876d..ba5304bf 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableCommandPrinterTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableCommandPrinterTests.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import assertk.assertThat
import assertk.assertions.isEqualTo
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReaderTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReaderTests.kt
similarity index 96%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReaderTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReaderTests.kt
index e9bd741d..bc34adbd 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableReaderTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableReaderTests.kt
@@ -1,10 +1,10 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import assertk.assertThat
import assertk.assertions.*
-import com.jzbrooks.vgo.assertk.extensions.containsKey
-import com.jzbrooks.vgo.assertk.extensions.containsKeys
-import com.jzbrooks.vgo.assertk.extensions.doesNotContainKey
+import com.jzbrooks.vgo.core.assertk.extensions.containsKey
+import com.jzbrooks.vgo.core.assertk.extensions.containsKeys
+import com.jzbrooks.vgo.core.assertk.extensions.doesNotContainKey
import com.jzbrooks.vgo.core.graphic.Extra
import com.jzbrooks.vgo.core.graphic.Graphic
import com.jzbrooks.vgo.core.graphic.Path
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriterTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriterTests.kt
similarity index 95%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriterTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriterTests.kt
index 04920019..9580c7c9 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/VectorDrawableWriterTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/VectorDrawableWriterTests.kt
@@ -1,18 +1,18 @@
-package com.jzbrooks.vgo.vd
+package com.jzbrooks.vgo.core.vd
import assertk.assertThat
import assertk.assertions.endsWith
import assertk.assertions.isEqualTo
import assertk.assertions.startsWith
-import com.jzbrooks.vgo.assertk.extensions.hasName
-import com.jzbrooks.vgo.assertk.extensions.hasNames
-import com.jzbrooks.vgo.assertk.extensions.hasValue
+import com.jzbrooks.vgo.core.assertk.extensions.hasName
+import com.jzbrooks.vgo.core.assertk.extensions.hasNames
+import com.jzbrooks.vgo.core.assertk.extensions.hasValue
import com.jzbrooks.vgo.core.graphic.Extra
import com.jzbrooks.vgo.core.graphic.Group
import com.jzbrooks.vgo.core.graphic.Path
import com.jzbrooks.vgo.core.graphic.command.CommandString
-import com.jzbrooks.vgo.util.xml.toList
-import com.jzbrooks.vgo.vd.graphic.ClipPath
+import com.jzbrooks.vgo.core.util.xml.toList
+import com.jzbrooks.vgo.core.vd.graphic.ClipPath
import org.junit.jupiter.api.Test
import org.w3c.dom.Document
import java.io.ByteArrayInputStream
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformationsTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformationsTests.kt
similarity index 98%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformationsTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformationsTests.kt
index 8a59c353..a20fff7c 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/BakeTransformationsTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/BakeTransformationsTests.kt
@@ -1,9 +1,9 @@
-package com.jzbrooks.vgo.vd.optimization
+package com.jzbrooks.vgo.core.vd.optimization
import assertk.assertThat
import assertk.assertions.*
-import com.jzbrooks.vgo.assertk.extensions.containsKey
-import com.jzbrooks.vgo.assertk.extensions.doesNotContainKey
+import com.jzbrooks.vgo.core.assertk.extensions.containsKey
+import com.jzbrooks.vgo.core.assertk.extensions.doesNotContainKey
import com.jzbrooks.vgo.core.graphic.Element
import com.jzbrooks.vgo.core.graphic.Graphic
import com.jzbrooks.vgo.core.graphic.Group
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/ConvertCurvesToArcsTest.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/ConvertCurvesToArcsTest.kt
similarity index 97%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/ConvertCurvesToArcsTest.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/ConvertCurvesToArcsTest.kt
index 0a3fc5ed..7914f05c 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/ConvertCurvesToArcsTest.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/ConvertCurvesToArcsTest.kt
@@ -1,4 +1,4 @@
-package com.jzbrooks.vgo.vd.optimization
+package com.jzbrooks.vgo.core.vd.optimization
import assertk.assertThat
import assertk.assertions.hasSize
@@ -11,8 +11,7 @@ import com.jzbrooks.vgo.core.graphic.command.EllipticalArcCurve
import com.jzbrooks.vgo.core.graphic.command.MoveTo
import com.jzbrooks.vgo.core.optimization.ConvertCurvesToArcs
import com.jzbrooks.vgo.core.util.math.Point
-import com.jzbrooks.vgo.vd.VectorDrawableCommandPrinter
-import org.junit.jupiter.api.Disabled
+import com.jzbrooks.vgo.core.vd.VectorDrawableCommandPrinter
import org.junit.jupiter.api.Test
class ConvertCurvesToArcsTest {
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributesTests.kt b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributesTests.kt
similarity index 95%
rename from vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributesTests.kt
rename to vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributesTests.kt
index 3a1b2111..d482f995 100644
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/vd/optimization/RemoveRedundantAttributesTests.kt
+++ b/vgo-core/src/test/kotlin/com/jzbrooks/vgo/core/vd/optimization/RemoveRedundantAttributesTests.kt
@@ -1,9 +1,9 @@
-package com.jzbrooks.vgo.vd.optimization
+package com.jzbrooks.vgo.core.vd.optimization
import assertk.assertThat
import assertk.assertions.isEmpty
import com.jzbrooks.vgo.core.graphic.Path
-import com.jzbrooks.vgo.vd.VectorDrawable
+import com.jzbrooks.vgo.core.vd.VectorDrawable
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
diff --git a/vgo/src/integration-test/resources/avocado_example.xml b/vgo-core/src/test/resources/avocado_example.xml
similarity index 100%
rename from vgo/src/integration-test/resources/avocado_example.xml
rename to vgo-core/src/test/resources/avocado_example.xml
diff --git a/vgo/src/integration-test/resources/simple_heart.svg b/vgo-core/src/test/resources/simple_heart.svg
similarity index 100%
rename from vgo/src/integration-test/resources/simple_heart.svg
rename to vgo-core/src/test/resources/simple_heart.svg
diff --git a/vgo/src/test/resources/vd_visibilitystrike.xml b/vgo-core/src/test/resources/vd_visibilitystrike.xml
similarity index 100%
rename from vgo/src/test/resources/vd_visibilitystrike.xml
rename to vgo-core/src/test/resources/vd_visibilitystrike.xml
diff --git a/vgo-plugin/.gitignore b/vgo-plugin/.gitignore
new file mode 100644
index 00000000..9d4cdedb
--- /dev/null
+++ b/vgo-plugin/.gitignore
@@ -0,0 +1 @@
+src/test/caches
\ No newline at end of file
diff --git a/vgo-plugin/build.gradle.kts b/vgo-plugin/build.gradle.kts
new file mode 100644
index 00000000..1e0c825f
--- /dev/null
+++ b/vgo-plugin/build.gradle.kts
@@ -0,0 +1,92 @@
+plugins {
+ `kotlin-dsl`
+ id("org.jetbrains.kotlin.jvm")
+ id("java-gradle-plugin")
+ id("maven-publish")
+ id("signing")
+}
+
+dependencies {
+ implementation(project(":vgo"))
+
+ testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.22")
+ testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
+ testImplementation("org.junit.jupiter:junit-jupiter-engine:5.6.0")
+ testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.0")
+}
+
+gradlePlugin {
+ plugins {
+ register("VgoPlugin") {
+ id = "com.jzbrooks.vgo"
+ implementationClass = "com.jzbrooks.vgo.plugin.VgoPlugin"
+ }
+ }
+}
+
+tasks {
+ val sourcesJar by creating(Jar::class) {
+ archiveClassifier.set("sources")
+ from(sourceSets["main"].allSource)
+ }
+
+ val javadocJar by creating(Jar::class) {
+ archiveClassifier.set("javadoc")
+ from(this@tasks["javadoc"])
+ }
+}
+
+publishing {
+ publications {
+ create("release") {
+ artifactId = "vgo-plugin"
+
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["javadocJar"])
+ from(components["kotlin"])
+
+ @Suppress("UnstableApiUsage")
+ pom {
+ name.set("vgo-plugin")
+ description.set("vgo is a gradle plugin for optimizing vector artwork files that helps ensure a compact representation without compromising quality.")
+ url.set("https://github.com/jzbrooks/vgo/")
+
+ licenses {
+ license {
+ name.set("MIT License")
+ url.set("https://github.com/jzbrooks/vgo/blob/master/LICENSE")
+ }
+ }
+
+ developers {
+ developer {
+ id.set("jzbrooks")
+ name.set("Justin Brooks")
+ email.set("justin@jzbrooks.com")
+ }
+ }
+
+ scm {
+ connection.set("scm:git:github.com/jzbrooks/vgo.git")
+ developerConnection.set("scm:git:ssh://github.com/jzbrooks/vgo.git")
+ url.set("https://github.com/jzbrooks/vgo/tree/master")
+ }
+ }
+ }
+ }
+
+ repositories {
+ maven {
+ name = "sonatype"
+ url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials {
+ username = System.getenv("OSSRH_USERNAME")
+ password = System.getenv("OSSRH_PASSWORD")
+ }
+ }
+ }
+}
+
+signing {
+ sign(publishing.publications)
+}
diff --git a/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPlugin.kt b/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPlugin.kt
new file mode 100644
index 00000000..380c108a
--- /dev/null
+++ b/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPlugin.kt
@@ -0,0 +1,46 @@
+package com.jzbrooks.vgo.plugin
+
+import com.jzbrooks.vgo.Application
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.file.FileTree
+import org.gradle.kotlin.dsl.create
+
+class VgoPlugin : Plugin {
+ override fun apply(target: Project) {
+ val extension = target.extensions.create("vgo")
+
+ val defaultTree: FileTree = target.fileTree(target.projectDir) {
+ include("**/res/drawable*/*.xml")
+ }
+
+ target.tasks.register("shrinkVectorArtwork") {
+ val argList = mutableListOf()
+ val input = (extension.inputs ?: defaultTree).files
+
+ argList.addAll(input.map { it.absolutePath })
+
+ if (extension.indent != 0.toByte()) {
+ argList.addAll(arrayOf("--indent", extension.indent.toString()))
+ }
+
+ if (extension.format != OutputFormat.UNCHANGED) {
+ argList.addAll(arrayOf("--format", extension.format.cliName))
+ }
+
+ if (extension.showStatistics) {
+ argList.add("--stats")
+ }
+
+ group = "resource"
+ description = "Shrink vector resources."
+
+ inputs.files(input)
+ outputs.files(input)
+
+ doLast {
+ Application().run(argList.toTypedArray())
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPluginExtension.kt b/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPluginExtension.kt
new file mode 100644
index 00000000..102c5d19
--- /dev/null
+++ b/vgo-plugin/src/main/kotlin/com/jzbrooks/vgo/plugin/VgoPluginExtension.kt
@@ -0,0 +1,17 @@
+package com.jzbrooks.vgo.plugin
+
+import org.gradle.api.file.FileTree
+
+enum class OutputFormat(internal val cliName: String) {
+ SVG("svg"),
+ VECTOR_DRAWABLE("vd"),
+ UNCHANGED("unchanged"),
+}
+
+open class VgoPluginExtension {
+ var inputs: FileTree? = null
+ var outputs: FileTree? = inputs
+ var showStatistics = true
+ var format = OutputFormat.UNCHANGED
+ var indent: Byte = 0
+}
diff --git a/vgo-plugin/src/test/kotlin/com/jzbrooks/vgo/plugin/VgoPluginTest.kt b/vgo-plugin/src/test/kotlin/com/jzbrooks/vgo/plugin/VgoPluginTest.kt
new file mode 100644
index 00000000..288de9c1
--- /dev/null
+++ b/vgo-plugin/src/test/kotlin/com/jzbrooks/vgo/plugin/VgoPluginTest.kt
@@ -0,0 +1,37 @@
+package com.jzbrooks.vgo.plugin
+
+import assertk.assertThat
+import assertk.assertions.containsExactly
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.configure
+import org.gradle.testfixtures.ProjectBuilder
+import org.junit.jupiter.api.Disabled
+import org.junit.jupiter.api.Test
+import java.io.File
+
+class VgoPluginTest {
+ @Test
+ fun pluginAddsTaskToProject() {
+ val project: Project = ProjectBuilder.builder().build()
+ project.pluginManager.apply("com.jzbrooks.vgo")
+ project.tasks.getByName("shrinkVectorArtwork")
+ }
+
+ @Disabled("Needs a custom task first (to get the output out of the task)")
+ @Test
+ fun testConfiguration() {
+ val project: Project = ProjectBuilder.builder()
+ .withProjectDir(File("src/test"))
+ .build()
+
+ val input = File(project.projectDir, "kotlin/com/jzbrooks/vgo/plugin/VgoPluginTest.kt")
+
+ project.pluginManager.apply("com.jzbrooks.vgo")
+ project.configure {
+ inputs = project.fileTree(input)
+ }
+ val task = project.tasks.getByName("shrinkVectorArtwork")
+
+// assertThat(task.args).containsExactly(input.absolutePath, "--stats")
+ }
+}
\ No newline at end of file
diff --git a/vgo-plugin/src/test/userHome/caches/journal-1/file-access.properties b/vgo-plugin/src/test/userHome/caches/journal-1/file-access.properties
new file mode 100644
index 00000000..7197b308
--- /dev/null
+++ b/vgo-plugin/src/test/userHome/caches/journal-1/file-access.properties
@@ -0,0 +1,2 @@
+#Thu Jan 21 21:14:41 CST 2021
+inceptionTimestamp=1611285281968
diff --git a/vgo/build.gradle.kts b/vgo/build.gradle.kts
index fe077ab2..aba51262 100644
--- a/vgo/build.gradle.kts
+++ b/vgo/build.gradle.kts
@@ -1,20 +1,12 @@
-import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
-import org.jetbrains.kotlin.gradle.targets.js.npm.fromSrcPackageJson
-import java.io.FileInputStream
import java.io.PrintWriter
import java.nio.file.Files
import java.nio.file.Paths
-import java.util.Properties
plugins {
id("org.jetbrains.kotlin.jvm")
-}
-
-val buildProperties = run {
- val properties = Properties()
- FileInputStream("$projectDir/build.properties").use(properties::load)
- properties
+ id("maven-publish")
+ id("signing")
}
sourceSets {
@@ -23,20 +15,10 @@ sourceSets {
kotlin.srcDir("src/generated/kotlin")
}
}
-
- create("integrationTest") {
- withConvention(KotlinSourceSet::class) {
- kotlin.srcDir("src/integration-test/kotlin")
- resources.srcDir("src/integration-test/resources")
- compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
- runtimeClasspath += output + compileClasspath + sourceSets["test"].runtimeClasspath
- }
- }
}
dependencies {
implementation(project(":vgo-core"))
- implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.22")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
@@ -45,16 +27,38 @@ dependencies {
}
tasks {
- withType {
- useJUnitPlatform()
+ compileKotlin {
+ dependsOn("generateConstants")
}
- withType> {
- dependsOn("generateConstants")
+ jar {
+ dependsOn(configurations.runtimeClasspath)
+
+ manifest {
+ attributes["Main-Class"] = "com.jzbrooks.vgo.Application"
+ attributes["Bundle-Version"] = project.version
+ }
+
+ val sourceClasses = sourceSets.main.get().output.classesDirs
+ inputs.files(sourceClasses)
+ destinationDirectory.set(file("$buildDir/libs/debug"))
+
+ doFirst {
+ from(files(sourceClasses))
+ from(configurations.runtimeClasspath.get().asFileTree.files.map(::zipTree))
+
+ exclude(
+ "**/*.kotlin_metadata",
+ "**/*.kotlin_module",
+ "**/*.kotlin_builtins",
+ "**/module-info.class",
+ "META-INF/maven/**",
+ "META-INF/*.version"
+ )
+ }
}
val generateConstants by registering {
- inputs.properties(buildProperties.mapKeys { it.toString() }.mapValues { it.toString() })
outputs.files("$projectDir/src/generated/kotlin/com/jzbrooks/BuildConstants.kt")
doLast {
@@ -72,13 +76,12 @@ tasks {
""".trimMargin()
)
- for (property in buildProperties) {
- append(" const val ")
- append(property.key.toString().toUpperCase())
- append(" = \"")
- append(property.value)
- appendln('"')
- }
+
+ append(" const val ")
+ append("VERSION")
+ append(" = \"")
+ append(project.version)
+ appendln('"')
appendln("}")
}
@@ -87,40 +90,12 @@ tasks {
}
}
-
- withType {
- dependsOn(configurations.runtimeClasspath)
-
- manifest {
- attributes["Main-Class"] = "com.jzbrooks.vgo.Application"
- attributes["Bundle-Version"] = buildProperties["version"].toString()
- }
-
- val sourceClasses = sourceSets.main.get().output.classesDirs
- inputs.files(sourceClasses)
- destinationDirectory.set(file("$buildDir/libs/debug"))
-
- doFirst {
- from(files(sourceClasses))
- from(configurations.runtimeClasspath.get().asFileTree.files.map(::zipTree))
-
- exclude(
- "**/*.kotlin_metadata",
- "**/*.kotlin_module",
- "**/*.kotlin_builtins",
- "**/module-info.class",
- "META-INF/maven/**",
- "META-INF/*.version"
- )
- }
- }
-
val optimizedJar = file("$buildDir/libs/vgo.jar")
val optimize by registering(JavaExec::class) {
description = "Runs proguard on the jar application."
group = "build"
- inputs.file("$buildDir/libs/debug/vgo.jar")
+ inputs.file("$buildDir/libs/debug/vgo-$version.jar")
outputs.file(optimizedJar)
val javaHome = System.getenv("JAVA_HOME") ?: javaInstalls
@@ -134,7 +109,7 @@ tasks {
"--lib", javaHome,
"--output", "$buildDir/libs/vgo.jar",
"--pg-conf", "$rootDir/optimize.pro",
- "$buildDir/libs/debug/vgo.jar"
+ "$buildDir/libs/debug/vgo-$version.jar"
)
dependsOn(getByName("jar"))
@@ -159,23 +134,15 @@ tasks {
}
}
- val integrationTest by registering(Test::class) {
- description = "Runs the integration tests."
- group = "verification"
- testClassesDirs = sourceSets["integrationTest"].output.classesDirs
- classpath = sourceSets["integrationTest"].runtimeClasspath
- mustRunAfter("test")
- }
-
val updateBaselineOptimizations by registering(Copy::class) {
description = "Updates baseline assets with the latest integration test outputs."
group = "Build Setup"
- from("$buildDir/integrationTest/") {
+ from("$buildDir/test/") {
include("*testOptimizationFinishes.xml")
include("*testOptimizationFinishes.svg")
}
- into("src/integration-test/resources/baseline/")
+ into("src/test/resources/baseline/")
rename { original ->
val originalAssetName = original.let {
val i = it.lastIndexOf('_')
@@ -186,5 +153,68 @@ tasks {
}
}
- getByName("check").dependsOn(integrationTest)
+ val sourcesJar by creating(Jar::class) {
+ archiveClassifier.set("sources")
+ from(sourceSets["main"].allSource)
+ }
+
+ val javadocJar by creating(Jar::class) {
+ archiveClassifier.set("javadoc")
+ from(this@tasks["javadoc"])
+ }
+}
+
+publishing {
+ publications {
+ create("release") {
+ artifactId = "vgo"
+
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["javadocJar"])
+ from(components["kotlin"])
+
+ @Suppress("UnstableApiUsage")
+ pom {
+ name.set("vgo")
+ description.set("vgo is a tool for optimizing vector artwork files that helps ensure your vector artwork is represented compactly without compromising quality.")
+ url.set("https://github.com/jzbrooks/vgo/")
+
+ licenses {
+ license {
+ name.set("MIT License")
+ url.set("https://github.com/jzbrooks/vgo/blob/master/LICENSE")
+ }
+ }
+
+ developers {
+ developer {
+ id.set("jzbrooks")
+ name.set("Justin Brooks")
+ email.set("justin@jzbrooks.com")
+ }
+ }
+
+ scm {
+ connection.set("scm:git:github.com/jzbrooks/vgo.git")
+ developerConnection.set("scm:git:ssh://github.com/jzbrooks/vgo.git")
+ url.set("https://github.com/jzbrooks/vgo/tree/master")
+ }
+ }
+ }
+ }
+
+ repositories {
+ maven {
+ name = "sonatype"
+ url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials {
+ username = System.getenv("OSSRH_USERNAME")
+ password = System.getenv("OSSRH_PASSWORD")
+ }
+ }
+ }
+}
+
+signing {
+ sign(publishing.publications)
}
diff --git a/vgo/build.properties b/vgo/build.properties
deleted file mode 100644
index d7e252ba..00000000
--- a/vgo/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-version=1.3.0
\ No newline at end of file
diff --git a/vgo/src/main/kotlin/com/jzbrooks/vgo/Application.kt b/vgo/src/main/kotlin/com/jzbrooks/vgo/Application.kt
index f1b70cba..9a1772ae 100644
--- a/vgo/src/main/kotlin/com/jzbrooks/vgo/Application.kt
+++ b/vgo/src/main/kotlin/com/jzbrooks/vgo/Application.kt
@@ -2,15 +2,12 @@ package com.jzbrooks.vgo
import com.jzbrooks.BuildConstants
import com.jzbrooks.vgo.core.Writer
-import com.jzbrooks.vgo.svg.ScalableVectorGraphic
-import com.jzbrooks.vgo.svg.ScalableVectorGraphicWriter
-import com.jzbrooks.vgo.svg.SvgOptimizationRegistry
-import com.jzbrooks.vgo.svg.toVectorDrawable
-import com.jzbrooks.vgo.util.xml.asSequence
-import com.jzbrooks.vgo.vd.VectorDrawable
-import com.jzbrooks.vgo.vd.VectorDrawableOptimizationRegistry
-import com.jzbrooks.vgo.vd.VectorDrawableWriter
-import com.jzbrooks.vgo.vd.toSvg
+import com.jzbrooks.vgo.core.svg.*
+import com.jzbrooks.vgo.core.util.xml.asSequence
+import com.jzbrooks.vgo.core.vd.VectorDrawable
+import com.jzbrooks.vgo.core.vd.VectorDrawableOptimizationRegistry
+import com.jzbrooks.vgo.core.vd.VectorDrawableWriter
+import com.jzbrooks.vgo.core.vd.toSvg
import org.w3c.dom.Document
import java.io.File
import javax.xml.parsers.DocumentBuilderFactory
@@ -134,8 +131,10 @@ class Application {
val rootNodes = document.childNodes.asSequence().filter { it.nodeType == Document.ELEMENT_NODE }.toList()
var graphic = when {
- rootNodes.any { it.nodeName == "svg" || input.extension == "svg" } -> com.jzbrooks.vgo.svg.parse(rootNodes.first())
- rootNodes.any { it.nodeName == "vector" && input.extension == "xml"} -> com.jzbrooks.vgo.vd.parse(rootNodes.first())
+ rootNodes.any { it.nodeName == "svg" || input.extension == "svg" } -> parse(rootNodes.first())
+ rootNodes.any { it.nodeName == "vector" && input.extension == "xml"} -> com.jzbrooks.vgo.core.vd.parse(
+ rootNodes.first()
+ )
else -> if (input == output) return else null
}
diff --git a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/BaselineTests.kt b/vgo/src/test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
similarity index 96%
rename from vgo/src/integration-test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
rename to vgo/src/test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
index c40135fe..77a156f3 100644
--- a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
+++ b/vgo/src/test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
@@ -80,10 +80,10 @@ class BaselineTests {
init {
// Loads the files based on the convention that optimized files
- // live in src/integration-test/resources/baseline and are suffixed
+ // live in src/test/resources/baseline and are suffixed
// with _optimized
assets = try {
- Files.list(Paths.get("src/integration-test/resources"))
+ Files.list(Paths.get("src/test/resources"))
.asSequence()
.filterNot { Files.isDirectory(it) }
.map { unoptimizedFile ->
diff --git a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt b/vgo/src/test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt
similarity index 92%
rename from vgo/src/integration-test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt
rename to vgo/src/test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt
index ece01649..e17738b4 100644
--- a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt
+++ b/vgo/src/test/kotlin/com/jzbrooks/vgo/CommandLineInterfaceTests.kt
@@ -12,8 +12,8 @@ import java.io.PrintStream
import java.nio.file.Paths
class CommandLineInterfaceTests {
- private val avocadoExampleRelativePath = "src/integration-test/resources/avocado_example.xml"
- private val heartExampleRelativePath = "src/integration-test/resources/simple_heart.xml"
+ private val avocadoExampleRelativePath = "src/test/resources/avocado_example.xml"
+ private val heartExampleRelativePath = "src/test/resources/simple_heart.xml"
private lateinit var systemOutput: ByteArrayOutputStream
@BeforeEach
@@ -81,7 +81,7 @@ class CommandLineInterfaceTests {
@Test
fun `unmodified files are omitted from statistics`() {
- val input = "src/integration-test/resources/baseline/simple_heart_optimized.xml"
+ val input = "src/test/resources/baseline/simple_heart_optimized.xml"
val arguments = arrayOf(
input,
"-o",
@@ -97,7 +97,7 @@ class CommandLineInterfaceTests {
@Test
fun `directory inputs include a filename with statistics`() {
val arguments = arrayOf(
- "src/integration-test/resources/in-place-modify",
+ "src/test/resources/in-place-modify",
"-o",
"build/integrationTest/multi-stats-test-directory",
"--stats"
@@ -105,7 +105,7 @@ class CommandLineInterfaceTests {
val exitCode = Application().run(arguments)
assertThat(exitCode).isEqualTo(0)
val report = systemOutput.toString()
- assertThat(report).contains("src/integration-test/resources/in-place-modify/avocado_example.xml")
+ assertThat(report).contains("src/test/resources/in-place-modify/avocado_example.xml")
}
@Test
diff --git a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt b/vgo/src/test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt
similarity index 68%
rename from vgo/src/integration-test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt
rename to vgo/src/test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt
index 9c9691bb..b5c1df72 100644
--- a/vgo/src/integration-test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt
+++ b/vgo/src/test/kotlin/com/jzbrooks/vgo/InPlaceModificationTest.kt
@@ -17,14 +17,14 @@ class InPlaceModificationTest {
@BeforeEach
fun copyToSide() {
- val originalFolder = File("src/integration-test/resources/in-place-modify/")
+ val originalFolder = File("src/test/resources/in-place-modify/")
val reservedFolder = File("build/integrationTest/inPlaceModification/reserved/")
originalFolder.copyRecursively(reservedFolder, true)
}
@AfterEach
fun resetFiles() {
- val originalFolder = File("src/integration-test/resources/in-place-modify/")
+ val originalFolder = File("src/test/resources/in-place-modify/")
val reservedFolder = File("build/integrationTest/inPlaceModification/reserved/")
reservedFolder.copyRecursively(originalFolder, true)
}
@@ -42,7 +42,7 @@ class InPlaceModificationTest {
@Test
fun `in-place optimization completes successfully`() {
- val arguments = arrayOf("src/integration-test/resources/in-place-modify")
+ val arguments = arrayOf("src/test/resources/in-place-modify")
val exitCode = Application().run(arguments)
@@ -51,37 +51,37 @@ class InPlaceModificationTest {
@Test
fun `individual file statistics are reported with a directory input`() {
- val arguments = arrayOf("src/integration-test/resources/in-place-modify", "--stats")
+ val arguments = arrayOf("src/test/resources/in-place-modify", "--stats")
Application().run(arguments)
assertThat(systemOutput.toString())
- .contains("src/integration-test/resources/in-place-modify/avocado_example.xml")
+ .contains("src/test/resources/in-place-modify/avocado_example.xml")
}
@Test
fun `non-vector files are not mentioned in statistics reporting with a directory input`() {
- val arguments = arrayOf("src/integration-test/resources/in-place-modify", "--stats")
+ val arguments = arrayOf("src/test/resources/in-place-modify", "--stats")
Application().run(arguments)
assertThat(systemOutput.toString())
- .doesNotContain("src/integration-test/resources/in-place-modify/non_vector.xml")
+ .doesNotContain("src/test/resources/in-place-modify/non_vector.xml")
}
@Test
fun `only modified files appear in statistics reporting`() {
- val arguments = arrayOf("src/integration-test/resources/in-place-modify", "--stats")
+ val arguments = arrayOf("src/test/resources/in-place-modify", "--stats")
Application().run(arguments)
assertThat(systemOutput.toString())
- .doesNotContain("src/integration-test/resources/in-place-modify/avocado_example_optimized.xml")
+ .doesNotContain("src/test/resources/in-place-modify/avocado_example_optimized.xml")
}
@Test
fun `non-vector files are not modified`() {
- val input = File("src/integration-test/resources/in-place-modify/non_vector.xml")
+ val input = File("src/test/resources/in-place-modify/non_vector.xml")
val before = input.readText()
Application().run(arrayOf(input.parent))
diff --git a/vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt b/vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt
deleted file mode 100644
index 14cdc4bf..00000000
--- a/vgo/src/test/kotlin/com/jzbrooks/vgo/assertk/extensions/Map.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.jzbrooks.vgo.assertk.extensions
-
-import assertk.Assert
-import assertk.assertions.support.expected
-
-fun Assert