diff --git a/.gitignore b/.gitignore index f5cd3998..45e097ee 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ *.ipr *.iws .idea -/smalidea/.gradle diff --git a/build.gradle b/build.gradle index fb3173cf..80ac25f8 100644 --- a/build.gradle +++ b/build.gradle @@ -97,17 +97,19 @@ subprojects { version = parent.version ext { - depends = [guava: 'com.google.guava:guava:18.0', - findbugs: 'com.google.code.findbugs:jsr305:1.3.9', - junit: 'junit:junit:4.6', - antlr_runtime: 'org.antlr:antlr-runtime:3.5.2', - antlr: 'org.antlr:antlr:3.5.2', - stringtemplate: 'org.antlr:stringtemplate:3.2.1', - commons_cli: 'commons-cli:commons-cli:1.2', - jflex: 'de.jflex:jflex:1.4.3', - jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2', - proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1', - dx: 'com.google.android.tools:dx:1.7' + depends = [ + guava: 'com.google.guava:guava:18.0', + findbugs: 'com.google.code.findbugs:jsr305:1.3.9', + junit: 'junit:junit:4.6', + antlr_runtime: 'org.antlr:antlr-runtime:3.5.2', + antlr: 'org.antlr:antlr:3.5.2', + stringtemplate: 'org.antlr:stringtemplate:3.2.1', + commons_cli: 'commons-cli:commons-cli:1.2', + jflex: 'de.jflex:jflex:1.4.3', + jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2', + proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1', + dx: 'com.google.android.tools:dx:1.7', + gson: 'com.google.code.gson:gson:2.3.1' ] } diff --git a/settings.gradle b/settings.gradle index 6c4f08cf..f7a6cf75 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,5 @@ -include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator' \ No newline at end of file +include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator' + +if (System.getProperty("user.dir").startsWith(file("smalidea").absolutePath)) { + include 'smalidea' +} \ No newline at end of file diff --git a/smalidea/build.gradle b/smalidea/build.gradle index dcf6c5c1..e6b08e38 100644 --- a/smalidea/build.gradle +++ b/smalidea/build.gradle @@ -37,7 +37,6 @@ buildscript { } dependencies { classpath 'gradle.plugin.org.jetbrains:gradle-intellij-plugin:0.0.40' - classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r' } } @@ -118,6 +117,78 @@ if (!('idea' in gradle.startParameter.taskNames)) { if (gradle.startParameter.taskNames.size() > 1) { throw new InvalidUserDataException("The idea task must be run by itself.") } + + project(':') { + idea { + project { + ipr { + withXml { + def node = it.asNode() + + /*node.find { it.@name == 'ProjectRootManager' } + .@'project-jdk-type' = 'IDEA JDK'*/ + + def componentNode = node.find { it.@name == 'ProjectRunConfigurationManager' } + if (componentNode == null) { + componentNode = it.node.appendNode 'component', [name: 'ProjectRunConfigurationManager'] + } + + if (componentNode.find { it.@name == 'All smalidea tests' } == null) { + componentNode.append(new XmlParser().parseText(""" + + + + + + """)) + } + } + } + } + } + } + + idea { + module { + jdkName = 'IDEA Plugin jdk' + + excludeDirs -= buildDir + if (buildDir.exists()) { + excludeDirs.addAll(buildDir.listFiles()) + } + + for (sourceDir in (sourceDirs + testSourceDirs)) { + excludeDirs.remove(sourceDir); + while ((sourceDir = sourceDir.getParentFile()) != null) { + excludeDirs.remove(sourceDir); + } + } + + iml { + withXml { + def node = it.node + + node.@type = 'PLUGIN_MODULE' + + def pluginUrl = 'file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml' + + def pluginNode = node.find { it.@name == 'DevKit.ModuleBuildProperties' } + if (pluginNode == null) { + node.appendNode 'component', [name: 'DevKit.ModuleBuildProperties', + url : pluginUrl] + } else { + pluginNode.@url = pluginUrl + } + } + } + } + } } repositories { @@ -126,89 +197,14 @@ repositories { } dependencies { - compile 'org.smali:smali:2.1.2-205bf333' - compile 'org.antlr:antlr-runtime:3.5.2' - compile 'com.google.code.gson:gson:2.3.1' + compile project(':smali') + compile depends.antlr_runtime + compile depends.gson - antlr 'org.antlr:antlr:3.5.2' + antlr depends.antlr } -idea { - project { - jdkName = 'IDEA Plugin jdk' - languageLevel 1.7 - - vcs = 'Git' - - ipr { - withXml { - def node = it.asNode() - - node.find { it.@name == 'ProjectRootManager' } - .@'project-jdk-type' = 'IDEA JDK' - - node.find { it.@name == 'VcsDirectoryMappings' } - .mapping.@directory = '$PROJECT_DIR$/..' - - def componentNode = node.find { it.@name == 'ProjectRunConfigurationManager' } - - if (componentNode == null) { - componentNode = it.node.appendNode 'component', [name: 'ProjectRunConfigurationManager'] - } - - if (componentNode.find { it.@name == 'All tests' } == null) { - componentNode.append(new XmlParser().parseText(""" - - - - - - """)) - } - } - } - } - - module { - excludeDirs -= buildDir - if (buildDir.exists()) { - excludeDirs.addAll(buildDir.listFiles()) - } - - for (sourceDir in (sourceDirs + testSourceDirs)) { - excludeDirs.remove(sourceDir); - while ((sourceDir = sourceDir.getParentFile()) != null) { - excludeDirs.remove(sourceDir); - } - } - - iml { - withXml { - def node = it.node - - node.@type = 'PLUGIN_MODULE' - - def pluginUrl = 'file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml' - - def pluginNode = node.find { it.@name == 'DevKit.ModuleBuildProperties' } - if (pluginNode == null) { - node.appendNode 'component', [name: 'DevKit.ModuleBuildProperties', - url: pluginUrl] - } else { - pluginNode.@url = pluginUrl - } - } - } - } -} - -task extractTokens(type: org.gradle.api.tasks.Copy) { +task extractTokens(type: org.gradle.api.tasks.Copy, dependsOn: ':smali:build') { def allArtifacts = configurations.default.resolvedConfiguration.resolvedArtifacts def smaliArtifact = allArtifacts.find { it.moduleVersion.id.name.equals('smali') } @@ -229,4 +225,8 @@ generateGrammarSource.dependsOn(extractTokens) ideaModule.dependsOn(generateGrammarSource) task release(dependsOn: ':buildPlugin') { -} \ No newline at end of file +} + +tasks.getByPath('idea').dependsOn(project(':').getTasksByName('idea', true).findAll({ + it.project.name != 'smalidea' +})) \ No newline at end of file