Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conditionally add the smalidea project to the root project
The smalidea project is only added when you're actually in the
smalidea directory
  • Loading branch information
JesusFreke committed Feb 27, 2016
1 parent ff4c85c commit 29d714f
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 87 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -9,4 +9,3 @@
*.ipr
*.iws
.idea
/smalidea/.gradle
24 changes: 13 additions & 11 deletions build.gradle
Expand Up @@ -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'
]
}

Expand Down
6 changes: 5 additions & 1 deletion settings.gradle
@@ -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'
}
148 changes: 74 additions & 74 deletions smalidea/build.gradle
Expand Up @@ -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'
}
}

Expand Down Expand Up @@ -118,97 +117,94 @@ if (!('idea' in gradle.startParameter.taskNames)) {
if (gradle.startParameter.taskNames.size() > 1) {
throw new InvalidUserDataException("The idea task must be run by itself.")
}
}

repositories {
mavenLocal()
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 {
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("""
<configuration default="false" name="All tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" runner="idea" />
<module name="smalidea" />
<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="WORKING_DIRECTORY" value="file://\$PROJECT_DIR\$" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<dir value="\$PROJECT_DIR\$/src/test/java" />
</configuration>"""))
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("""
<configuration default="false" name="All smalidea tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" runner="idea" />
<module name="smalidea" />
<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="WORKING_DIRECTORY" value="file://\$PROJECT_DIR\$/smalidea" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<dir value="\$PROJECT_DIR\$/smalidea/src/test/java" />
</configuration>"""))
}
}
}
}
}
}

module {
excludeDirs -= buildDir
if (buildDir.exists()) {
excludeDirs.addAll(buildDir.listFiles())
}
idea {
module {
jdkName = 'IDEA Plugin jdk'

for (sourceDir in (sourceDirs + testSourceDirs)) {
excludeDirs.remove(sourceDir);
while ((sourceDir = sourceDir.getParentFile()) != null) {
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
iml {
withXml {
def node = it.node

node.@type = 'PLUGIN_MODULE'
node.@type = 'PLUGIN_MODULE'

def pluginUrl = 'file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml'
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
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) {
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 smaliArtifact = allArtifacts.find { it.moduleVersion.id.name.equals('smali') }

Expand All @@ -229,4 +225,8 @@ generateGrammarSource.dependsOn(extractTokens)
ideaModule.dependsOn(generateGrammarSource)

task release(dependsOn: ':buildPlugin') {
}
}

tasks.getByPath('idea').dependsOn(project(':').getTasksByName('idea', true).findAll({
it.project.name != 'smalidea'
}))

0 comments on commit 29d714f

Please sign in to comment.