Skip to content

Commit

Permalink
gradle-small:1.1.0-beta3, small:1.1.0-beta7
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlin committed Nov 10, 2016
1 parent 4503695 commit 0eae270
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 16 deletions.
23 changes: 23 additions & 0 deletions Android/DevSample/buildSrc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 1.1.0-beta3 (2016-11-10)

Features:

- 自动为宿主添加 `BuildConfig.LOAD_FROM_ASSETS`, 值等于 `small.buildToAssets`

## 1.1.0-beta2 (2016-11-10)

Features:

- 支持打包插件到宿主Assets, 在根 `build.gradle` 中开启:

```
small {
buildToAssets = true
}
```

Bugfixes:

- 对于 `app.*` 模块, 移除 `Stub` 模块manifest中可能存在的ContentProvider, 避免命名冲突而无法单独运行
- 当插件没有资源时, 移除整个 `generated/source/r/release` 目录, 避免将第三方 `R.class` 打包到插件中

## 1.1.0-beta1 (2016-11-04)

Features:
Expand Down
2 changes: 1 addition & 1 deletion Android/DevSample/buildSrc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gradle-small-plugin是一个gradle插件,用来打包安卓组件包。
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta1'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta3'
}
}
Expand Down
2 changes: 1 addition & 1 deletion Android/DevSample/buildSrc/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
org.gradle.daemon=true

group=net.wequick.tools.build
version=1.1.0-beta1
version=1.1.0-beta3
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class HostPlugin extends AndroidPlugin {
if (releaseSigningConfig != null) {
android.buildTypes.debug.signingConfig = releaseSigningConfig
}

// Add a build config to specify whether load-from-assets or not.
android.defaultConfig.buildConfigField(
"boolean", "LOAD_FROM_ASSETS", rootSmall.buildToAssets ? "true" : "false")
}
}

Expand Down
8 changes: 8 additions & 0 deletions Android/DevSample/small/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.1.0-beta7 (2016-11-10)

Features:

- 取消使用 `SetUpProvider`, 改在宿主Application构造方法中调用 `Small.preSetUp` 来支持ContentProvider (#253)
- `Small.openUri` 增加返回值, false表示打开失败
- 支持从宿主Assets中加载插件: `Small.setLoadFromAssets(true)`

## 1.1.0-beta6 (2016-11-04)

Features:
Expand Down
2 changes: 1 addition & 1 deletion Android/DevSample/small/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=net.wequick.small
version=1.1.0-beta6
version=1.1.0-beta7
4 changes: 2 additions & 2 deletions Android/GETTING-STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta1'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta3'
}
}
Expand All @@ -47,7 +47,7 @@ apply plugin: 'net.wequick.small'

```groovy
small {
aarVersion = '1.1.0-beta6'
aarVersion = '1.1.0-beta7'
}
```

Expand Down
4 changes: 2 additions & 2 deletions Android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
```groovy
buildscript {
dependencies {
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta1'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta3'
}
}
apply plugin: 'net.wequick.small'
small {
aarVersion = '1.1.0-beta6'
aarVersion = '1.1.0-beta7'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Application extends android.app.Application {
public Application() {
// This should be the very first of the application lifecycle.
// It's also ahead of the installing of content providers by what we can avoid
// the ClassNotFound exception on the provider is unimplemented in the host.
// the ClassNotFound exception on if the provider is unimplemented in the host.
Small.preSetUp(this);
}

Expand All @@ -28,7 +28,7 @@ public void onCreate() {
// Optional
Small.setBaseUri("http:https://m.wequick.net/demo/");
Small.setWebViewClient(new MyWebViewClient());
Small.setLoadFromAssets(true);
Small.setLoadFromAssets(BuildConfig.LOAD_FROM_ASSETS);
}

private static final class MyWebViewClient extends WebViewClient {
Expand Down
6 changes: 4 additions & 2 deletions Android/Sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

buildscript {
repositories {
// mavenLocal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta1'
classpath 'net.wequick.tools.build:gradle-small:1.1.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -25,7 +26,8 @@ task clean(type: Delete) {
apply plugin: 'net.wequick.small'

small {
aarVersion = '1.1.0-beta6'
buildToAssets = false
aarVersion = '1.1.0-beta7'
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.3"
Expand Down
4 changes: 2 additions & 2 deletions Android/templates/activities/SmallLauncher/globals.xml.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<global id="assetsOut" value="./app/src/main/assets" />
<global id="mavenUrl" value="mavenCentral" />
<global id="copyGradleSupported" type="boolean" value="${(compareVersions(gradlePluginVersion, '2.0') < 0)?string}" />
<global id="smallPluginVersion" value="1.1.0-beta1" />
<global id="smallAarVersion" value="1.1.0-beta6" />
<global id="smallPluginVersion" value="1.1.0-beta3" />
<global id="smallAarVersion" value="1.1.0-beta7" />
</globals>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ task clean(type: Delete) {
apply plugin: 'net.wequick.small'

small {
// Whether build all the bundles to host assets.
buildToAssets = false

// The compiling `net.wequick.small:small` aar version.
aarVersion = "${smallAarVersion}"

// The project-wide Android version configurations
android {
compileSdkVersion = <#if buildApiString?matches("^\\d+$")>${buildApiString}<#else>'${buildApiString}'</#if>
buildToolsVersion = "${buildToolsVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//// Small plugin
////
//// Cannot automatically merge the buildscript in Android Studio 2.0+,
//// uncomment this section to go into force.
//// uncomment this section and sync the project to go into force.
////-------------------------------------------------------------------
//
//buildscript {
Expand All @@ -16,7 +16,13 @@
//apply plugin: 'net.wequick.small'
//
//small {
// // Whether build all the bundles to host assets.
// buildToAssets = false
//
// // The compiling `net.wequick.small:small` aar version.
// aarVersion = "${smallAarVersion}"
//
// // The project-wide Android version configurations
// android {
// compileSdkVersion = <#if buildApiString?matches("^\\d+$")>${buildApiString}<#else>'${buildApiString}'</#if>
// buildToolsVersion = "${buildToolsVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ${packageName};
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.Toast;

import net.wequick.small.Small;

Expand All @@ -24,10 +25,10 @@ public class ${activityClass} extends Activity {
Small.setUp(this, new Small.OnCompleteListener() {
@Override
public void onComplete() {
if (Small.openUri("main", SplashActivity.this)) {
if (Small.openUri("main", ${activityClass}.this)) {
finish();
} else {
Toast.makeText(SplashActivity.this,
Toast.makeText(${activityClass}.this,
"Open failed, see log for detail!",
Toast.LENGTH_LONG).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,26 @@ import net.wequick.small.Small;
*/
public class SmallApp extends Application {

public SmallApp() {
// This should be the very first of the application lifecycle.
// It's also ahead of the installing of content providers by what we can avoid
// the ClassNotFound exception on if the provider is unimplemented in the host.
Small.preSetUp(this);
}

@Override
public void onCreate() {
super.onCreate();

// Whether load the bundles from assets or not.
// AUTO-SET VALUE. DO NOT MODIFY.
// This value will be automatically set by define:
// small {
// buildToAssets = true|false
// }
// in your root build.gradle.
Small.setLoadFromAssets(BuildConfig.LOAD_FROM_ASSETS);

// If you have some native web modules, uncomment following
// to declare a base URI for cross-platform page jumping.
//
Expand Down

0 comments on commit 0eae270

Please sign in to comment.