Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

packer-ng v2 released #79

Merged
merged 68 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
de0050f
update gradle, preparing for v2dev
mcxiaoke May 12, 2017
645f73b
add new v2 signature read and write module, include tests
mcxiaoke May 26, 2017
a67186b
add new commandline module ,not complete
mcxiaoke May 26, 2017
2354330
using new v2 signature common module
mcxiaoke May 26, 2017
3e6a575
new helper android library module
mcxiaoke May 26, 2017
bcfe560
udpate samples, support v2 signature
mcxiaoke May 26, 2017
20c1e3c
update gradle and dependencies
mcxiaoke May 26, 2017
6ecc0ed
rename to Operator class
mcxiaoke May 31, 2017
69499c7
cli: rename to Options class
mcxiaoke May 31, 2017
cbca1bf
add packer-ng command line application
mcxiaoke Jun 1, 2017
ec4fed3
plugin: refactory and packaging support v2 signature scheme
mcxiaoke Jun 2, 2017
7cecc34
fix sample
mcxiaoke Jun 2, 2017
f9716f8
plugin: rename classes
mcxiaoke Jun 2, 2017
4b8ff9b
remove clean task
mcxiaoke Jun 2, 2017
0248133
plugin: refactory and optimize pack task
mcxiaoke Jun 2, 2017
e0a8881
plugin: code fix and optimize
mcxiaoke Jun 5, 2017
6ce7b83
rename classes, tweak docs
mcxiaoke Jun 5, 2017
ce8691b
update and fix sample
mcxiaoke Jun 5, 2017
bdbcbf7
tweak generate , tweak logs
mcxiaoke Jun 5, 2017
ad7c42b
rename some methods, tweak help
mcxiaoke Jun 5, 2017
0eb4238
tweak apk generating, minor fix
mcxiaoke Jun 6, 2017
225a3ce
release v1.7.0 for test
mcxiaoke Jun 6, 2017
60e483b
change channel key and block id
mcxiaoke Jun 7, 2017
5492cba
add first version python script
mcxiaoke Jun 7, 2017
a5da875
python script optimize, refactory to functions
mcxiaoke Jun 7, 2017
d3d60da
remove unused, simplify apkinfo.py
mcxiaoke Jun 7, 2017
71bdde8
show apk package and version
mcxiaoke Jun 7, 2017
dc5b4b7
minor fix packer-ng script
mcxiaoke Jun 7, 2017
033e71c
add docs for v2 to readme
mcxiaoke Jun 7, 2017
a4adee7
release v1.8.0 for test
mcxiaoke Jun 7, 2017
7481e4e
minor fix readme
mcxiaoke Jun 7, 2017
e47f418
rename classes, tweak payload write
mcxiaoke Jun 8, 2017
4f84ada
more find functions to python script
mcxiaoke Jun 8, 2017
81d47bb
update payload format
mcxiaoke Jun 9, 2017
faed97b
update python script
mcxiaoke Jun 9, 2017
988d7eb
delete unused main class
mcxiaoke Jun 9, 2017
3d1d85e
add kmp search class
mcxiaoke Jun 9, 2017
12279db
add kmp channel reader and tests
mcxiaoke Jun 9, 2017
2ad507e
fix plugin output dir
mcxiaoke Jun 9, 2017
b555a74
tweak channels parse and escape
mcxiaoke Jun 9, 2017
c6e668f
tweak python script
mcxiaoke Jun 9, 2017
cace43f
optimize python script
mcxiaoke Jun 9, 2017
f71b8d4
reduce most sample size
mcxiaoke Jun 9, 2017
a226dc7
public read channel method
mcxiaoke Jun 9, 2017
39f60be
sample show other package channel
mcxiaoke Jun 9, 2017
cb27a2d
release v1.9.0 for test
mcxiaoke Jun 9, 2017
75251c1
add packer-ng-1.9.0.jar
mcxiaoke Jun 9, 2017
63be99a
release v1.9.1 for test
mcxiaoke Jun 12, 2017
cee3cbb
update executable jar
mcxiaoke Jun 12, 2017
f53a561
simplify common and helper classes
mcxiaoke Jun 13, 2017
1d52c26
release v1.9.2 for test
mcxiaoke Jun 13, 2017
b5bee4a
add v1.9.2 executable jar
mcxiaoke Jun 13, 2017
167ede1
format python script
mcxiaoke Jun 13, 2017
5a31c85
add read channel c code
mcxiaoke Jun 13, 2017
7da520d
update c read code
mcxiaoke Jun 14, 2017
dde9a36
fix read.c compile warnings
mcxiaoke Jun 14, 2017
2c1d52b
add generic make file
mcxiaoke Jun 14, 2017
8767abd
udpate gitignore
mcxiaoke Jun 14, 2017
90654c5
add sample channels
mcxiaoke Jun 15, 2017
355f89b
autopep8 fix python script
mcxiaoke Jun 15, 2017
4cde1c6
rename sample to app
mcxiaoke Jun 15, 2017
cfd16e1
update readme
mcxiaoke Jun 15, 2017
126520f
update readme
mcxiaoke Jun 15, 2017
8896a68
fix and tweak c read program
mcxiaoke Jun 15, 2017
ab345d5
release v1.9.3 for test
mcxiaoke Jun 15, 2017
d54f163
tweak c program build
mcxiaoke Jun 16, 2017
80ac0ff
release and upload v2.0.0
mcxiaoke Jun 22, 2017
b9e44ac
Merge branch 'master' into v2dev
mcxiaoke Jun 22, 2017
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
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
build/
apks/
repo/
dist/
tmp/
*.iml
*.apk
*.pyc
*.d
*.o
*.class
.DS_Store
packer.properties
a.out
.classpath
.project
.settings/
File renamed without changes.
File renamed without changes.
117 changes: 117 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
buildscript {
ext.packer_version = '2.0.0-SNAPSHOT'

repositories {
maven { url '/tmp/repo/' }
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
classpath "com.android.tools.build:gradle:2.2.3"
classpath "com.mcxiaoke.packer-ng:plugin:$packer_version"
}
}

