Skip to content

Commit

Permalink
Multiplatform publish (#22)
Browse files Browse the repository at this point in the history
* Multiplatform publishing

* Update demo app

* Release v0.5.1

* New publishing model

* Release 0.5.1, fix publish bugs

* Fix deploy secrets

* -xmx tweak
  • Loading branch information
natario1 authored Jun 6, 2020
1 parent 9100ee8 commit 579049f
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
with:
java-version: 1.8
- name: Perform base checks
run: ./gradlew demo:assembleDebug library:dokka
run: ./gradlew demo:assembleDebug library:publishAllDirectory
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ jobs:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }}
BINTRAY_REPO_LEGACY: ${{ secrets.BINTRAY_REPO_LEGACY }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Perform bintray upload
run: ./gradlew bintrayUpload
run: ./gradlew library:publishAllBintray
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,37 @@
# Egloo

Egloo is a simple and lightweight multiplatform framework for OpenGL ES drawing and EGL management
that uses object-oriented components - hence the name Egl**oo**. It can serve as a basis for
that uses object-oriented components - hence the name Egl**oo**. It can serve as a basis for
complex drawing operations, but is mostly designed for helping in making common tasks simpler,
even for people that do not have any OpenGL experience.

Approaching OpenGL from Android can be hard because of the deep differences in the OpenGL API design
Approaching OpenGL from high-level languages can be hard because of the deep differences in the OpenGL API design
with respect to a typical object-oriented context. Egloo tries to take some of these difficulties away
by creating a **thin**, flexible layer of abstraction around EGL and GLES calls.

You can take a look at the demo app or see Egloo in action in more popular projects:
You can take a look at the demo app or see Egloo in action in some popular Android projects:

- for camera preview and real-time filters: see [CameraView](https://github.com/natario1/CameraView)
- in a zoomable Surface: see [ZoomLayout](https://github.com/natario1/ZoomLayout)
- for transcoding videos: see [Transcoder](https://github.com/natario1/Transcoder)

```groovy
implementation 'com.otaliastudios.opengl:egloo:0.5.0'
```

Starting from 0.5.0, Egloo can run on native targets. We provide an implementation for Android native libraries,
but other targets like iOS can probably be added easily. These artifacts are not currently published
but can be built using `./gradlew :library:publishLocal` .
but other targets like iOS can probably be added easily.

```kotlin
// Regular Android projects
implementation("com.otaliastudios.opengl:egloo-android:0.5.1")

// Kotlin Multiplatform projects: add egloo-multiplatform to your common source set.
implementation("com.otaliastudios.opengl:egloo-multiplatform:0.5.1")

// Kotlin Multiplatform projects: or use the granular dependencies:
implementation("com.otaliastudios.opengl:egloo-android:0.5.1") // Android AAR
implementation("com.otaliastudios.opengl:egloo-androidnativex86:0.5.1") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativex64:0.5.1") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativearm32:0.5.1") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativearm64:0.5.1") // Android Native KLib
```

## Features

Expand All @@ -49,6 +59,7 @@ but can be built using `./gradlew :library:publishLocal` .
- Programs abstraction [[docs]](https://natario1.github.io/docs/programs)
- Scenes to hold view and projection matrix [[docs]](https://natario1.github.io/docs/scenes)


&#10240; <!-- Hack to add whitespace -->

<p align="center">
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
val kotlinVersion = property("kotlinVersion") as String
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.android.tools.build:gradle:3.6.3")
classpath("com.otaliastudios.tools:publisher:0.2.0")
classpath("com.otaliastudios.tools:publisher:0.3.3-rc2")
}
}

Expand All @@ -23,6 +23,7 @@ allprojects {
google()
mavenCentral()
jcenter()
maven("https://dl.bintray.com/natario/multiplatform")
}
}

Expand Down
4 changes: 4 additions & 0 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ dependencies {
implementation("com.google.android.exoplayer:exoplayer-core:2.10.4")
implementation("com.google.android.exoplayer:exoplayer-ui:2.10.4")
implementation(project(":library"))

// For testing, instead of the project dependency:
// implementation("com.otaliastudios.opengl:egloo:0.5.1-rc1")
// implementation("com.otaliastudios.opengl:egloo-android:0.5.1-rc1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class VideoActivity : AppCompatActivity(), GLSurfaceView.Renderer {
val dataSourceFactory = DefaultDataSourceFactory(this,
Util.getUserAgent(this, "Egloo"))
val videoSource = ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"))
// .createMediaSource(Uri.parse("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"))
.createMediaSource(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"))
player.prepare(videoSource)
player.playWhenReady = true

Expand Down
25 changes: 24 additions & 1 deletion docs/_about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,33 @@ New versions are released through GitHub, so the reference page is the [GitHub R
Starting from v0.3.1, you can [support development](https://github.com/sponsors/natario1) through the GitHub Sponsors program.
Companies can share a tiny part of their revenue and get private support hours in return. Thanks!

### v0.5.1

Native targets are now published to JCenter and can be added as dependencies from Kotlin Multiplatform
projects ([#22][22]). You can add the granular dependencies:

```kotlin
implementation("com.otaliastudios.opengl:egloo-android:0.5.1") // android
implementation("com.otaliastudios.opengl:egloo-androidnativex86:0.5.1") // android native
implementation("com.otaliastudios.opengl:egloo-androidnativex64:0.5.1") // android native
implementation("com.otaliastudios.opengl:egloo-androidnativearm32:0.5.1") // android native
implementation("com.otaliastudios.opengl:egloo-androidnativearm64:0.5.1") // android native
```

Or simply add the common dependency for your Kotlin Multiplatform common source set:

```kotlin
// This will include the correct artifact into your targets
implementation("com.otaliastudios.opengl:egloo-multiplatform:0.5.1")
```

<https://github.com/natario1/Egloo/compare/v0.5.0...v0.5.1>

### v0.5.0

This release adds support for native targets. We provide an implementation for Android native libraries,
but other targets like iOS can probably be added easily. These artifacts are not currently published
but can be built using `./gradlew :library:publishLocal` . ([#20][20]).
but can be built using `./gradlew :library:publishLocal` ([#20][20]).

Other changes:

Expand All @@ -40,3 +62,4 @@ First versioned release.
[14]: https://github.com/natario1/Egloo/pull/14
[18]: https://github.com/natario1/Egloo/pull/18
[20]: https://github.com/natario1/Egloo/pull/20
[22]: https://github.com/natario1/Egloo/pull/22
31 changes: 23 additions & 8 deletions docs/_about/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ description: "Integrate in your project"
order: 1
---

The library works on API 18+, which is the only requirement and should be met by many projects nowadays.

It is publicly hosted on [JCenter](https://bintray.com/natario/android/Egloo), where you
can download the AAR package. To fetch with Gradle, make sure you add the JCenter repository in your root projects `build.gradle` file:
Egloo is publicly hosted on [JCenter](https://bintray.com/natario/android/Egloo), where you
can download the AAR package and other artifacts. To fetch with Gradle, make sure you add the
JCenter repository in your root projects `build.gradle` file:

```groovy
allprojects {
Expand All @@ -18,10 +17,26 @@ allprojects {
}
```

Then simply download the latest version:
Then simply download the latest version. For regular Android projects users:

```kotlin
implementation("com.otaliastudios.opengl:egloo-android:{{ site.github_version }}")
```

For Kotlin Multiplatform projects:

```kotlin
// Add a single dependency into your common Kotlin Multiplatform sourceset.
// This will include the correct artifact for each target that you want to support.
implementation("com.otaliastudios.opengl:egloo-multiplatform:{{ site.github_version }}")

// Or use granular dependencies:
implementation("com.otaliastudios.opengl:egloo-android:{{ site.github_version }}") // Android AAR
implementation("com.otaliastudios.opengl:egloo-androidnativex86:{{ site.github_version }}") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativex64:{{ site.github_version }}") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativearm32:{{ site.github_version }}") // Android Native KLib
implementation("com.otaliastudios.opengl:egloo-androidnativearm64:{{ site.github_version }}") // Android Native KLib

```groovy
implementation 'com.otaliastudios.opengl:egloo:{{ site.github_version }}'
```

No other configuration steps are needed.
> The Android version works on API 18+, which is the only requirement and should be met by many projects nowadays.
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ google_analytics_id: 'UA-155077779-3'
google_site_verification: '4x49i17ABIrSvUl52SeL0-t0341aTnWWaC62-FYCRT4'
github: [metadata] # TODO What's this?
github_repo: Egloo
github_version: 0.5.0
github_version: 0.5.1
github_branch: master
baseurl: '/Egloo' # Keep as an empty string if served up at the root
collections:
Expand Down
12 changes: 6 additions & 6 deletions docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ that uses object-oriented components - hence the name Egl**oo**. It can serve as
complex drawing operations, but is mostly designed for helping in making common tasks simpler,
even for people that do not have any OpenGL experience.

Approaching OpenGL from Android can be hard because of the deep differences in the OpenGL API design
Approaching OpenGL from high-level languages can be hard because of the deep differences in the OpenGL API design
with respect to a typical object-oriented context. Egloo tries to take some of these difficulties away
by creating a **thin**, flexible layer of abstraction around EGL and GLES calls.

You can take a look at the demo app or see Egloo in action in more popular projects:
You can take a look at the demo app or see Egloo in action in some popular Android projects:

- in a zoomable Surface in the [ZoomLayout](https://github.com/natario1/ZoomLayout) library
- for transcoding videos in the [Transcoder](https://github.com/natario1/Transcoder) library
- for camera preview and real-time filters: see [CameraView](https://github.com/natario1/CameraView)
- in a zoomable Surface: see [ZoomLayout](https://github.com/natario1/ZoomLayout)
- for transcoding videos: see [Transcoder](https://github.com/natario1/Transcoder)

<p align="center">
<img src="static/banner.png" vspace="10" width="100%">
Expand All @@ -32,8 +33,7 @@ You can take a look at the demo app or see Egloo in action in more popular proje
- Scenes to hold view and projection matrix [[docs]](docs/scenes)

> Starting from 0.5.0, Egloo can run on native targets. We provide an implementation for Android native libraries,
but other targets like iOS can probably be added easily. These artifacts are not currently published
but can be built using `./gradlew :library:publishLocal` .
but other targets like iOS can probably be added easily. See [install info](about/install).

### Get started

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4096M

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip
97 changes: 56 additions & 41 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import com.otaliastudios.tools.publisher.PublisherExtension.License
import com.otaliastudios.tools.publisher.PublisherExtension.Release
import com.otaliastudios.tools.publisher.common.License
import com.otaliastudios.tools.publisher.common.Release
import com.otaliastudios.tools.publisher.bintray.BintrayPublication
import com.otaliastudios.tools.publisher.local.LocalPublication
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
id("kotlin-multiplatform")
id("com.android.library")
id("maven-publisher-bintray")

id("com.otaliastudios.tools.publisher")
id("maven-publish")
}

kotlin {
android("androidJvm") {
// This enables the KMP android publication. Changing its artifactId here instead of
// below, because it only works here for some reason. Must be a bug in KMP.
// This enables the KMP android publication.
publishLibraryVariants("release")
mavenPublication { artifactId = "egloo-android" }
}
val nativeConfig: KotlinNativeTarget.() -> Unit = {
val mainSourceSet = compilations["main"].defaultSourceSet.kotlin
Expand Down Expand Up @@ -57,54 +56,70 @@ android {
defaultConfig {
setMinSdkVersion(property("minSdkVersion") as Int)
setTargetSdkVersion(property("targetSdkVersion") as Int)
versionName = "0.5.0"
versionName = "0.5.1"
}
buildTypes["release"].consumerProguardFile("proguard-rules.pro")
sourceSets["main"].java.srcDirs("src/androidJvmMain/kotlin")
sourceSets["main"].manifest.srcFile("src/androidJvmMain/AndroidManifest.xml")
}

publisher {
auth.user = "BINTRAY_USER"
auth.key = "BINTRAY_KEY"
auth.repo = "BINTRAY_REPO"
project.group = "com.otaliastudios.opengl"
project.artifact = "egloo"
project.description = "Simple and lightweight OpenGL ES drawing and EGL management for Android, with object-oriented components based on Google's Grafika."
project.url = "https://github.com/natario1/Egloo"
project.vcsUrl = "https://github.com/natario1/Egloo.git"
project.addLicense(License(name = "MIT", url = "http://www.opensource.org/licenses/mit-license.php"))
release.setSources(Release.SOURCES_AUTO)
release.setDocs(Release.DOCS_AUTO)
}
project.addLicense(License.MIT)
val dir = "../prebuilt"

val LOCAL_REPO = "local"
val LOCAL_REPO_URL = "../prebuilt"
publishing {
repositories {
maven {
name = LOCAL_REPO
setUrl(LOCAL_REPO_URL)
}
// Legacy android release (:egloo)
bintray("legacy") {
auth.user = "BINTRAY_USER"
auth.key = "BINTRAY_KEY"
auth.repo = "BINTRAY_REPO_LEGACY"
component = "release"
project.name = "Egloo"
project.artifact = "egloo"
release.setSources(Release.SOURCES_AUTO)
release.setDocs(Release.DOCS_AUTO)
}
// Fix the artifact id for all publications, or the project name will be used.
// https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#publishing-a-multiplatform-library
// Base name could be "egloo" instead of "egloo-multiplatform", but it can cause maven conflicts because
// "egloo" is live in Bintary and it's an AAR.
publications.withType<MavenPublication>().all {
if (name != publisher.publication) {
artifactId = when (name) {
"kotlinMultiplatform" -> "egloo-multiplatform"
else -> artifactId.replace(project.name, "egloo")
}
}
directory("legacy") {
directory = dir
component = "release"
project.name = "Egloo"
project.artifact = "egloo"
release.setSources(Release.SOURCES_AUTO)
release.setDocs(Release.DOCS_AUTO)
}
}

tasks.register("publishLocal") {
publishing.publications.all {
if (name != publisher.publication) {
dependsOn("publish${name.capitalize()}PublicationTo${LOCAL_REPO.capitalize()}Repository")
// Kotlin creates MavenPublication objects with a specific name.
// Make sure to override the weird artifact name that KMP provides for these.
// Make also sure to not override the packaging, as some are klib, some pom, som aar...
val multiplatformPublications = mapOf(
"androidJvmRelease" to "egloo-android",
"androidNativeArm32" to "egloo-androidnativearm32",
"androidNativeArm64" to "egloo-androidnativearm64",
"androidNativeX86" to "egloo-androidnativex86",
"androidNativeX64" to "egloo-androidnativex64",
"kotlinMultiplatform" to "egloo-multiplatform",
"metadata" to "egloo-metadata"
)
multiplatformPublications.forEach { mavenPublication, artifactId ->
bintray(mavenPublication) {
auth.user = "BINTRAY_USER"
auth.key = "BINTRAY_KEY"
auth.repo = "BINTRAY_REPO"
publication = mavenPublication
project.name = artifactId
project.artifact = artifactId
if (artifactId == "egloo-android") {
release.setDocs(Release.DOCS_AUTO)
}
}
directory(mavenPublication) {
directory = dir
publication = mavenPublication
project.name = artifactId
project.artifact = artifactId
}
}
}
}

0 comments on commit 579049f

Please sign in to comment.