-
Notifications
You must be signed in to change notification settings - Fork 0
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 #86 from compscidr/jason/lib-repackage
Repackage into a library
- Loading branch information
Showing
55 changed files
with
914 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- '*' # Push events to every tag not containing / | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event." | ||
- run: echo "This job is running on a ${{ runner.os }} server hosted by GitHub!" | ||
- uses: actions/checkout@v4 | ||
- run: echo "The ${{ github.repository }} repository has been cloned." | ||
- run: echo "Setting up JDK" | ||
- name: set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: gradle | ||
- run: echo "Setting up cmake" | ||
- run: sudo apt install build-essential cmake | ||
- run: echo "The workflow is now ready to test your code." | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- run: echo "Building Debug APK." | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- run: echo "Build status report=${{ job.status }}." | ||
- name: Deploy to Sonatype / Maven Central | ||
run: ./gradlew -PcentralPortalToken=${{ secrets.CENTRAL_PORTAL_TOKEN }} -PcentralPortalPassword=${{ secrets.CENTRAL_PORTAL_PASSWORD }} -PsigningKeyId=${{ secrets.SIGNING_KEY_ID }} -PsigningKeyPassword=${{ secrets.SIGNING_KEY_PASSWORD }} -PsigningKey=${{ secrets.SIGNING_KEY }} deployAll |
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.org.jetbrains.kotlin.android) apply false | ||
alias(libs.plugins.android.library) apply false | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
/build |
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,122 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.org.jetbrains.kotlin.android) | ||
alias(libs.plugins.git.version) // https://stackoverflow.com/a/71212144 | ||
alias(libs.plugins.sonatype.maven.central) | ||
alias(libs.plugins.gradleup.nmcp) | ||
id("signing") // https://medium.com/nerd-for-tech/oh-no-another-publishing-android-artifacts-to-maven-central-guide-9d7f300ebd74 | ||
} | ||
|
||
android { | ||
namespace = "com.jasonernst.icmp_lib" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 24 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
externalNativeBuild { | ||
cmake { | ||
path(file("src/main/cpp/CMakeLists.txt")) | ||
version = "3.22.1" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.material) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.junit) | ||
androidTestImplementation(libs.androidx.espresso.core) | ||
} | ||
|
||
version = "0.0.0-SNAPSHOT" | ||
gitVersioning.apply { | ||
refs { | ||
branch(".+") { version = "\${ref}-SNAPSHOT" } | ||
tag("v(?<version>.*)") { version = "\${ref.version}" } | ||
} | ||
} | ||
|
||
nmcp { | ||
val props = project.properties | ||
publishAllPublications { | ||
username = props["centralPortalToken"] as String? ?: "" | ||
password = props["centralPortalPassword"] as String? ?: "" | ||
// or if you want to publish automatically | ||
publicationType = "AUTOMATIC" | ||
} | ||
} | ||
|
||
mavenPublishing { | ||
coordinates("com.jasonernst.icmp_lib", "icmp_lib", version.toString()) | ||
pom { | ||
name = "ICMP Android" | ||
description = "A library for sending and receiving ICMP packets on Android" | ||
inceptionYear = "2024" | ||
url = "https://github.com/compscidr/icmp-android" | ||
licenses { | ||
license { | ||
name = "GPL-3.0" | ||
url = "https://www.gnu.org/licenses/gpl-3.0.en.html" | ||
distribution = "repo" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = "compscidr" | ||
name = "Jason Ernst" | ||
url = "https://www.jasonernst.com" | ||
} | ||
} | ||
scm { | ||
url = "https://github.com/compscidr/icmp-android" | ||
connection = "scm:git:git://github.com/compscidr/icmp-android.git" | ||
developerConnection = "scm:git:ssh://[email protected]/compscidr/icmp-android.git" | ||
} | ||
} | ||
} | ||
|
||
// https://opensource.deepmedia.io/deployer | ||
// https://blog.deepmedia.io/post/how-to-publish-to-maven-central-in-2024 | ||
//deployer { | ||
// projectInfo { | ||
// description = "A library for sending and receiving ICMP packets on Android" | ||
// url = "https://github.com/compscidr/icmp-android/" | ||
// groupId = "com.jasonernst" | ||
// artifactId = "icmp-android" | ||
// license("GPL-3.0", "https://www.gnu.org/licenses/gpl-3.0.en.html") | ||
// developer("compscidr", "[email protected]", "Jason Ernst", "https://www.jasonernst.com") | ||
// } | ||
// | ||
// centralPortalSpec { | ||
// // Take these credentials from the Generate User Token page at https://central.sonatype.com/account | ||
// auth.user.set(secret("centralPortalToken")) | ||
// auth.password.set(secret("centralPortalPassword")) | ||
// | ||
// // Signing is required | ||
// signing.key.set(secret("signingKey")) | ||
// signing.password.set(secret("signingKeyPassword")) | ||
// } | ||
//} |
Empty file.
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 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
icmp-lib/src/androidTest/java/com/jasonernst/icmp_lib/ExampleInstrumentedTest.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,24 @@ | ||
package com.jasonernst.icmp_lib | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.jasonernst.icmp_lib.test", appContext.packageName) | ||
} | ||
} |
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
icmp-lib/src/test/java/com/jasonernst/icmp_lib/ExampleUnitTest.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,17 @@ | ||
package com.jasonernst.icmp_lib | ||
|
||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Example local unit test, which will execute on the development machine (host). | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) | ||
} | ||
} |
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