8000 Work for publishing signed artifacts to local Maven repo, and Nexus r… · ETS-Android4/sqlcipher-android@655c1e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 655c1e5

Browse files
Work for publishing signed artifacts to local Maven repo, and Nexus repository
1 parent 0abc8f3 commit 655c1e5

File tree

3 files changed

+153
-8
lines changed

3 files changed

+153
-8
lines changed

Makefile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.PHONY: clean build-debug build-release \
2+
publish-snapshot-to-local-maven \
3+
publish-snapshot-to-local-nexus
4+
GRADLE = ./gradlew
5+
6+
clean:
7+
$(GRADLE) clean
8+
9+
build-debug:
10+
$(GRADLE) assembleDebug
11+
12+
build-release:
13+
$(GRADLE) assembleRelease
14+
15+
publish-snapshot-to-local-maven:
16+
@ $(collect-signing-info) \
17+
$(GRADLE) \
18+
-PpublishSnapshot=true \
19+
-Psigning.keyId="$$gpgKeyId" \
20+
-Psigning.secretKeyRingFile="$$gpgKeyRingFile" \
21+
-Psigning.password="$$gpgPassword" \
22+
publishReleasePublicationToMavenLocal
23+
24+
publish-snapshot-to-local-nexus:
25+
@ $(collect-signing-info) \
26+
$(collect-nexus-info) \
27+
$(GRADLE) \
28+
-PpublishSnapshot=true \
29+
-Psigning.keyId="$$gpgKeyId" \
30+
-Psigning.secretKeyRingFile="$$gpgKeyRingFile" \
31+
-Psigning.password="$$gpgPassword" \
32+
-PnexusUsername="$$nexusUsername" \
33+
-PnexusPassword="$$nexusPassword" \
34+
-PnexusStagingProfileId="$$nexusStagingProfileId" \
35+
publishAllPublicationsToLocalNexusRepository
36+
37+
collect-signing-info := \
38+
read -p "Enter GPG signing key id:" gpgKeyId; \
39+
read -p "Enter full path to GPG keyring file \
40+
(possibly ${HOME}/.gnupg/secring.gpg)" gpgKeyRingFile; stty -echo; \
41+
read -p "Enter GPG password:" gpgPassword; stty echo;
42+
43+
collect-nexus-info := \
44+
read -p "Enter Nexus username:" nexusUsername; stty -echo; \
45+
read -p "Enter Nexus password:" nexusPassword; stty echo; \
46+
read -p "Enter Nexus staging profile id:" nexusStagingProfileId;

build.gradle

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,70 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
32
buildscript {
43
repositories {
54
jcenter()
65
google()
76
}
87
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.0'
10-
11-
// NOTE: Do not place your application dependencies here; they belong
12-
// in the individual module build.gradle files
8+
classpath 'com.android.tools.build:gradle:4.0.2'
139
}
1410
}
1511

12+
plugins {
13+
id('maven-publish')
14+
id('signing')
15+
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
16+
}
17+
1618
allprojects {
1719
repositories {
1820
jcenter()
1921
google()
2022
}
2123
}
2224

23-
task clean(type: Delete) {
24-
delete rootProject.buildDir
25+
project.ext {
26+
libraryVersion = "4.4.3"
27+
mavenLocalRepositoryPrefix = "file://"
28+
if(project.hasProperty('publishLocal') && publishLocal.toBoolean()){
29+
mavenSnapshotRepositoryUrl = "outputs/snapshot"
30+
mavenReleaseRepositoryUrl = "outputs/release"
31+
} else {
32+
mavenLocalRepositoryPrefix = ""
33+
mavenSnapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots"
34+
mavenReleaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
35+
}
36+
if(project.hasProperty('publishSnapshot') && publishSnapshot.toBoolean()){
37+
mavenVersionName = "${libraryVersion}-SNAPSHOT"
38+
} else {
39+
mavenVersionName = "${libraryVersion}"
40+
}
41+
if(project.hasProperty('nexusUsername')){
42+
nexusUsername = "${nexusUsername}"
43+
}
44+
if(project.hasProperty('nexusPassword')){
45+
nexusPassword = "${nexusPassword}"
46+
}
47+
nexusUsername = "${nexusUsername}"
48+
nexusPassword = "${nexusPassword}"
49+
nexusStagingProfileId = "${nexusStagingProfileId}"
50+
}
51+
52+
nexusPublishing {
53+
repositories {
54+
sonatype {
55+
nexusUrl = uri("https://oss.sonatype.org/")
56+
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
57+
username = "${rootProject.ext.nexusUsername}"
58+
password = "${rootProject.ext.nexusPassword}"
59+
stagingProfileId = "${rootProject.ext.nexusStagingProfileId}"
60+
}
61+
localNexus {
62+
useStaging = false
63+
nexusUrl = uri("http://localhost:8081/")
64+
snapshotRepositoryUrl = uri("http://localhost:8081/repository/maven-snapshots/")
65+
username = "${rootProject.ext.nexusUsername}"
66+
password = "${rootProject.ext.nexusPassword}"
67+
stagingProfileId = ""
68+
}
69+
}
2570
}

sqlcipher/build.gradle

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
apply plugin: 'com.android.library'
2+
////apply from: 'maven.gradle'
3+
//apply plugin: 'maven-publish'
4+
//apply plugin: 'signing'
25

36
android {
47
compileSdkVersion 30
@@ -7,7 +10,7 @@ android {
710
minSdkVersion 16
811
targetSdkVersion 30
912
versionCode 1
10-
versionName "4.4.3"
13+
versionName rootProject.ext.libraryVersion
1114
project.archivesBaseName = "sqlcipher-android-${versionName}"
1215
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1316
}
@@ -73,3 +76,54 @@ allprojects {
7376
jcenter()
7477
}
7578
}
79+
80+
afterEvaluate {
81+
publishing {
82+
publications {
83+
release(MavenPublication) {
84+
groupId = "net.zetetic"
85+
artifactId = "sqlcipher-android"
86+
version = "${rootProject.ext.mavenVersionName}"
87+
from components.release
88+
artifact androidSourcesJar
89+
pom {
90+
name = "sqlcipher-android"
91+
packaging = "aar"
92+
description = "SQLCipher for Android a library that provides full database encryption."
93+
url = "https://www.zetetic.net/sqlcipher"
94+
scm {
95+
url = "https://github.com/sqlcipher/sqlcipher-android.git"
96+
connection = "scm:git:https://github.com/sqlcipher/sqlcipher-android.git"
97+
developerConnection = "scm:git:https://github.com/sqlcipher/sqlcipher-android.git"
98+
}
99+
licenses {
100+
license {
101+
url = "https://www.zetetic.net/sqlcipher/license/"
102+
}
103+
}
104+
developers {
105+
developer {
106+
name = "Zetetic Support"
107+
email = "support@zetetic.net"
108+
organization = "Zetetic LLC"
109+
organizationUrl = "https://www.zetetic.net"
110+
}
111+
}
112+
}
113+
}
114+
}
115+
}
116+
117+
signing {
118+
sign publishing.publications
119+
}
120+
}
121+
122+
task androidSourcesJar(type: Jar) {
123+
archiveClassifier.set('sources')
124+
from android.sourceSets.main.java.srcDirs
125+
}
126+
127+
artifacts {
128+
archives androidSourcesJar
129+
}

0 commit comments

Comments
 (0)
0