mirror of
https://github.com/revanced/smali.git
synced 2025-04-30 14:44:26 +02:00
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:
parent
ff4c85c5e4
commit
29d714f71f
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,4 +9,3 @@
|
|||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
.idea
|
.idea
|
||||||
/smalidea/.gradle
|
|
||||||
|
24
build.gradle
24
build.gradle
@ -97,17 +97,19 @@ subprojects {
|
|||||||
version = parent.version
|
version = parent.version
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
depends = [guava: 'com.google.guava:guava:18.0',
|
depends = [
|
||||||
findbugs: 'com.google.code.findbugs:jsr305:1.3.9',
|
guava: 'com.google.guava:guava:18.0',
|
||||||
junit: 'junit:junit:4.6',
|
findbugs: 'com.google.code.findbugs:jsr305:1.3.9',
|
||||||
antlr_runtime: 'org.antlr:antlr-runtime:3.5.2',
|
junit: 'junit:junit:4.6',
|
||||||
antlr: 'org.antlr:antlr:3.5.2',
|
antlr_runtime: 'org.antlr:antlr-runtime:3.5.2',
|
||||||
stringtemplate: 'org.antlr:stringtemplate:3.2.1',
|
antlr: 'org.antlr:antlr:3.5.2',
|
||||||
commons_cli: 'commons-cli:commons-cli:1.2',
|
stringtemplate: 'org.antlr:stringtemplate:3.2.1',
|
||||||
jflex: 'de.jflex:jflex:1.4.3',
|
commons_cli: 'commons-cli:commons-cli:1.2',
|
||||||
jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2',
|
jflex: 'de.jflex:jflex:1.4.3',
|
||||||
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1',
|
jflex_plugin: 'co.tomlee.gradle.plugins:gradle-jflex-plugin:0.0.2',
|
||||||
dx: 'com.google.android.tools:dx:1.7'
|
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'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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'
|
||||||
|
}
|
@ -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,6 +117,78 @@ 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.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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>"""))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
repositories {
|
||||||
@ -126,89 +197,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.smali:smali:2.1.2-205bf333'
|
compile project(':smali')
|
||||||
compile 'org.antlr:antlr-runtime:3.5.2'
|
compile depends.antlr_runtime
|
||||||
compile 'com.google.code.gson:gson:2.3.1'
|
compile depends.gson
|
||||||
|
|
||||||
antlr 'org.antlr:antlr:3.5.2'
|
antlr depends.antlr
|
||||||
}
|
}
|
||||||
|
|
||||||
idea {
|
task extractTokens(type: org.gradle.api.tasks.Copy, dependsOn: ':smali:build') {
|
||||||
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>"""))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
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') }
|
||||||
|
|
||||||
@ -229,4 +225,8 @@ generateGrammarSource.dependsOn(extractTokens)
|
|||||||
ideaModule.dependsOn(generateGrammarSource)
|
ideaModule.dependsOn(generateGrammarSource)
|
||||||
|
|
||||||
task release(dependsOn: ':buildPlugin') {
|
task release(dependsOn: ':buildPlugin') {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.getByPath('idea').dependsOn(project(':').getTasksByName('idea', true).findAll({
|
||||||
|
it.project.name != 'smalidea'
|
||||||
|
}))
|
Loading…
x
Reference in New Issue
Block a user