Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ test-system

# Ignore Gradle project-specific cache directory
.gradle

.idea
.intellijPlatform

local.properties
25 changes: 25 additions & 0 deletions .run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="IDE logs" path="$PROJECT_DIR$/build/idea-sandbox/*/log/idea.log" show_all="true" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
25 changes: 25 additions & 0 deletions .run/Run Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="check" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
</component>
25 changes: 25 additions & 0 deletions .run/Run Verifications.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="verifyPlugin" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
117 changes: 0 additions & 117 deletions build.gradle

This file was deleted.

104 changes: 104 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright 2025, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import org.gradle.kotlin.dsl.testImplementation
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java")
id("antlr")
id("org.jetbrains.kotlin.jvm") version "2.2.20"
id("org.jetbrains.intellij.platform") version "2.10.1"
}

group = "org.jf"
version = "0.08"

kotlin {
jvmToolchain(17)
}

repositories {
mavenCentral()
google()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
intellijPlatform {
intellijIdeaCommunity("2025.2.4")
// androidStudio("2025.1.4.8")
bundledPlugin("com.intellij.java")
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.Plugin.Java)
}

implementation("com.android.tools.smali:smali:3.0.9")
implementation("com.android.tools.smali:smali-util:3.0.9")
implementation("com.android.tools.smali:smali-dexlib2:3.0.9")

implementation("org.antlr:antlr-runtime:3.5.2")
implementation("com.google.code.gson:gson:2.8.9")
antlr("org.antlr:antlr:3.5.3")

testImplementation("junit:junit:4.13.2")

// TODO: move from javax.annotations to org.jetbrains.annotations
implementation("com.github.spotbugs:spotbugs-annotations:4.9.7")
}

val extractTokensTask = tasks.register<Copy>("extractTokens") {
val smaliZip = providers.provider {
val artifacts = configurations.runtimeClasspath.flatMap {
it.incoming.artifacts.resolvedArtifacts
}.get()
artifacts.find { it.id.displayName.contains(":smali") }?.file
?: throw GradleException("Could not find 'smali' artifact in 'default' configuration")
}

from(smaliZip.map { zipTree(it) }) {
include("**/*.tokens")
}
into(layout.buildDirectory.dir("tokens"))
}

tasks.generateGrammarSource.configure {
val tokensDir = layout.buildDirectory.dir("tokens/com/android/tools/smali/smali/")
arguments = arguments + listOf("-lib", tokensDir.get().asFile.path)
outputDirectory = layout.buildDirectory.dir("generated-src/antlr/main/org/jf/smalidea/").get().asFile
dependsOn(extractTokensTask)
}

tasks.patchPluginXml.configure {
sinceBuild = provider { null }
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

38 changes: 38 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2025, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

@file:Suppress("UnstableApiUsage")

rootProject.name = "smalidea"

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
4 changes: 2 additions & 2 deletions src/main/java/org/jf/smalidea/PsiBuilderTokenStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
import org.antlr.runtime.TokenSource;
import org.antlr.runtime.TokenStream;
import org.jetbrains.annotations.Nullable;
import org.jf.smali.InvalidToken;
import org.jf.smali.smaliParser;
import com.android.tools.smali.smali.InvalidToken;
import com.android.tools.smali.smali.smaliParser;

import javax.annotation.Nonnull;
import java.util.ArrayList;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jf/smalidea/SmaliIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
import javax.swing.*;

public class SmaliIcons {
public static final Icon SmaliIcon = IconLoader.getIcon("/icons/smali.png");
public static final Icon SmaliIcon = IconLoader.getIcon("/icons/smali.svg", SmaliIcons.class);
}
6 changes: 3 additions & 3 deletions src/main/java/org/jf/smalidea/SmaliLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import com.intellij.psi.tree.IElementType;
import org.antlr.runtime.CommonToken;
import org.jetbrains.annotations.NotNull;
import org.jf.smali.smaliFlexLexer;
import org.jf.smali.smaliParser;
import org.jf.smali.util.BlankReader;
import com.android.tools.smali.smali.smaliFlexLexer;
import com.android.tools.smali.smali.smaliParser;
import com.android.tools.smali.smali.util.BlankReader;

public class SmaliLexer extends LexerBase {
// TODO: need to plumb in the api level somehow
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jf/smalidea/SmaliParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class SmaliParser implements PsiParser {
PsiBuilder.Marker classMarker = builder.mark();

PsiBuilderTokenStream tokenStream = new PsiBuilderTokenStream(builder);
smalideaParser parser = new smalideaParser(tokenStream);
org.jf.smalidea.smalideaParser parser = new org.jf.smalidea.smalideaParser(tokenStream);
parser.setPsiBuilder(builder);
try {
parser.smali_file();
Expand Down
Loading