repositories {
maven { url '/tmp/repo/' }
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

apply plugin: 'com.android.application'
apply plugin: 'packer'

// https://code.google.com/p/android/issues/detail?id=171089
dependencies {
compile "com.mcxiaoke.packer-ng:helper:$packer_version"
}

//packer-begin
packer {
archiveNameFormat = '${appPkg}-${buildType}-v${versionName}-${channel}'
archiveOutput = new File(project.rootProject.buildDir, "apks")
// channelList = ['*Douban*', 'Google/', '中文/@#市场', 'Hello@World',
// 'GradleTest', '20070601!@#$%^&*(){}:"<>?-=[];\',./']
// channelFile = new File(project.rootDir, "channels.txt")
channelMap = [
"free" : project.rootProject.file("channels/free.txt"),
"paid" : project.rootProject.file("channels/paid.txt"),
"other": project.rootProject.file("channels/channels.txt")
]
}
//packer-end

android {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
encoding "UTF-8"
}

compileSdkVersion project.compileSdkVersion
buildToolsVersion project.buildToolsVersion

defaultConfig {
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
}

signingConfigs {
v2 {
storeFile file("android.keystore")
storePassword "android"
keyAlias "android"
keyPassword "android"
v2SigningEnabled true
}

v1 {
storeFile file("android.keystore")
storePassword "android"
keyAlias "android"
keyPassword "android"
v2SigningEnabled false
}

}

buildTypes {
release {
signingConfig signingConfigs.v2
minifyEnabled false
}

beta {
signingConfig signingConfigs.v1
minifyEnabled false
}

alpha {
minifyEnabled false
}

}

productFlavors {
free {}

paid {}

other {}
}

lintOptions {
abortOnError false
htmlReport true
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}

}
File renamed without changes.
1 change: 1 addition & 0 deletions app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mcxiaoke.packer.ng.sample">
package="com.mcxiaoke.packer.samples">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:label="PackerNg">

<activity
android:name="com.mcxiaoke.packer.samples.MainActivity"
android:label="@string/app_name">
android:name=".MainActivity"
android:label="PackerNg">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
43 changes: 43 additions & 0 deletions app/src/main/java/com/mcxiaoke/packer/samples/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.mcxiaoke.packer.samples;

import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import com.mcxiaoke.packer.helper.PackerNg;

import java.io.File;
import java.util.List;


