Skip to content
Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/android_x86.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Android CI x86

on: [push]
on: [pull_request]

jobs:
build:
Expand All @@ -20,9 +20,10 @@ jobs:
run: wget https://dl.google.com/android/repository/android-ndk-r17c-darwin-x86_64.zip;
unzip android-ndk-r17c-darwin-x86_64.zip
- name: Install Swift Android Toolchain
run: SWIFT_ANDROID=$(curl -fsSL https://api.bintray.com/packages/readdle/swift-android-toolchain/swift-android-toolchain/versions/_latest | python -c 'import json,sys;print(json.load(sys.stdin))["name"]');
wget https://dl.bintray.com/readdle/swift-android-toolchain/swift-android-$SWIFT_ANDROID.zip;
run: SWIFT_ANDROID=$(curl --silent "https://api.github.com/repos/readdle/swift-android-toolchain/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
wget https://github.com/readdle/swift-android-toolchain/releases/latest/download/swift-android-$SWIFT_ANDROID.zip;
unzip swift-android-$SWIFT_ANDROID.zip;
rm -rf swift-android-$SWIFT_ANDROID.zip;
swift-android-$SWIFT_ANDROID/bin/swift-android tools --update;
ln -sfn swift-android-$SWIFT_ANDROID swift-android-current
- name: Download Android Emulator
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/android_x86_64.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Android CI x86_64

on: [push]
on: [pull_request]

jobs:
build:
Expand All @@ -20,9 +20,10 @@ jobs:
run: wget https://dl.google.com/android/repository/android-ndk-r17c-darwin-x86_64.zip;
unzip android-ndk-r17c-darwin-x86_64.zip
- name: Install Swift Android Toolchain
run: SWIFT_ANDROID=$(curl -fsSL https://api.bintray.com/packages/readdle/swift-android-toolchain/swift-android-toolchain/versions/_latest | python -c 'import json,sys;print(json.load(sys.stdin))["name"]');
wget https://dl.bintray.com/readdle/swift-android-toolchain/swift-android-$SWIFT_ANDROID.zip;
run: SWIFT_ANDROID=$(curl --silent "https://api.github.com/repos/readdle/swift-android-toolchain/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
wget https://github.com/readdle/swift-android-toolchain/releases/latest/download/swift-android-$SWIFT_ANDROID.zip;
unzip swift-android-$SWIFT_ANDROID.zip;
rm -rf swift-android-$SWIFT_ANDROID.zip;
swift-android-$SWIFT_ANDROID/bin/swift-android tools --update;
ln -sfn swift-android-$SWIFT_ANDROID swift-android-current
- name: Download Android Emulator
Expand Down
61 changes: 0 additions & 61 deletions bintray-publish.gradle

This file was deleted.

26 changes: 17 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.4.31'

repositories {
google()
jcenter()
mavenLocal()
maven { url "https://dl.bintray.com/readdle/maven" }
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "com.readdle.android.swift:gradle:1.3.4"
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "com.readdle.android.swift:gradle:1.3.5"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
}
}

Expand All @@ -23,11 +24,18 @@ subprojects { project ->

repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/readdle/maven" }
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply from: "${rootDir}/publish-root.gradle"

ext {
PUBLISH_GROUP_ID = 'com.readdle.swift.java.codegen'
PUBLISH_VERSION = "0.9.2"
}
21 changes: 17 additions & 4 deletions compiler/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'

archivesBaseName = "compiler"

dependencies {
implementation project(':library')
implementation 'com.google.code.gson:gson:2.8.6'
api project(':library')
api 'com.google.code.gson:gson:2.8.6'
}

apply from: rootProject.file('bintray-publish.gradle')
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

withSourcesJar()
withJavadocJar()
}

ext {
PUBLISH_ARTIFACT_ID = 'compiler'
}

apply from: "${rootProject.projectDir}/publish-module.gradle"
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-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
17 changes: 15 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'

archivesBaseName = "annotations"

apply from: rootProject.file('bintray-publish.gradle')
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

withSourcesJar()
withJavadocJar()
}

ext {
PUBLISH_ARTIFACT_ID = 'annotations'
}

apply from: "${rootProject.projectDir}/publish-module.gradle"
51 changes: 51 additions & 0 deletions publish-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.java

groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

pom {
name = PUBLISH_ARTIFACT_ID
description = 'Swift Java codegen'
url = 'https://github.com/readdle/swift-java-codegen'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/readdle/swift-java-codegen/blob/master/LICENSE'
}
}
developers {
developer {
id = 'andriydruk'
name = 'Andrew Druk'
email = 'adruk@readdle.com'
}
}
scm {
connection = 'scm:git:github.com/readdle/swift-java-codegen.git'
developerConnection = 'scm:git:ssh://github.com/readdle/swift-java-codegen.git'
url = 'https://github.com/readdle/swift-java-codegen'
}
}
}
}
}
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

signing {
sign publishing.publications
}
36 changes: 36 additions & 0 deletions publish-root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Create variables with empty default values
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
}

// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
29 changes: 1 addition & 28 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
apply plugin: 'com.readdle.android.swift'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

swift {
Expand Down Expand Up @@ -42,48 +41,22 @@ android {
jniDebuggable false
minifyEnabled false
shrinkResources false
ndk {
abiFilters = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]
}
}
debug {
debuggable true
jniDebuggable true
minifyEnabled false
shrinkResources false
ndk {
abiFilters = ["x86", "x86_64"]
}
}
}

// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += '-Xuse-experimental=kotlin.ExperimentalUnsignedTypes'
}
}

dependencies {
kapt project(':compiler')
implementation project(':library')

implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/swift/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/readdle/java_swift.git", .upToNextMinor(from: "2.1.8")),
.package(url: "https://github.com/readdle/swift-java.git", .upToNextMinor(from: "0.2.2")),
.package(url: "https://github.com/readdle/swift-java-coder.git", .branch("dev/32-bit-support")),
.package(url: "https://github.com/readdle/swift-java-coder.git", .branch("dev/kotlin-support")),
.package(url: "https://github.com/readdle/swift-anycodable.git", .upToNextMinor(from: "1.0.3")),
],
targets: addGenerated([
Expand Down