Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
59b7677e
Unverified
Commit
59b7677e
authored
Feb 19, 2021
by
Alexey Tsvetkov
Committed by
GitHub
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to configure signing using env variables (#66)
parent
e093afc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
build.gradle.kts
skiko/build.gradle.kts
+13
-13
properties.kt
skiko/buildSrc/src/main/kotlin/properties.kt
+12
-0
No files found.
skiko/build.gradle.kts
View file @
59b7677e
...
...
@@ -315,17 +315,17 @@ fun localSign(signer: String, lib: File) {
}
}
fun
remoteSign
(
sign
_h
ost
:
String
,
lib
:
File
)
{
println
(
"Remote signing $lib on $sign
_h
ost"
)
val
user
=
project
.
properties
[
"sign_host_user"
]
as
String
val
token
=
project
.
properties
[
"sign_host_token"
]
as
String
fun
remoteSign
(
sign
H
ost
:
String
,
lib
:
File
)
{
println
(
"Remote signing $lib on $sign
H
ost"
)
val
user
=
skiko
.
signUser
?:
error
(
"signUser is null"
)
val
token
=
skiko
.
signToken
?:
error
(
"signToken is null"
)
val
out
=
file
(
"${lib.absolutePath}.signed"
)
val
cmd
=
"""
TOKEN=`curl -fsSL --user $user:$token --url "$sign
_h
ost/auth" | grep token | cut -d '"' -f4` \
TOKEN=`curl -fsSL --user $user:$token --url "$sign
H
ost/auth" | grep token | cut -d '"' -f4` \
&& curl --no-keepalive --http1.1 --data-binary @${lib.absolutePath} \
-H "Authorization: Bearer ${'$'}TOKEN" \
-H "Content-Type:application/x-mac-app-bin" \
"$sign
_h
ost/sign?name=${lib.name}" -o "${out.absolutePath}"
"$sign
H
ost/sign?name=${lib.name}" -o "${out.absolutePath}"
"""
.
trimIndent
()
val
proc
=
ProcessBuilder
(
"bash"
,
"-c"
,
cmd
)
.
redirectOutput
(
ProcessBuilder
.
Redirect
.
PIPE
)
...
...
@@ -389,14 +389,14 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
doLast
{
val
dylib
=
outputs
.
files
.
files
.
singleOrNull
{
it
.
name
.
endsWith
(
".dylib"
)
}
logger
.
info
(
"Resulting dylib: $dylib"
)
if
(
dylib
!=
null
)
{
(
project
.
properties
[
"signer"
]
as
String
?)
?.
let
{
signer
->
dylib
?.
let
{
lib
->
localSign
(
signer
,
lib
)
localSign
(
signer
,
dylib
)
}
}
(
project
.
properties
[
"sign_host"
]
as
String
?)
?.
let
{
sign_host
->
dylib
?.
let
{
lib
->
remoteSign
(
sign_host
,
lib
)
skiko
.
signHost
?.
let
{
signHost
->
remoteSign
(
signHost
,
dylib
)
}
}
}
...
...
skiko/buildSrc/src/main/kotlin/properties.kt
View file @
59b7677e
...
...
@@ -114,6 +114,18 @@ class SkikoProperties(private val myProject: Project) {
val
composeRepoKey
:
String
get
()
=
System
.
getenv
(
"COMPOSE_REPO_KEY"
)
?:
""
val
signHost
:
String
?
get
()
=
System
.
getenv
(
"JB_SIGN_HOST"
)
?:
(
myProject
.
findProperty
(
"sign_host"
)
as
?
String
)
val
signUser
:
String
?
get
()
=
System
.
getenv
(
"JB_SIGN_USER"
)
?:
(
myProject
.
findProperty
(
"sign_host_user"
)
as
?
String
)
val
signToken
:
String
?
get
()
=
System
.
getenv
(
"JB_SIGN_TOKEN"
)
?:
(
myProject
.
findProperty
(
"sign_host_token"
)
as
?
String
)
val
dependenciesDir
:
File
get
()
=
myProject
.
rootProject
.
projectDir
.
resolve
(
"dependencies"
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment