8000 Sign and deploy local or remote maven artifacts · passy/android-database-sqlcipher@ad6df36 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad6df36

Browse files
Sign and deploy local or remote maven artifacts
1 parent 711bfd2 commit ad6df36

File tree

5 files changed

+217
-74
lines changed

5 files changed

+217
-74
lines changed

Makefile

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,64 @@ clean:
88
distclean:
99
$(GRADLE) distclean
1010

11+
build-openssl:
12+
$(GRADLE) buildOpenSSL
13+
1114
build:
1215
$(GRADLE) build
1316

14-
build-openssl:
15-
$(GRADLE) buildOpenSSL
17+
publish-local-snapshot:
18+
@ $(collect-signing-info) \
19+
$(GRADLE) --no-daemon \
20+
-PpublishSnapshot=true \
21+
-PpublishLocal=true \
22+
-PsigningKeyId="$$gpgKeyId" \
23+
-PsigningKeyRingFile="$$gpgKeyRingFile" \
24+
-PsigningKeyPassword="$$gpgPassword" \
25+
uploadArchives
26+
27+
publish-local-release:
28+
@ $(collect-signing-info) \
29+
$(GRADLE) --no-daemon \
30+
-PpublishSnapshot=false \
31+
-PpublishLocal=true \
32+
-PsigningKeyId="$$gpgKeyId" \
33+
-PsigningKeyRingFile="$$gpgKeyRingFile" \
34+
-PsigningKeyPassword="$$gpgPassword" \
35+
uploadArchives
36+
37+
publish-remote-snapshot:
38+
@ $(collect-signing-info) \
39+
$(collect-nexus-info) \
40+
$(GRADLE) --no-daemon \
41+
-PpublishSnapshot=true \
42+
-PpublishLocal=false \
43+
-PsigningKeyId="$$gpgKeyId" \
44+
-PsigningKeyRingFile="$$gpgKeyRingFile" \
45+
-PsigningKeyPassword="$$gpgPassword" \
46+
-PnexusUsername="$$nexusUsername" \
47+
-PnexusPassword="$$nexusPassword" \
48+
uploadArchives
49+
50+
publish-remote-release:
51+
@ $(collect-signing-info) \
52+
$(collect-nexus-info) \
53+
$(GRADLE) --no-daemon \
54+
-PpublishSnapshot=false \
55+
-PpublishLocal=false \
56+
-PsigningKeyId="$$gpgKeyId" \
57+
-PsigningKeyRingFile="$$gpgKeyRingFile" \
58+
-PsigningKeyPassword="$$gpgPassword" \
59+
-PnexusUsername="$$nexusUsername" \
60+
-PnexusPassword="$$nexusPassword" \
61+
uploadArchives
62+
63+
collect-nexus-info := \
64+
read -p "Enter Nexus username:" nexusUsername; \
65+
stty -echo; read -p "Enter Nexus password:" nexusPassword; stty echo;
66+
67+
collect-signing-info := \
68+
read -p "Enter GPG signing key id:" gpgKeyId; \
69+
read -p "Enter full path to GPG keyring file \
70+
(possibly ${HOME}/.gnupg/secring.gpg)" gpgKeyRingFile; \
71+
stty -echo; read -p "Enter GPG password:" gpgPassword; stty echo;
Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: "com.android.library"
2-
apply plugin: "maven-publish"
32
apply from: "native.gradle"
3+
apply from: "maven.gradle"
44

