Skip to content

Commit

Permalink
System: migrate to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
andriydruk committed May 18, 2021
1 parent 4e8c0f4 commit 87a0fe1
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 77 deletions.
61 changes: 0 additions & 61 deletions bintray-publish.gradle

This file was deleted.

24 changes: 16 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ buildscript {

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:3.6.0"
classpath "com.readdle.android.swift:gradle:1.3.2"
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.8.3"
}
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.5'
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-5.6.4-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 = '[email protected]'
}
}
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/"))
}
}
}
10 changes: 9 additions & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ swift {
useKapt true
cleanEnabled true
debug {
abiFilters("arm64-v8a")
extraBuildFlags("-Xswiftc", "-DDEBUG")
}
}
Expand Down Expand Up @@ -41,8 +40,17 @@ android {
buildTypes {
release {
minifyEnabled false
debuggable false
jniDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
jniDebuggable true
ndk {
abiFilters = ["arm64-v8a", "x86_64"]
}
}
}
}

Expand Down

0 comments on commit 87a0fe1

Please sign in to comment.