public class MainActivity extends Activity {
private static final String TAG = "PackerNg";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView v = new TextView(this);
LayoutParams p = new LayoutParams(-1, -1);
setContentView(v, p);
v.setTextSize(TypedValue.COMPLEX_UNIT_SP, 40);
v.setGravity(Gravity.CENTER);
v.setPadding(40, 40, 40, 40);
v.setText(PackerNg.getChannel(this));

PackageManager pm = getPackageManager();
List<ApplicationInfo> apps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo app : apps) {
if (app.packageName.startsWith("com.douban.")) {
Log.d("TAG", "app=" + app.packageName + ", channel="
+ PackerNg.getChannel(new File(app.sourceDir)));
}
}

}

}
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.3"
minSdkVersion = 14
targetSdkVersion = 22
}

group = GROUP
version = VERSION_NAME
16 changes: 16 additions & 0 deletions channels/channels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Google_Market#Google电子市场
Hiapk_Market#安卓市场
Yingyonghui_Market#应用汇市场
ali_market#阿里云商店
Xiaomi_Market#小米市场
Yingyongbao_Market#腾讯应用宝市场
Samsung_Market#三星市场
OPPO_Market#OPPO市场
Huawei_Market#华为市场
amazon_market#亚马逊市场
Meizu_Market#魅族市场
3G_market#3G安卓市场
WanDouJia_Parter#豌豆荚
Baidu_Market#百度应用中心
360_Market#360手机助手
Taobao_Market#淘宝应用市场
7 changes: 7 additions & 0 deletions channels/free.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Cat1#hello2
cat2#哈哈哈
BigCat#hello1
田园猫
橘Cat#gogogo
GoodCat
Special@Cat%001 # oooo
4 changes: 4 additions & 0 deletions channels/paid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dog1
Dog2#d1
Dog3#d5
金毛# it is a dog
49 changes: 49 additions & 0 deletions cli/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
buildscript {
repositories {
jcenter()
}
dependencies {
}
}

repositories {
jcenter()
}

apply plugin: 'java'
//apply plugin: 'application'

sourceCompatibility = 1.7
targetCompatibility = 1.7

dependencies {
compile project(":common")
compile 'com.android.tools.build:apksig:2.3.2'
}

//mainClassName = 'com.mcxiaoke.packer.cli.Main'

task fatJar(type: Jar) {
with jar
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes('Implementation-Title': 'PackerNg 2 Executable Jar',
'Implementation-Version': VERSION_NAME,
'Main-Class': 'com.mcxiaoke.packer.cli.Main',
'Description': 'This is PackerNg 2 executable Jar.',
'Owner': 'packer-ng-plugin@mcxiaoke.com',
'Project': 'https://github.com/mcxiaoke/packer-ng-plugin')
}
baseName = 'packer-ng'

}

task distJar(type: Copy, dependsOn: fatJar) {
from fatJar.outputs.files
into project.rootProject.file('tools')
}

// apply from: '../jar.gradle'
apply from: '../gradle-mvn-push.gradle'
3 changes: 3 additions & 0 deletions cli/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_ARTIFACT_ID=cli
POM_PACKAGING=jar
POM_NAME=Commandline Classes for Packer-Ng
47 changes: 47 additions & 0 deletions cli/src/main/java/com/mcxiaoke/packer/cli/Bridge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.mcxiaoke.packer.cli;

import com.android.apksig.ApkVerifier;
import com.android.apksig.ApkVerifier.Builder;
import com.android.apksig.ApkVerifier.Result;
import com.android.apksig.apk.ApkFormatException;
import com.mcxiaoke.packer.common.PackerCommon;

import java.io.File;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;

/**
* User: mcxiaoke
* Date: 2017/5/26
* Time: 16:21
*/
public class Bridge {

public static void writeChannel(File file, String channel) throws IOException {
PackerCommon.writeChannel(file, channel);
}

public static String readChannel(File file) throws IOException {
return PackerCommon.readChannel(file);
}

public static boolean verifyChannel(File file, String channel) throws IOException {
return verifyApk(file) && (channel.equals(readChannel(file)));
}

public static boolean verifyApk(File file) throws IOException {
ApkVerifier verifier = new Builder(file).build();
try {
Result result = verifier.verify();
return result.isVerified()
&& result.isVerifiedUsingV1Scheme()
&& result.isVerifiedUsingV2Scheme();
} catch (ApkFormatException e) {
throw new IOException(e);
} catch (NoSuchAlgorithmException e) {
throw new IOException(e);
}

}

}
Loading