Conditionally add the smalidea project to the root project

The smalidea project is only added when you're actually in the
smalidea directory
This commit is contained in:
Ben Gruver 2016-02-26 22:09:08 -08:00
parent ff4c85c5e4
commit 29d714f71f
4 changed files with 100 additions and 95 deletions

1
.gitignore vendored
View File

@ -9,4 +9,3 @@
*.ipr *.ipr
*.iws *.iws
.idea .idea
/smalidea/.gradle

View File

@ -97,7 +97,8 @@ subprojects {
version = parent.version version = parent.version
ext { ext {
depends = [guava: 'com.google.guava:guava:18.0', depends = [
guava: 'com.google.guava:guava:18.0',
findbugs: 'com.google.code.findbugs:jsr305:1.3.9', findbugs: 'com.google.code.findbugs:jsr305:1.3.9',
junit: 'junit:junit:4.6', junit: 'junit:junit:4.6',
antlr_runtime: 'org.antlr:antlr-runtime:3.5.2', antlr_runtime: 'org.antlr:antlr-runtime:3.5.2',
@ -107,7 +108,8 @@ subprojects {
jflex: 'de.jflex:jflex:1.4.3', jflex: 'de.jflex:jflex:1.4.3',
jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2', jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2',
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1', proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1',
dx: 'com.google.android.tools:dx:1.7' dx: 'com.google.android.tools:dx:1.7',
gson: 'com.google.code.gson:gson:2.3.1'
] ]
} }

View File

@ -1 +1,5 @@
include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator' include 'util', 'dexlib2', 'baksmali', 'smali', 'dexlib2:accessorTestGenerator'
if (System.getProperty("user.dir").startsWith(file("smalidea").absolutePath)) {
include 'smalidea'
}

View File

@ -37,7 +37,6 @@ buildscript {
} }
dependencies { dependencies {
classpath 'gradle.plugin.org.jetbrains:gradle-intellij-plugin:0.0.40' classpath 'gradle.plugin.org.jetbrains:gradle-intellij-plugin:0.0.40'
classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r'
} }
} }
@ -118,64 +117,47 @@ if (!('idea' in gradle.startParameter.taskNames)) {
if (gradle.startParameter.taskNames.size() > 1) { if (gradle.startParameter.taskNames.size() > 1) {
throw new InvalidUserDataException("The idea task must be run by itself.") throw new InvalidUserDataException("The idea task must be run by itself.")
} }
}
repositories { project(':') {
mavenLocal() idea {
mavenCentral()
}
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'
antlr 'org.antlr:antlr:3.5.2'
}
idea {
project { project {
jdkName = 'IDEA Plugin jdk'
languageLevel 1.7
vcs = 'Git'
ipr { ipr {
withXml { withXml {
def node = it.asNode() def node = it.asNode()
node.find { it.@name == 'ProjectRootManager' } /*node.find { it.@name == 'ProjectRootManager' }
.@'project-jdk-type' = 'IDEA JDK' .@'project-jdk-type' = 'IDEA JDK'*/
node.find { it.@name == 'VcsDirectoryMappings' }
.mapping.@directory = '$PROJECT_DIR$/..'
def componentNode = node.find { it.@name == 'ProjectRunConfigurationManager' } def componentNode = node.find { it.@name == 'ProjectRunConfigurationManager' }
if (componentNode == null) { if (componentNode == null) {
componentNode = it.node.appendNode 'component', [name: 'ProjectRunConfigurationManager'] componentNode = it.node.appendNode 'component', [name: 'ProjectRunConfigurationManager']
} }
if (componentNode.find { it.@name == 'All tests' } == null) { if (componentNode.find { it.@name == 'All smalidea tests' } == null) {
componentNode.append(new XmlParser().parseText(""" componentNode.append(new XmlParser().parseText("""
<configuration default="false" name="All tests" type="JUnit" factoryName="JUnit"> <configuration default="false" name="All smalidea tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" runner="idea" /> <extension name="coverage" enabled="false" merge="false" runner="idea" />
<module name="smalidea" /> <module name="smalidea" />
<option name="TEST_OBJECT" value="directory" /> <option name="TEST_OBJECT" value="directory" />
<option name="VM_PARAMETERS" value="-Didea.system.path=${buildDir}/sandbox/config -Didea.system.path=${buildDir}/sandbox/system-test -Didea.load.plugins.id=org.jf.smalidea" /> <option name="VM_PARAMETERS" value="-Didea.system.path=${buildDir}/sandbox/config -Didea.system.path=${buildDir}/sandbox/system-test -Didea.load.plugins.id=org.jf.smalidea" />
<option name="WORKING_DIRECTORY" value="file://\$PROJECT_DIR\$" /> <option name="WORKING_DIRECTORY" value="file://\$PROJECT_DIR\$/smalidea" />
<option name="PASS_PARENT_ENVS" value="true" /> <option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE"> <option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" /> <value defaultName="moduleWithDependencies" />
</option> </option>
<dir value="\$PROJECT_DIR\$/src/test/java" /> <dir value="\$PROJECT_DIR\$/smalidea/src/test/java" />
</configuration>""")) </configuration>"""))
} }
} }
} }
} }
}
}
idea {
module { module {
jdkName = 'IDEA Plugin jdk'
excludeDirs -= buildDir excludeDirs -= buildDir
if (buildDir.exists()) { if (buildDir.exists()) {
excludeDirs.addAll(buildDir.listFiles()) excludeDirs.addAll(buildDir.listFiles())
@ -199,16 +181,30 @@ idea {
def pluginNode = node.find { it.@name == 'DevKit.ModuleBuildProperties' } def pluginNode = node.find { it.@name == 'DevKit.ModuleBuildProperties' }
if (pluginNode == null) { if (pluginNode == null) {
node.appendNode 'component', [name: 'DevKit.ModuleBuildProperties', node.appendNode 'component', [name: 'DevKit.ModuleBuildProperties',
url: pluginUrl] url : pluginUrl]
} else { } else {
pluginNode.@url = pluginUrl pluginNode.@url = pluginUrl
} }
} }
} }
} }
}
} }
task extractTokens(type: org.gradle.api.tasks.Copy) { repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile project(':smali')
compile depends.antlr_runtime
compile depends.gson
antlr depends.antlr
}
task extractTokens(type: org.gradle.api.tasks.Copy, dependsOn: ':smali:build') {
def allArtifacts = configurations.default.resolvedConfiguration.resolvedArtifacts def allArtifacts = configurations.default.resolvedConfiguration.resolvedArtifacts
def smaliArtifact = allArtifacts.find { it.moduleVersion.id.name.equals('smali') } def smaliArtifact = allArtifacts.find { it.moduleVersion.id.name.equals('smali') }
@ -230,3 +226,7 @@ ideaModule.dependsOn(generateGrammarSource)
task release(dependsOn: ':buildPlugin') { task release(dependsOn: ':buildPlugin') {
} }
tasks.getByPath('idea').dependsOn(project(':').getTasksByName('idea', true).findAll({
it.project.name != 'smalidea'
}))