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
10 changes: 7 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ jobs:
git submodule sync --recursive
git submodule update --init --recursive
- run: ./gradlew androidDependencies
- run: ./gradlew clean assembleRelease
- run: ./gradlew clean
- run: ./gradlew PdCore:pd-core:build
env:
JVM_OPTS: -Xmx3200m
- run: ./gradlew assembleRelease
env:
JVM_OPTS: -Xmx3200m
- uses: actions/upload-artifact@v4
with:
name: pd-core-aar
path: PdCore/build/outputs/aar
path: PdCore/pd-core/build/outputs/aar
- if: github.event_name == 'push'
run: ./gradlew publishToSonatype
run: ./gradlew :PdCore:pd-core:publishToSonatype
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "PdCore/src/main/jni/libpd"]
path = PdCore/src/main/jni/libpd
path = PdCore/pd-core/src/main/jni/libpd
url = https://github.com/libpd/libpd.git
7 changes: 3 additions & 4 deletions CircleOfFifths/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apply plugin: 'com.android.application'

dependencies {
implementation project(':PdCore')
implementation 'io.github.libpd.android:pd-core:' + rootProject.pdCoreVersion
}

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
ndkVersion rootProject.ndkVersion
compileSdkVersion = rootProject.compileSdkVersion
ndkVersion = rootProject.ndkVersion
namespace = 'org.puredata.android.fifths'

defaultConfig {
Expand Down
220 changes: 31 additions & 189 deletions PdCore/build.gradle
Original file line number Diff line number Diff line change
@@ -1,203 +1,45 @@
plugins {
id 'com.android.library'
id 'signing'
id 'maven-publish'
}

group = rootProject.group
archivesBaseName = 'pd-core'
version = rootProject.version

dependencies {
api 'com.noisepages.nettoyeur:midi:1.0.0-rc1'
implementation 'com.noisepages.nettoyeur:midi:1.0.0-rc1'
implementation 'androidx.legacy:legacy-support-v4:' + rootProject.androidxLegacySupportVersion
}

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
ndkVersion rootProject.ndkVersion
namespace = 'org.puredata.android.service'

defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion 33
versionCode 1
versionName version
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/jni/libpd/java']
jniLibs.srcDir 'src/main/libs' //set .so files location to libs
jni.srcDirs = [] //disable automatic ndk-build call
res.srcDirs = ['src/main/res']
assets.srcDirs = ['assets']
}

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}

tasks.create(name: 'buildNative', type: Exec, description: 'Compile JNI source via NDK') {
commandLine ndkBuildExecutablePath,
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1'
}

// After ndk-build, copy libexpr.so to libexpr_tilde.so and libfexpr_tilde.so
buildNative.doLast {
def src = 'libexpr.so'
file('src/main/libs').eachDir() { dir ->
println "Cloning $src in $dir"
copy { from(dir) into(dir) include(src) rename(src, 'libexpr_tilde.so') }
copy { from(dir) into(dir) include(src) rename(src, 'libfexpr_tilde.so') }
}
}

tasks.create(name: 'cleanNative', type: Exec, description: 'Clean JNI object files') {
commandLine ndkBuildExecutablePath, '-C', file('src/main/jni').absolutePath, 'clean'
}

clean.configure {
dependsOn tasks.named('cleanNative')
}

tasks.withType(JavaCompile).configureEach {
dependsOn tasks.named('buildNative')
buildscript {
repositories {
google()
mavenCentral()
}

libraryVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "${archivesBaseName}.aar"
}
dependencies {
classpath 'com.android.tools.build:gradle:8.11.0'
}
}

import org.apache.tools.ant.taskdefs.condition.Os

// TODO: Move to convention plugin?
def getNdkBuildExecutablePath() {
// android.ndkDirectory should return project.android.ndkVersion ndkDirectory
def ndkDir = android.ndkDirectory.absolutePath
def ndkBuildName = Os.isFamily(Os.FAMILY_WINDOWS) ? 'ndk-build.cmd' : 'ndk-build'
def ndkBuildFullPath = new File(ndkDir, ndkBuildName).getAbsolutePath()
if (!new File(ndkBuildFullPath).canExecute()) {
throw new GradleScriptException("ndk-build executable not found: $ndkBuildFullPath")
}
return ndkBuildFullPath
}

task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError = false // TODO: fix javadoc issues
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
plugins {
// must be applied to root project
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
}

def siteUrl = 'https://github.com/libpd/pd-for-android'

publishing {
publications {
maven(MavenPublication) {
groupId group
artifactId archivesBaseName
version version
// TODO: include aar artifact from components?
artifact "${buildDir}/outputs/aar/${archivesBaseName}.aar"
// ossrh requires javadoc and sources
artifact sourcesJar
artifact javadocJar

pom {
name = "${project.group}:${project.archivesBaseName}"
description = 'Pure Data for Android'
url = siteUrl
licenses {
license {
name = 'BSD New'
url = 'https://raw.githubusercontent.com/libpd/pd-for-android/master/PdCore/LICENSE.txt'
}
}
developers {
developer {
id = 'joebowbeer'
name = 'Joe Bowbeer'
}
// TODO: Add all other devs here...
}
scm {
connection = 'scm:git:https://github.com/libpd/pd-for-android'
developerConnection = 'scm:git:ssh://github.com/libpd/pd-for-android.git'
url = siteUrl
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}

// configure publishing to a local directory for testing (not necessary)
// ./gradlew publishMavenPublicationToLocalRepository
// tree ./PdCore/build/repos
publishing {
// These are specific to PdCore, but nexusPublishing needs them here:
// https://github.com/gradle-nexus/publish-plugin/issues/84
group = 'io.github.libpd.android'
version = '1.3.0'

// Create a Sonatype user token for these environment variables:
// export ORG_GRADLE_PROJECT_sonatypeUsername="<tokenUsername>"
// export ORG_GRADLE_PROJECT_sonatypePassword="<tokenPassword>"
nexusPublishing {
repositories {
maven {
name = 'local'
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
sonatype {
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
}
}
}

// ossrh requires signed releases, but not snapshots.
// This configures signing if a key is found.
// The following environment variables provide a signing key and passphrase:
// export ORG_GRADLE_PROJECT_signingKey=`cat private.pgp`
// export ORG_GRADLE_PROJECT_signingPassword="<passphrase>"
// After making the above available, you can try signing using
// ./gradlew signMavenPublication
def hasSigningKey = project.hasProperty('signingKeyId') || project.hasProperty('signingKey')
if (hasSigningKey) {
sign(project)
}
void sign(Project project) {
project.signing {
required { project.gradle.taskGraph.hasTask('required') }
def signingKeyId = project.findProperty('signingKeyId')
def signingKey = project.findProperty('signingKey')
def signingPassword = project.findProperty('signingPassword')
if (signingKeyId) {
// use in-memory ascii-armored OpenPGP subkey
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
} else if (signingKey) {
// use in-memory ascii-armored key
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.maven
}
ext {
minSdkVersion = 28
compileSdkVersion = 34
androidxLegacySupportVersion = '1.0.0'
ndkVersion = "28.2.13676358" // https://developer.android.com/ndk/downloads#lts-downloads
}
1 change: 1 addition & 0 deletions PdCore/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.useAndroidX=true
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.puredata.android.service" >
<uses-permission android:name="android.permission.RECORD_AUDIO" />
</manifest>
File renamed without changes.
Loading