Skip to content

Commit

Permalink
Merge pull request #34 from ciscorucinski/feature/add-gradle-support
Browse files Browse the repository at this point in the history
Added Gradle support and updated plugin to v2.1
  • Loading branch information
ciscorucinski authored Sep 14, 2017
2 parents 8da6c93 + dde00ca commit 34b5df0
Show file tree
Hide file tree
Showing 17 changed files with 685 additions and 101 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generated files
out/
build/
/local.properties
.DS_Store

# IDE files
nbproject
Expand All @@ -13,6 +16,13 @@ composer.lock
# files
*.iml

# Gradle
.gradle
!.idea/gradle.xml

# Extracting Plugin JAR file
installed.txt
IntelliJ IDEA Global Settings
IntelliJ IDEA Global Settings

# Sync Files
lvf_ChroMATERIAL Sync.xml
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# ChroMATERIAL v2.1

##### Updated

| Type | Supported |
| :--------------: | :-------- |
| **Languages** | <kbd>Gradle</kbd> |

##### Other Notable changes:

* Fixed regression with Gradle DSL not displayed as green. (Closes #31)<br>
* Fixed regression with Groovy Unknown Symbol having a gray boxed effect. (Closes #32)<br>
* Changed Unused Symbols to have yellow underlines. (Closes #33)<br>
* Updated Build System to use Gradle.<br>

# ChroMATERIAL v2.0

##### Added
Expand Down
Binary file modified ChroMATERIAL/ChroMATERIAL.jar
Binary file not shown.
172 changes: 172 additions & 0 deletions ChroMATERIAL/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
intellij {
pluginName 'ChroMATERIAL'
updateSinceUntilBuild true
}

sourceSets {
main {
resources {
srcDir 'resources'
exclude 'html/**'
exclude 'html'

srcDir 'src'

}
}
}

def GROUP_CHROMATERIAL = 'ChroMATERIAL'

group 'com.facebook.rucinskic.chromaterial' //'io.github.ciscorucinski.chromaterial'
version '2.1'

def sourceDir = 'src/colors'
def intelliJColorSchemeDir = "C:\\Users\\Christopher\\.Idea${intellij.type}${intellij.version}\\config\\colors"

def contentIndex = " "
def tagIndex = " "

def htmlFixer = {f -> file(f).text
.replace('\n', "\n${contentIndex}") // Add indentation to make plugin.xml look good
.trim()
.replace('<html>', '\n')
.replace("</html>", "\n${tagIndex}")
}

patchPluginXml {

pluginId 'com.facebook.rucinskic.chromaterial'
version project['version'] // Plugin version
sinceBuild '131'
untilBuild '999.*'

pluginDescription htmlFixer('resources/html/pluginDescription.html')
changeNotes htmlFixer('resources/html/changeLog.html')

}

verifyPlugin {

def verifyingHtmlFile = file('resources/html/changeLog.html')
def verifyingMarkdownFile = file("${projectDir.parent}/CHANGELOG.md")

def html = new XmlSlurper().parseText(verifyingHtmlFile.text)
def markdown = verifyingMarkdownFile.text

def htmlVersion = html.h2[0].toString().substring(1)

println("Current version set in Gradle: ${project['version']}")

println("Examining '${verifyingHtmlFile.canonicalPath}'")
println("\tVersion: ${htmlVersion}")

// if (!(htmlVersion == "${project['version']}")) {
// throw new GradleException("Verification Error :: Plugin version is out-of-date.\n" +
// "Please add the correct version information to `${verifyingHtmlFile.name}` " +
// "(${htmlVersion} --> ${project['version']})")
// }

// def mdTemplate = "# ChroMATERIAL v"
// def mdVersion = markdown.substring(mdTemplate.length(), markdown.indexOf('\n'))

// println("Examining '${verifyingMarkdownFile.canonicalPath}'")
// println("\tVersion: ${mdVersion}")

// if (!(mdVersion == "${project['version']}")) {
// throw new GradleException("Verification Error :: Plugin version is out-of-date.\n" +
// "Please add the correct version information to `${verifyingMarkdownFile.name}` " +
// "(${mdVersion} --> ${project['version']})")
// }

println("Plugin versions are up-to-date")

}

publishPlugin {
username usernameJetBrainPluginRepo
password passwordJetBrainPluginRepo
// channels 'eap'
distributionFile 'ChroMATERIAL.jar'
}

task copyGeneratedLibs() {

group GROUP_CHROMATERIAL

finalizedBy "copyJar_v${project['version']}"
finalizedBy "copyJars_All"
finalizedBy "copyPatchedPluginXML"

}

task syncFiles(type: Copy) {

group GROUP_CHROMATERIAL
description "Syncronizes the original color scheme files from IntelliJ IDEA into the project and changes the extension to be xml"

into sourceDir
from intelliJColorSchemeDir, {
rename 'ChroMATERIAL IntelliJ IDEA.icls', 'ChroMATERIAL.xml'
rename '(.*)\\.icls$', '$1.xml'
}

doLast {
println("Syncing and renaming files...\n\tfrom\t'$intelliJColorSchemeDir' \n\tinto\t'$sourceDir'")
}

}

task renameFiles {

group GROUP_CHROMATERIAL
description "Changes the '.icls' file extension of any file in the source directory to '.xml'."

doLast {
ant.move(todir: sourceDir) {
ant.fileset(dir: sourceDir)
ant.mapper {
ant.globmapper(from: 'ChroMATERIAL IntelliJ IDEA.icls', to: 'ChroMATERIAL.xml')
ant.globmapper(from: "*.icls", to: "*.xml")
}

}
}
}

tasks.create(name: "copyJar_v${project['version']}") {

group GROUP_CHROMATERIAL

def mostCurrentJarFile = "ChroMATERIAL-${project['version']}.jar"

copy {
into '/'
from 'build/libs', {
include mostCurrentJarFile
rename mostCurrentJarFile, 'ChroMATERIAL.jar'
}
}

}

task copyJars_All(type: Copy) {

group GROUP_CHROMATERIAL

into 'libs/'
from 'build/libs'
}

task copyPatchedPluginXML(type: Copy) {

group GROUP_CHROMATERIAL

into 'resources/META-INF/'
from 'build/patchedPluginXmlFiles' include 'plugin.xml'
}

build.dependsOn renameFiles
clean.dependsOn renameFiles
buildPlugin.dependsOn renameFiles
buildPlugin.finalizedBy copyGeneratedLibs
Binary file added ChroMATERIAL/libs/ChroMATERIAL-2.1.jar
Binary file not shown.
Loading

0 comments on commit 34b5df0

Please sign in to comment.