-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from LikeTheSalad/android-support
Adding Android support
- Loading branch information
Showing
15 changed files
with
301 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Android library project with animalsniffer check | ||
|
||
Output: | ||
|
||
``` | ||
> Task :android-app:animalsnifferDebug | ||
4 AnimalSniffer violations were found in 2 files. See the report at: file:////{PATH_FROM_ROOT}/gradle-animalsniffer-plugin/examples/android-app/build/reports/animalsniffer/debug.text | ||
[Undefined reference | java18-1.0] invalid.(Sample.java:9) | ||
>> String String.repeat(int) | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(Sample.java:9) | ||
>> String String.repeat(int) | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(Sample.java:15) | ||
>> java.nio.file.Path java.io.File.toPath() | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(SampleKotlin.kt:9) | ||
>> java.nio.file.Path java.io.File.toPath() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
plugins { | ||
id 'com.android.application' version '7.4.0' | ||
id 'org.jetbrains.kotlin.android' version '1.9.23' | ||
id 'ru.vyarus.animalsniffer' | ||
} | ||
|
||
android { | ||
compileSdk 33 | ||
namespace 'com.example.namespace' | ||
def javaVersion = JavaVersion.VERSION_1_8 | ||
|
||
compileOptions { | ||
sourceCompatibility(javaVersion) | ||
targetCompatibility(javaVersion) | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = javaVersion.toString() | ||
} | ||
} | ||
|
||
animalsniffer { | ||
// debug = true | ||
// only show errors | ||
ignoreFailures = true | ||
} | ||
|
||
repositories { mavenCentral(); google() } | ||
dependencies { | ||
signature 'org.codehaus.mojo.signature:java18:1.0@signature' | ||
signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature' | ||
|
||
implementation 'org.slf4j:slf4j-api:1.7.25' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package invalid; | ||
|
||
import java.io.File; | ||
|
||
public class Sample { | ||
|
||
public static void main(String[] args) { | ||
// method added in 11 | ||
"".repeat(5); | ||
} | ||
|
||
public void someth() { | ||
// not available in android | ||
File file = new File(""); | ||
file.toPath(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/android-app/src/main/java/invalid/SampleKotlin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package invalid | ||
|
||
import java.io.File | ||
|
||
class SampleKotlin { | ||
fun someth() { | ||
// not available in android | ||
val file = File("") | ||
file.toPath() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Android application project with animalsniffer check | ||
|
||
Output: | ||
|
||
``` | ||
> Task :android-lib:animalsnifferDebug | ||
4 AnimalSniffer violations were found in 2 files. See the report at: file:////{PATH_FROM_ROOT}/gradle-animalsniffer-plugin/examples/android-lib/build/reports/animalsniffer/debug.text | ||
[Undefined reference | java18-1.0] invalid.(Sample.java:9) | ||
>> String String.repeat(int) | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(Sample.java:9) | ||
>> String String.repeat(int) | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(Sample.java:15) | ||
>> java.nio.file.Path java.io.File.toPath() | ||
[Undefined reference | android-api-level-21-5.0.1_r2] invalid.(SampleKotlin.kt:9) | ||
>> java.nio.file.Path java.io.File.toPath() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
plugins { | ||
id 'com.android.library' version '7.4.0' | ||
id 'org.jetbrains.kotlin.android' version '1.9.23' | ||
id 'ru.vyarus.animalsniffer' | ||
} | ||
|
||
android { | ||
compileSdk 33 | ||
namespace 'com.example.namespace' | ||
def javaVersion = JavaVersion.VERSION_1_8 | ||
|
||
compileOptions { | ||
sourceCompatibility(javaVersion) | ||
targetCompatibility(javaVersion) | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = javaVersion.toString() | ||
} | ||
} | ||
|
||
animalsniffer { | ||
// debug = true | ||
// only show errors | ||
ignoreFailures = true | ||
} | ||
|
||
repositories { mavenCentral() } | ||
dependencies { | ||
signature 'org.codehaus.mojo.signature:java18:1.0@signature' | ||
signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature' | ||
|
||
implementation 'org.slf4j:slf4j-api:1.7.25' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package invalid; | ||
|
||
import java.io.File; | ||
|
||
public class Sample { | ||
|
||
public static void main(String[] args) { | ||
// method added in 11 | ||
"".repeat(5); | ||
} | ||
|
||
public void someth() { | ||
// not available in android | ||
File file = new File(""); | ||
file.toPath(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/android-lib/src/main/java/invalid/SampleKotlin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package invalid | ||
|
||
import java.io.File | ||
|
||
class SampleKotlin { | ||
fun someth() { | ||
// not available in android | ||
val file = File("") | ||
file.toPath() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.