Skip to content
Closed
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
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
name: Build
on: [push]

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Buck build
uses: passy/run-buck@v0.1.0
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
commands: '/opt/android-sdk-linux/tools/bin/sdkmanager "build-tools;27.0.3" "platforms;android-26" > /dev/null; buck fetch //...; buck build :soloader'
env:
ANDROID_HOME: ${{ env.ANDROID_SDK_ROOT }}
distribution: zulu
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build and publish artifacts to Maven Local
run: ./gradlew :soloader:assembleDebug publishToMavenLocal -Dmaven.repo.local="$RUNNER_TEMP/soloader-m2"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/.idea
/buck-cache
/buck-out
/.gradle
/**/build
/.buckd
PROJECTc
*~
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ implementation 'com.facebook.soloader:soloader:0.13.0+'
```

## Building from source
To build SoLoader from source you'll need [Buck](https://buckbuild.com/).
Once you have Buck installed execute following commands from the project root
directory:
To build the Android library and its two Java dependencies with Gradle, install
the Android SDK and JDK 17, then run:

```shell
./gradlew :soloader:assembleDebug :annotation:jar :nativeloader:jar
```

The AAR is written to `soloader/build/outputs/aar/`, and the annotation and
nativeloader JARs to their respective `build/libs/` directories.
Run `./gradlew publishToMavenLocal` to publish all three artifacts to your local
Maven repository, using the version from the `artifacts/` configuration files.
The published class files target Java 7, matching earlier SoLoader releases.

The existing [Buck](https://buckbuild.com/) build is also available. Once you have
Buck installed, run the following commands from the project root directory:
```shell
buck fetch //...
buck build :soloader
Expand Down
32 changes: 32 additions & 0 deletions annotation/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id 'java-library'
id 'maven-publish'
}

description = 'DoNotOptimize class'

java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
withSourcesJar()
withJavadocJar()
}

sourceSets {
main {
java {
srcDirs = ['../java']
include 'com/facebook/soloader/DoNotOptimize.java'
include 'com/facebook/soloader/DoNotStripAny.java'
}
}
}

publishing {
publications {
annotation(MavenPublication) {
from components.java
}
}
}
47 changes: 47 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'com.android.library' version '9.2.1' apply false
}

def artifactVersions = ['ANNOTATION', 'NATIVELOADER', 'SOLOADER'].collect { artifact ->
def matcher = file("artifacts/${artifact}").text =~ /(?m)^VERSION\s*=\s*['"]([^'"]+)['"]/
if (!matcher.find()) {
throw new GradleException("Missing version in artifacts/${artifact}")
}
matcher.group(1)
}
if (artifactVersions.toSet().size() != 1) {
throw new GradleException("SoLoader artifact versions must match: ${artifactVersions}")
}

subprojects {
group = 'com.facebook.soloader'
version = artifactVersions[0]
def publishingProject = project

pluginManager.withPlugin('maven-publish') {
publishing.publications.withType(MavenPublication).configureEach {
pom {
name = 'SoLoader'
description = publishingProject.description
url = 'https://github.com/facebook/soloader'
licenses {
license {
name = 'Apache-2'
url = 'https://github.com/facebook/soloader/blob/main/LICENSE'
}
}
developers {
developer {
id = 'facebook'
name = 'Facebook'
}
}
scm {
url = 'https://github.com/facebook/soloader.git'
connection = 'scm:git:https://github.com/facebook/soloader.git'
developerConnection = 'scm:git:git@github.com:facebook/soloader.git'
}
}
}
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SoLoader has Java sources only; disable AGP's built-in Kotlin support so its
# published POM does not acquire an unnecessary Kotlin standard-library dependency.
android.builtInKotlin=false
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading