Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing job #56

Merged
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
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
17 changes: 11 additions & 6 deletions jsbridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ android {
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

buildTypes {
release {
minifyEnabled false
}
}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
Expand Down Expand Up @@ -98,6 +92,17 @@ android {
}
}
}

publishing {
singleVariant("quickjsRelease") {
withSourcesJar()
withJavadocJar()
}
singleVariant("duktapeRelease") {
withSourcesJar()
withJavadocJar()
}
}
}

// Temporary workaround for mockk (see https://github.com/mockk/mockk/issues/281)
Expand Down
80 changes: 11 additions & 69 deletions scripts/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,18 @@ import java.util.regex.Pattern

apply plugin: 'maven-publish'

publishing {
publications {
android.libraryVariants.all { variant ->
if (!variant.name.contains("Release")) return

println("Publishing config ${variant.name} for project ${project.name}...")


def suffix = variant.name.replace("Release", "")
def variantArtifactId = "oasis-${project.name}-${suffix}"
def publicationName = "${project.name}${variant.name.capitalize()}Publication"

"$publicationName"(MavenPublication) {
artifactId variantArtifactId

// AAR
artifact(variant.outputs[0].packageLibrary)

// README.md
if (file("$projectDir/README.md").exists()) {
artifact("$projectDir/README.md") {
classifier "README"
}
}

// JavaDoc
if (file("$buildDir/outputs/javadoc/${artifactId}-javadoc.jar").exists()) {
artifact("$buildDir/outputs/javadoc/${artifactId}-javadoc.jar") {
classifier "javadoc"
}
}

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')

//Iterate over "api" and "implementation" dependencies (we don't want the test ones), adding a <dependency> node for each
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
configurations.api.allDependencies.findAll {
it.name != 'unspecified'
}.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
configurations.implementation.allDependencies.findAll {
it.name != 'unspecified'
}.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
afterEvaluate {
publishing {
publications {
quickjsRelease(MavenPublication) {
from components.named("quickjsRelease").get()
groupId = group
artifactId = "oasis-jsbridge-quickjs"
}
}
}

repositories {
maven {
String s3_bucket = System.getenv()['S3_BUCKET']
String s3_path = System.getenv()['S3_PATH']
String s3_access_key = System.getenv()['S3_ACCESS_KEY']
String s3_secret_key = System.getenv()['S3_SECRET_KEY']

url "s3://$s3_bucket/$s3_path"

credentials(AwsCredentials) {
accessKey s3_access_key
secretKey s3_secret_key
duktapeRelease(MavenPublication) {
from components.named("duktapeRelease").get()
groupId = group
artifactId = "oasis-jsbridge-duktape"
}
}
}
Expand Down
Loading