55
android {
66

@@ -44,55 +44,3 @@ android {
4444
}
4545

4646
}
47-
48-
publishing {
49-
publications {
50-
sqlcipher(MavenPublication) {
51-
groupId "net.zetetic"
52-
artifactId "android-database-sqlcipher"
53-
version "${clientVersionNumber}"
54-
artifact("$buildDir/outputs/aar/${archivesBaseName}-${clientVersionNumber}.aar")
55-
pom.withXml {
56-
asNode().children().last() + {
57-
resolveStrategy = Closure.DELEGATE_FIRST
58-
name "android-database-sqlcipher"
59-
description "SQLCipher for Android is a plugin to SQLite that provides full database encryption."
60-
url "https://www.zetetic.net/sqlcipher"
61-
scm {
62-
url "https://github.com/sqlcipher/android-database-sqlcipher.git"
63-
connection "scm:git:https://github.com/sqlcipher/android-database-sqlcipher.git"
64-
developerConnection "scm:git:https://github.com/sqlcipher/android-database-sqlcipher.git"
65-
}
66-
licenses {
67-
license {
68-
url "https://www.zetetic.net/sqlcipher/license/"
69-
}
70-
}
71-
developers {
72-
developer {
73-
name "Zetetic Support"
74-
email "support@zetetic.net"
75-
organization "Zetetic LLC"
76-
organizationUrl "https://www.zetetic.net/"
77-
}
78-
}
79-
distributionManagement {
80-
snapshotRepository {
81-
id "ossrh"
82-
url "https://oss.sonatype.org/content/repositories/snapshots"
83-
}
84-
repository {
85-
id "ossrh"
86-
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
87-
}
88-
}
89-
}
90-
}
91-
}
92-
}
93-
repositories {
94-
maven {
95-
url "$buildDir/repo"
96-
}
97-
}
98-
}
Lines changed: 104 additions & 0 deletions
< 10BBC td data-grid-cell-id="diff-8a9afd1d569786a816d7f8e08789a739541be6fed2506fa96595ac07c4830e38-empty-55-2" data-line-anchor="diff-8a9afd1d569786a816d7f8e08789a739541be6fed2506fa96595ac07c4830e38R55" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionLine-bgColor, var(--diffBlob-addition-bgColor-line));padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
apply plugin: "maven"
2+
apply plugin: "signing"
3+
import org.gradle.plugins.signing.Sign
4+
5+
def isReleaseBuild() {
6+
return mavenVersionName.contains("SNAPSHOT") == false
7+
}
8+
9+
def getReleaseRepositoryUrl() {
10+
if(hasProperty('mavenLocalRepositoryPrefix')) {
11+
return "${mavenLocalRepositoryPrefix}${buildDir}/${mavenReleaseRepositoryUrl}"
12+
} else {
13+
return hasProperty('mavenReleaseRepositoryUrl') ? mavenReleaseRepositoryUrl
14+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
15+
}
16+
}
17+
18+
def getSnapshotRepositoryUrl() {
19+
if(hasProperty('mavenLocalRepositoryPrefix')) {
20+
return "${mavenLocalRepositoryPrefix}${buildDir}/${mavenSnapshotRepositoryUrl}"
21+
} else {
22+
return hasProperty('mavenSnapshotRepositoryUrl') ? mavenSnapshotRepositoryUrl
23+
: "https://oss.sonatype.org/content/repositories/snapshots/"
24+
}
25+
}
26+
27+
def getRepositoryUsername() {
28+
return hasProperty('nexusUsername') ? nexusUsername : ""
29+
}
30+
31+
def getRepositoryPassword() {
32+
return hasProperty('nexusPassword') ? nexusPassword : ""
33+
}
34+
35+
gradle.taskGraph.whenReady { taskGraph ->
36+
if (taskGraph.allTasks.any { it instanceof Sign }) {
37+
allprojects { ext."signing.keyId" = "${signingKeyId}" }
38+
allprojects { ext."signing.secretKeyRingFile" = "${signingKeyRingFile}" }
39+
allprojects { ext."signing.password" = "${signingKeyPassword}" }
40+
}
41+
}
42+
43+
afterEvaluate { project ->
44+
uploadArchives {
45+
repositories {
46+
mavenDeployer {
47+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
48+
49+
pom.groupId = mavenGroup
50+
pom.artifactId = mavenArtifactId
51+
pom.version = mavenVersionName
52+
53+
repository(url: getReleaseRepositoryUrl()) {
54+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
55< C /code>
56+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
57+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
58+
}
59+
60+
pom.project {
61+
name mavenArtifactId
62+
packaging mavenPackaging
63+
description mavenPomDescription
64+
url mavenPomUrl
65+
66+
scm {
67+
url mavenScmUrl
68+
connection mavenScmConnection
69+
developerConnection mavenScmDeveloperConnection
70+
}
71+
72+
licenses {
73+
license {
74+
url mavenLicenseUrl
75+
}
76+
}
77+
78+
developers {
79+
developer {
80+
name mavenDeveloperName
81+
email mavenDeveloperEmail
82+
organization mavenDeveloperOrganization
83+
organizationUrl mavenDeveloperUrl
84+
}
85+
}
86+
}
87+
}
88+
}
89+
}
90+
91+
signing {
92+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
93+
sign configurations.archives
94+
}
95+
96+
task androidSourcesJar(type: Jar) {
97+
classifier = "sources"
98+
from android.sourceSets.main.java.sourceFiles
99+
}
100+
101+
artifacts {
102+
archives androidSourcesJar
103+
}
104+
}

android-database-sqlcipher/native.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ task cleanNative() {
6060
doLast {
6161
logger.info "Cleaning native build artifacts"
6262
["libs", "obj"].each {
63-
new File("${projectDir}/src/main/${it}").deleteDir()
63+
File file = new File("${projectDir}/src/main/${it}")
64+
if(file.exists()){
65+
file.deleteDir()
66+
}
6467
}
6568
}
6669
}

