Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
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
abdullh.alsoleman
Front-End
Commits
646ff43f
Commit
646ff43f
authored
Jul 21, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Iterate on build_sky_apk.dart
parent
688fb26a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
42 deletions
+93
-42
build_sky_apk.dart
packages/flutter_tools/bin/build_sky_apk.dart
+93
-42
No files found.
packages/flutter_tools/bin/build_sky_apk.dart
View file @
646ff43f
...
@@ -12,12 +12,77 @@ const String kAndroidPlatformVersion = '22';
...
@@ -12,12 +12,77 @@ const String kAndroidPlatformVersion = '22';
const
String
kKeystoreKeyName
=
"chromiumdebugkey"
;
const
String
kKeystoreKeyName
=
"chromiumdebugkey"
;
const
String
kKeystorePassword
=
"chromium"
;
const
String
kKeystorePassword
=
"chromium"
;
const
String
kICUDataFile
=
'icudtl.dat'
;
class
AssetBuilder
{
final
Directory
outDir
;
void
run
(
String
command
,
List
<
String
>
args
)
{
Directory
_assetDir
;
ProcessResult
result
=
Process
.
runSync
(
command
,
args
);
stdout
.
write
(
result
.
stdout
);
AssetBuilder
(
this
.
outDir
)
{
stderr
.
write
(
result
.
stderr
);
_assetDir
=
new
Directory
(
'
${outDir.path}
/assets'
);
_assetDir
.
createSync
(
recursive:
true
);
}
void
add
(
File
asset
,
String
assetName
)
{
asset
.
copySync
(
'
${_assetDir.path}
/
$assetName
'
);
}
Directory
get
directory
=>
_assetDir
;
}
class
ApkBuilder
{
final
String
androidSDK
;
File
_androidJar
;
File
_aapt
;
File
_zipalign
;
String
_jarsigner
;
ApkBuilder
(
this
.
androidSDK
)
{
_androidJar
=
new
File
(
'
$androidSDK
/platforms/android-
$kAndroidPlatformVersion
/android.jar'
);
String
buildTools
=
'
$androidSDK
/build-tools/
$kBuildToolsVersion
'
;
_aapt
=
new
File
(
'
$buildTools
/aapt'
);
_zipalign
=
new
File
(
'
$buildTools
/zipalign'
);
_jarsigner
=
'jarsigner'
;
}
void
package
(
File
androidManifest
,
Directory
assets
,
File
outputApk
)
{
_run
(
_aapt
.
path
,
[
'package'
,
'-M'
,
androidManifest
.
path
,
'-A'
,
assets
.
path
,
'-I'
,
_androidJar
.
path
,
'-F'
,
outputApk
.
path
,
]);
}
void
add
(
Directory
base
,
String
resource
,
File
outputApk
)
{
_run
(
_aapt
.
path
,
[
'add'
,
'-f'
,
outputApk
.
absolute
.
path
,
resource
,
],
workingDirectory:
base
.
path
);
}
void
sign
(
File
keystore
,
String
keystorePassword
,
String
keyName
,
File
outputApk
)
{
_run
(
_jarsigner
,
[
'-keystore'
,
keystore
.
path
,
'-storepass'
,
keystorePassword
,
outputApk
.
path
,
keyName
,
]);
}
void
align
(
File
unalignedApk
,
File
outputApk
)
{
_run
(
_zipalign
.
path
,
[
'4'
,
unalignedApk
.
path
,
outputApk
.
path
]);
}
void
_run
(
String
command
,
List
<
String
>
args
,
{
String
workingDirectory
})
{
ProcessResult
result
=
Process
.
runSync
(
command
,
args
,
workingDirectory:
workingDirectory
);
if
(
result
.
exitCode
==
0
)
return
;
stdout
.
write
(
result
.
stdout
);
stderr
.
write
(
result
.
stderr
);
}
}
}
main
(
List
<
String
>
argv
)
async
{
main
(
List
<
String
>
argv
)
async
{
...
@@ -28,41 +93,27 @@ main(List<String> argv) async {
...
@@ -28,41 +93,27 @@ main(List<String> argv) async {
ArgResults
args
=
parser
.
parse
(
argv
);
ArgResults
args
=
parser
.
parse
(
argv
);
File
unalignedApk
=
new
File
(
'out/Example.apk.unaligned'
);
Directory
artifacts
=
new
Directory
(
'artifacts'
);
File
finalApk
=
new
File
(
'out/Example.apk'
);
File
keystore
=
new
File
(
'
${artifacts.path}
/chromium-debug.keystore'
);
File
androidManifest
=
new
File
(
'artifacts/AndroidManifest.xml'
);
File
androidManifest
=
new
File
(
'
${artifacts.path}
/AndroidManifest.xml'
);
File
classesDex
=
new
File
(
'artifacts/classes.dex'
);
File
icuData
=
new
File
(
'
${artifacts.path}
/assets/icudtl.dat'
);
File
icuDataFile
=
new
File
(
'artifacts/
$kICUDataFile
'
);
File
appSkyx
=
new
File
(
args
[
'skyx'
]);
File
keystore
=
new
File
(
'artifacts/chromium-debug.keystore'
);
Directory
outDir
=
new
Directory
(
'out'
);
String
androidSDK
=
args
[
'android-sdk'
];
outDir
.
createSync
(
recursive:
true
);
String
buildTools
=
'
$androidSDK
/build-tools/
$kBuildToolsVersion
'
;
String
aapt
=
'
$buildTools
/aapt'
;
AssetBuilder
assetBuilder
=
new
AssetBuilder
(
outDir
);
String
zipalign
=
'
$buildTools
/zipalign'
;
assetBuilder
.
add
(
icuData
,
'icudtl.dat'
);
File
androidJar
=
new
File
(
'
$androidSDK
/platforms/android-
$kAndroidPlatformVersion
/android.jar'
);
assetBuilder
.
add
(
appSkyx
,
'app.skyx'
);
String
jarsigner
=
'jarsigner'
;
ApkBuilder
builder
=
new
ApkBuilder
(
args
[
'android-sdk'
]);
Directory
assets
=
new
Directory
(
'out/assets'
);
await
assets
.
create
(
recursive:
true
);
File
unalignedApk
=
new
File
(
'
${outDir.path}
/Example.apk.unaligned'
);
File
finalApk
=
new
File
(
'
${outDir.path}
/Example.apk'
);
icuDataFile
.
copy
(
'
${assets.path}
/
$kICUDataFile
'
);
builder
.
package
(
androidManifest
,
assetBuilder
.
directory
,
unalignedApk
);
run
(
aapt
,
[
builder
.
add
(
artifacts
,
'classes.dex'
,
unalignedApk
);
'package'
,
builder
.
add
(
artifacts
,
'lib/armeabi-v7a/libsky_shell.so'
,
unalignedApk
);
'-M'
,
androidManifest
.
path
,
builder
.
sign
(
keystore
,
kKeystorePassword
,
kKeystoreKeyName
,
unalignedApk
);
'-A'
,
assets
.
path
,
builder
.
align
(
unalignedApk
,
finalApk
);
'-I'
,
androidJar
.
path
,
'-F'
,
unalignedApk
.
path
,
]);
run
(
aapt
,
[
'add'
,
'-f'
,
unalignedApk
.
path
,
classesDex
.
path
]);
run
(
jarsigner
,
[
'-keystore'
,
keystore
.
path
,
'-storepass'
,
kKeystorePassword
,
unalignedApk
.
path
,
kKeystoreKeyName
,
]);
run
(
zipalign
,
[
'4'
,
unalignedApk
.
path
,
finalApk
.
path
]);
}
}
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