diff --git a/Android/DevSample/buildSrc/CHANGELOG.md b/Android/DevSample/buildSrc/CHANGELOG.md index 4b4131ed..7b1caec7 100644 --- a/Android/DevSample/buildSrc/CHANGELOG.md +++ b/Android/DevSample/buildSrc/CHANGELOG.md @@ -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: diff --git a/Android/DevSample/buildSrc/README.md b/Android/DevSample/buildSrc/README.md index ca6d93e9..2f8494fc 100644 --- a/Android/DevSample/buildSrc/README.md +++ b/Android/DevSample/buildSrc/README.md @@ -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' } } diff --git a/Android/DevSample/buildSrc/gradle.properties b/Android/DevSample/buildSrc/gradle.properties index bb125b01..908a2642 100644 --- a/Android/DevSample/buildSrc/gradle.properties +++ b/Android/DevSample/buildSrc/gradle.properties @@ -20,4 +20,4 @@ org.gradle.daemon=true group=net.wequick.tools.build -version=1.1.0-beta1 +version=1.1.0-beta3 diff --git a/Android/DevSample/buildSrc/src/main/groovy/net/wequick/gradle/HostPlugin.groovy b/Android/DevSample/buildSrc/src/main/groovy/net/wequick/gradle/HostPlugin.groovy index 62591131..119e8897 100644 --- a/Android/DevSample/buildSrc/src/main/groovy/net/wequick/gradle/HostPlugin.groovy +++ b/Android/DevSample/buildSrc/src/main/groovy/net/wequick/gradle/HostPlugin.groovy @@ -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") } } diff --git a/Android/DevSample/small/CHANGELOG.md b/Android/DevSample/small/CHANGELOG.md index 459316ec..459c324e 100644 --- a/Android/DevSample/small/CHANGELOG.md +++ b/Android/DevSample/small/CHANGELOG.md @@ -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: diff --git a/Android/DevSample/small/gradle.properties b/Android/DevSample/small/gradle.properties index e4e55de0..432a662a 100644 --- a/Android/DevSample/small/gradle.properties +++ b/Android/DevSample/small/gradle.properties @@ -1,2 +1,2 @@ group=net.wequick.small -version=1.1.0-beta6 +version=1.1.0-beta7 diff --git a/Android/GETTING-STARTED.md b/Android/GETTING-STARTED.md index 169e967d..9157af0a 100644 --- a/Android/GETTING-STARTED.md +++ b/Android/GETTING-STARTED.md @@ -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' } } @@ -47,7 +47,7 @@ apply plugin: 'net.wequick.small' ```groovy small { - aarVersion = '1.1.0-beta6' + aarVersion = '1.1.0-beta7' } ``` diff --git a/Android/README.md b/Android/README.md index 1f6058e2..f9902e61 100644 --- a/Android/README.md +++ b/Android/README.md @@ -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' } ``` diff --git a/Android/Sample/app/src/main/java/net/wequick/example/small/Application.java b/Android/Sample/app/src/main/java/net/wequick/example/small/Application.java index abcd44d3..051439b3 100644 --- a/Android/Sample/app/src/main/java/net/wequick/example/small/Application.java +++ b/Android/Sample/app/src/main/java/net/wequick/example/small/Application.java @@ -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); } @@ -28,7 +28,7 @@ public void onCreate() { // Optional Small.setBaseUri("http://m.wequick.net/demo/"); Small.setWebViewClient(new MyWebViewClient()); - Small.setLoadFromAssets(true); + Small.setLoadFromAssets(BuildConfig.LOAD_FROM_ASSETS); } private static final class MyWebViewClient extends WebViewClient { diff --git a/Android/Sample/build.gradle b/Android/Sample/build.gradle index 824f0965..6a1aac1b 100644 --- a/Android/Sample/build.gradle +++ b/Android/Sample/build.gradle @@ -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 } @@ -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" diff --git a/Android/templates/activities/SmallLauncher/globals.xml.ftl b/Android/templates/activities/SmallLauncher/globals.xml.ftl index 3a5fa383..8a6ad777 100644 --- a/Android/templates/activities/SmallLauncher/globals.xml.ftl +++ b/Android/templates/activities/SmallLauncher/globals.xml.ftl @@ -5,6 +5,6 @@ - - + + diff --git a/Android/templates/activities/SmallLauncher/root/root-full-build.gradle.ftl b/Android/templates/activities/SmallLauncher/root/root-full-build.gradle.ftl index 0b4f1955..88eda81e 100644 --- a/Android/templates/activities/SmallLauncher/root/root-full-build.gradle.ftl +++ b/Android/templates/activities/SmallLauncher/root/root-full-build.gradle.ftl @@ -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}' buildToolsVersion = "${buildToolsVersion}" diff --git a/Android/templates/activities/SmallLauncher/root/root-part-build.gradle.ftl b/Android/templates/activities/SmallLauncher/root/root-part-build.gradle.ftl index 95656c6d..37f2532f 100644 --- a/Android/templates/activities/SmallLauncher/root/root-part-build.gradle.ftl +++ b/Android/templates/activities/SmallLauncher/root/root-part-build.gradle.ftl @@ -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 { @@ -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}' // buildToolsVersion = "${buildToolsVersion}" diff --git a/Android/templates/activities/SmallLauncher/root/src/app_package/LaunchActivity.java.ftl b/Android/templates/activities/SmallLauncher/root/src/app_package/LaunchActivity.java.ftl index 24cf0a5d..651c41ec 100644 --- a/Android/templates/activities/SmallLauncher/root/src/app_package/LaunchActivity.java.ftl +++ b/Android/templates/activities/SmallLauncher/root/src/app_package/LaunchActivity.java.ftl @@ -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; @@ -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(); } diff --git a/Android/templates/activities/SmallLauncher/root/src/app_package/SmallApp.java.ftl b/Android/templates/activities/SmallLauncher/root/src/app_package/SmallApp.java.ftl index de162787..36ef4f63 100644 --- a/Android/templates/activities/SmallLauncher/root/src/app_package/SmallApp.java.ftl +++ b/Android/templates/activities/SmallLauncher/root/src/app_package/SmallApp.java.ftl @@ -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. //