build.gradle

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,63 @@ allprojects {
1717

1818
ext {
1919
clientVersionNumber = "3.5.7"
20+
mavenPackaging = "aar"
21+
mavenGroup = "net.zetetic"
22+
mavenArtifactId = "android-database-sqlcipher"
23+
mavenLocalRepositoryPrefix = "file://"
24+
if(project.hasProperty('publishLocal') && publishLocal.toBoolean()){
25+
mavenSnapshotRepositoryUrl = "outputs/snapshot"
26+
mavenReleaseRepositoryUrl = "outputs/release"
27+
} else {
28+
mavenSnapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots"
29+
mavenReleaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
30+
}
31+
if(project.hasProperty('publishSnapshot') && publishSnapshot.toBoolean()){
32+
mavenVersionName = "${clientVersionNumber}-SNAPSHOT"
33+
} else {
34+
mavenVersionName = "${clientVersionNumber}"
35+
}
36+
if(project.hasProperty('nexusUsername')){
37+
nexusUsername = "${nexusUsername}"
38+
}
39+
if(project.hasProperty('nexusPassword')){
40+
nexusPassword = "${nexusPassword}"
41+
}
42+
mavenPomDescription = "SQLCipher for Android is a plugin to SQLite that provides full database encryption."
43+
mavenPomUrl = "https://www.zetetic.net/sqlcipher"
44+
mavenScmUrl = "https://github.com/sqlcipher/android-database-sqlcipher.git"
45+
mavenScmConnection = "scm:git:https://github.com/sqlcipher/android-database-sqlcipher.git"
46+
mavenScmDeveloperConnection = "scm:git:https://github.com/sqlcipher/android-database-sqlcipher.git"
47+
mavenLicenseUrl = "https://www.zetetic.net/sqlcipher/license/"
48+
mavenDeveloperName = "Zetetic Support"
49+
mavenDeveloperEmail = "support@zetetic.net"
50+
mavenDeveloperOrganization = "Zetetic LLC"
51+
mavenDeveloperUrl = "https://www.zetetic.net"
2052
minimumAndroidSdkVersion = 14
2153
minimumAndroid64BitSdkVersion = 21
2254
targetAndroidSdkVersion = 26
2355
nativeRootOutputDir = "${projectDir}/${name}/src/main"
2456
androidNativeRootDir = "${nativeRootOutputDir}/external/android-libs"
2557
sqlcipherDir = "${projectDir}/${name}/src/main/external/sqlcipher"
26-
opensslDir = "${projectDir}/${name}/src/main/external/openssl"
58+
opensslDir = "${projectDir}/${name}/src/main/external/openssl"
2759
sqlcipherCFlags = "-DSQLITE_HAS_CODEC " +
28-
"-DSQLITE_SOUNDEX " +
29-
"-DHAVE_USLEEP=1 " +
30-
"-DSQLITE_TEMP_STORE=3 " +
31-
"-DSQLITE_THREADSAFE=1 " +
32-
"-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 " +
33-
"-DNDEBUG=1 " +
34-
"-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 " +
35-
"-DSQLITE_ENABLE_LOAD_EXTENSION " +
36-
"-DSQLITE_ENABLE_COLUMN_METADATA " +
37-
"-DSQLITE_ENABLE_UNLOCK_NOTIFY " +
38-
"-DSQLITE_ENABLE_RTREE " +
39-
"-DSQLITE_ENABLE_STAT3 " +
40-
"-DSQLITE_ENABLE_STAT4 " +
41-
"-DSQLITE_ENABLE_JSON1 " +
42-
"-DSQLITE_ENABLE_FTS3_PARENTHESIS " +
43-
"-DSQLITE_ENABLE_FTS4 " +
44-
"-DSQLITE_ENABLE_FTS5 " +
60+
"-DSQLITE_SOUNDEX " +
61+
"-DHAVE_USLEEP=1 " +
62+
"-DSQLITE_TEMP_STORE=3 " +
63+
"-DSQLITE_THREADSAFE=1 " +
64+
"-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 " +
65+
"-DNDEBUG=1 " +
66+
"-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 " +
67+
"-DSQLITE_ENABLE_LOAD_EXTENSION " +
68+
"-DSQLITE_ENABLE_COLUMN_METADATA " +
69+
"-DSQLITE_ENABLE_UNLOCK_NOTIFY " +
70+
"-DSQLITE_ENABLE_RTREE " +
71+
"-DSQLITE_ENABLE_STAT3 " +
72+
"-DSQLITE_ENABLE_STAT4 " +
73+
"-DSQLITE_ENABLE_JSON1 " +
74+
"-DSQLITE_ENABLE_FTS3_PARENTHESIS " +
75+
"-DSQLITE_ENABLE_FTS4 " +
76+
"-DSQLITE_ENABLE_FTS5 " +
4577
"-DSQLCIPHER_CRYPTO_OPENSSL"
4678
}
4779

0 commit comments

Comments
 (0)
0